Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Oct 1995 18:18:28 +0000 ()
From:      John Kurtz <jkurtz@ulantris.neosoft.com>
To:        hackers@freebsd.org
Subject:   adding cursor saving and regions to syscons
Message-ID:  <199510281818.SAA00950@ulantris.neosoft.com>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510281818.SAA00950>