From owner-freebsd-hackers Sat Oct 28 16:29:30 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id QAA10208 for hackers-outgoing; Sat, 28 Oct 1995 16:29:30 -0700 Received: from ulantris.neosoft.com (ulantris.NeoSoft.COM [198.64.81.18]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id QAA10203 for ; Sat, 28 Oct 1995 16:29:23 -0700 Received: (from jkurtz@localhost) by ulantris.neosoft.com (8.6.9/8.6.9) id SAA00950; Sat, 28 Oct 1995 18:18:29 GMT From: John Kurtz Message-Id: <199510281818.SAA00950@ulantris.neosoft.com> Subject: adding cursor saving and regions to syscons To: hackers@freebsd.org Date: Sat, 28 Oct 1995 18:18:28 +0000 () X-Mailer: ELM [version 2.4 PL24] Content-Type: text Content-Length: 5061 Sender: owner-hackers@freebsd.org Precedence: bulk Hello Team! This is my first hack on the kernel, so here goes. In my testing of certain ANSI features offered on muds (yes, I visit them and run one), I found the cursor position saving/restoring and scroll regions not supported. I have tested this on my machine, but I feel that I didn't quite cover all the cases on the scrolling regions. This is done with diff on the syscons.c file. The full path is /usr/src/sys/i386/isa/syscons.c and is still in the 2.0R version of source so I am not sure how well this integrates into FreeBSD-current. Anyhow, here is the diff file... ------------------------------------------------------ CLIP HERE ----------- 162a163,169 > int xpos_saved; /* saved X position */ > int ypos_saved; /* saved Y position */ > char position_saved; /* has the cursor position */ > /* been saved? */ > char region_set; /* is a scroll region active? */ > int region_top; /* top of scroll region */ > int region_bottom; /* bottom of scroll region */ 739a747 > scp->region_set = 0; 1464a1473 > scp->region_set = 0; 1601c1610,1625 < if (scp->ypos > 0) --- > if (scp->region_set) { > if (scp->ypos > scp->region_top) > move_crsr(scp, scp->xpos, scp->ypos - 1); > else if(scp->ypos == scp->region_top) { > move_up(scp->crt_base + > (scp->xsize * scp->region_top), > scp->crt_base + > (scp->xsize * > (scp->region_top+1)), > (scp->region_bottom - > scp->region_top) * scp->xsize); > fillw(scp->term.cur_attr | scr_map[0x20], > scp->crt_base + (scp->xsize * > scp->region_top), scp->xsize); > } > } else if (scp->ypos > 0) 1735a1760 > /* does this need to work for regions? */ 1747a1773 > /* does this need to work for regions? */ 1784a1811,1826 > if(scp->region_set) { > if (n > scp->region_bottom-scp->region_top+1) > n = scp->region_bottom- > scp->region_top+1; > bcopy(scp->crt_base + > (scp->xsize * (n+scp->region_top)), > scp->crt_base + > (scp->xsize * scp->region_top), > scp->xsize * (scp->ysize - n) * > sizeof(u_short)); > fillw(scp->term.cur_attr | scr_map[0x20], > scp->crt_base + scp->xsize * > (scp->region_bottom - n + 1), > scp->xsize * n); > break; > } 1798a1841,1856 > if(scp->region_set) { > if (n > scp->region_bottom-scp->region_top+1) > n = scp->region_bottom- > scp->region_top+1; > bcopy(scp->crt_base + > (scp->xsize * scp->region_top), > scp->crt_base + > (scp->xsize * (n+scp->region_top)), > scp->xsize * (scp->ysize - n) * > sizeof(u_short)); > fillw(scp->term.cur_attr | scr_map[0x20], > scp->crt_base + scp->xsize * > scp->region_top, > scp->xsize * n); > break; > } 1891a1950,1995 > case 'r': /* Region setting */ > if (scp->term.num_param == 0) > scp->region_set = 0; > else if (scp->term.num_param == 2) { > if(!scp->term.param[0] && !scp->term.param[1]) > scp->region_set = 0; > else { > scp->region_set = 1; > scp->region_top = scp->term.param[0]; > scp->region_bottom = scp->term.param[1]; > if(scp->region_top > scp->region_bottom) > scp->region_set = 0; > else { > if(--scp->region_top < 0) > scp->region_top = 0; > if(scp->region_top >= > scp->ysize) > scp->region_top = > scp->ysize; > if(--scp->region_bottom < 0) > scp->region_bottom = 0; > if(scp->region_bottom >= > scp->ysize) > scp->region_bottom = > scp->ysize; > } > } > } > break; > case 's': /* save the cursor position -- should this be */ > /* allowed to save multiple points??? */ > scp->position_saved = 1; > scp->xpos_saved = scp->xpos; > scp->ypos_saved = scp->ypos; > break; > > case 'u': /* restore the cursor position -- should this be */ > /* allowed to restore multiple points??? */ > if(scp->position_saved) { > scp->position_saved = 0; > scp->xpos = scp->xpos_saved; > scp->ypos = scp->ypos_saved; > move_crsr(scp, scp->xpos, scp->ypos); > } > break; > 2075c2179,2193 < if (scp->crtat >= scp->crt_base + scp->ysize * scp->xsize) { --- > if(scp->region_set) { > if (scp->crtat == > scp->crt_base + (scp->region_bottom+1) * scp->xsize) { > bcopy(scp->crt_base + (scp->region_top+1)*scp->xsize, > scp->crt_base + scp->region_top*scp->xsize, > scp->xsize * > (scp->region_bottom-scp->region_top) * > sizeof(u_short)); > fillw(scp->term.cur_attr | scr_map[0x20], > scp->crt_base + scp->xsize * scp->region_bottom, > scp->xsize); > scp->crtat -= scp->xsize; > scp->ypos--; > } > } else if (scp->crtat >= scp->crt_base + scp->ysize * scp->xsize) { 2163a2282,2283 > scp->position_saved = 0; > scp->region_set = 0; ------------------------------------------------------ CLIP HERE ----------- John Kurtz (jkurtz@neosoft.com)