Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Dec 1999 10:57:28 +0100
From:      Cejka Rudolf <cejkar@dcse.fee.vutbr.cz>
To:        current@FreeBSD.ORG
Subject:   Re: Problem with syscons in VESA mode
Message-ID:  <19991203105728.A68768@dcse.fee.vutbr.cz>
In-Reply-To: <no.id>; from Kazutaka YOKOTA on Fri, Dec 03, 1999 at 09:17:59AM %2B0900

next in thread | previous in thread | raw e-mail | index | archive | help

Kazutaka YOKOTA wrote (1999/12/03):
> This strange behavior was reported several times in the past.  It must
> be related to screen update logic in syscons. But, I don't think we
> have successfully fixed it at that time :-(
> It's time to analyze the problem again...

Yes. I know about this problem too but I have no time to fix and test
it. Is anybody interested in bug reports? ;-)

* Left margin moving to the right is related to the screen width not
  divisible by 8 and an use of tabulators at the end of line after the
  last valid tab position. So the same problem could be seen for
  example with screen width 90, which is accessible for all
  -current users: Let's suppose that cursor range is 0..89: If the
  cursor is on 80..87, it will move to position 88 and everything is ok.
  If the cursor is on 88..89, the position is calculated properly (you
  can switch to another console then return and cursor will be on
  the right position on column 0), but cursor is moved incorrectly
  on column 8 on the next line and next lines are moved to the left too
  until you switch between consoles.
  I think the fix should be trivial (syscons.c,v 1.327) - but it is
  speculated right now without testing:

--
*** syscons.c	Sun Nov 28 15:29:28 1999
--- /tmp/syscons.c	Fri Dec  3 10:28:59 1999
***************
*** 2946,2956 ****
  	case 0x09:  /* non-destructive tab */
  	    mark_for_update(scp, scp->cursor_pos);
  	    scp->cursor_pos +=3D (8 - scp->xpos % 8u);
- 	    mark_for_update(scp, scp->cursor_pos);
  	    if ((scp->xpos +=3D (8 - scp->xpos % 8u)) >=3D scp->xsize) {
  	        scp->xpos =3D 0;
  	        scp->ypos++;
  	    }
  	    break;
 =20
  	case 0x0a:  /* newline, same pos */
--- 2946,2957 ----
  	case 0x09:  /* non-destructive tab */
  	    mark_for_update(scp, scp->cursor_pos);
  	    scp->cursor_pos +=3D (8 - scp->xpos % 8u);
  	    if ((scp->xpos +=3D (8 - scp->xpos % 8u)) >=3D scp->xsize) {
  	        scp->xpos =3D 0;
  	        scp->ypos++;
+ 	        scp->cursor_pos =3D scp->xsize * scp->ypos;
  	    }
+ 	    mark_for_update(scp, scp->cursor_pos);
  	    break;
 =20
  	case 0x0a:  /* newline, same pos */
--

* There are another problems with syscons updating: When a block
  of text is selected by mouse, it should be hidden when text in this
  block is changed. Unfortunately in many cases the block stays
  selected on the same position... I think we should learn from
  xterm. (But when I tested xterm, it had some problems too...)

  I have created small testing script which can show
  all upcoming problems (I think). But in some cases you have to know
  which block of text should be selected...

--
#!/usr/local/bin/bash

c_before()
{
	tput clear
	I=3D20
	while [ $I -gt 0 ]; do
		echo "$I $I $I $I $I $I $I $I $I $I $I $I $I $I $I $I $I $I $I $I"
		I=3D`expr $I - 1`
	done
	tput sc ; tput cm $1 $2 ; echo -n "*" ; tput rc
	echo "Mark a block and then press Enter and after test too..."
	read Q
	tput cm $1 $2
}

c_after()
{
	read Q
	clear
}

c_cycle()
{
	I=3D$1
	while [ $I -gt 0 ]; do
		echo -n $2
		I=3D`expr $I - 1`
	done
}

c_print()
{
	tput cm 89 8
	printf "\t\nThis text must start at the beginning of the line!\n"
}

clear
PS3=3D"Which test? "
select X in Tab Text Mu1 El0 El1 El2 Il1 Dl1 Dc1 Ic1 Su1 Sd1 Ec1 Sw1 Quit ;=
 do
	if [ -z "$X" ]; then
		echo "Unknown selection"
		break
	fi
	if [ $X =3D Quit ]; then
		break
	fi
	c_before 40 8
	case $X in
	Tab)	c_print ;;		# Bug - 90x30 and tab at the end of line
	Text)	c_cycle 4 "Text " ;;	# Bug - remove_markings
	Mu1)	c_cycle 22 "=1BM" ;;	# Bug - remove_markings
	El0)	c_cycle 1 "=1B[0K" ;;	# Bug - remove_markings
	El1)	c_cycle 1 "=1B[1K" ;;	# Bug - remove_markings
	El2)	c_cycle 1 "=1B[2K" ;;	# Bug - remove_markings
	Il1)	c_cycle 5 "=1B[1L" ;;	# Bug - remove_markings
	Dl1)	c_cycle 5 "=1B[1M" ;;	# Bug - remove_markings
	Dc1)	c_cycle 10 "=1B[1P" ;;	# Bug - remove_markings
	Ic1)	c_cycle 10 "=1B[1@" ;;	# Bug - remove_markings
	Su1)	c_cycle 10 "=1B[1S" ;;	# Bug - remove_markings
	Sd1)	c_cycle 10 "=1B[1T" ;;	# Bug - remove_markings
	Ec1)	c_cycle 1 "=1B[10X" ;;	# Bug - remove_markings
	Sw1)	c_cycle 1 "=1B[100z" ;;	# Bug - don't beep after this
	esac
	c_after
done
--

I have a fast-partial-fix for syscons.c,v 1.308. But please don't apply
this patch - it should be much more intelligent than following patch -
the block is hidden in all cases but I would like to see solution
similar to xterm - a block is hidden only in needed cases.

--
*** syscons.c	Thu Jun 24 20:14:56 1999
--- syscons.c.new	Thu Jun 24 20:16:52 1999
***************
*** 2442,2447 ****
--- 2442,2448 ----
  		sc_vtb_ins(&scp->vtb, 0, scp->xsize,
  			   sc->scr_map[0x20], scp->term.cur_color);
      		mark_all(scp);
+ 		sc_remove_cutmarking(scp);
  	    }
  	    break;
  #if notyet
***************
*** 2567,2572 ****
--- 2568,2574 ----
      		mark_for_update(scp, scp->cursor_pos);
      		mark_for_update(scp, scp->cursor_pos +
  				scp->xsize - 1 - scp->xpos);
+ 		sc_remove_cutmarking(scp);
  		break;
  	    case 1: /* clear from beginning of line to cursor */
  		sc_vtb_erase(&scp->vtb, scp->cursor_pos - scp->xpos,
***************
*** 2574,2579 ****
--- 2576,2582 ----
  			     sc->scr_map[0x20], scp->term.cur_color);
      		mark_for_update(scp, scp->ypos * scp->xsize);
      		mark_for_update(scp, scp->cursor_pos);
+ 		sc_remove_cutmarking(scp);
  		break;
  	    case 2: /* clear entire line */
  		sc_vtb_erase(&scp->vtb, scp->cursor_pos - scp->xpos,
***************
*** 2581,2586 ****
--- 2584,2590 ----
  			     sc->scr_map[0x20], scp->term.cur_color);
      		mark_for_update(scp, scp->ypos * scp->xsize);
      		mark_for_update(scp, (scp->ypos + 1) * scp->xsize - 1);
+ 		sc_remove_cutmarking(scp);
  		break;
  	    }
  	    break;
***************
*** 2593,2598 ****
--- 2597,2603 ----
  		       sc->scr_map[0x20], scp->term.cur_color);
  	    mark_for_update(scp, scp->ypos * scp->xsize);
  	    mark_for_update(scp, scp->xsize * scp->ysize - 1);
+ 	    sc_remove_cutmarking(scp);
  	    break;
 =20
  	case 'M':   /* Delete n lines */
***************
*** 2603,2608 ****
--- 2608,2614 ----
  			  sc->scr_map[0x20], scp->term.cur_color);
  	    mark_for_update(scp, scp->ypos * scp->xsize);
  	    mark_for_update(scp, scp->xsize * scp->ysize - 1);
+ 	    sc_remove_cutmarking(scp);
  	    break;
 =20
  	case 'P':   /* Delete n chars */
***************
*** 2615,2620 ****
--- 2621,2627 ----
  			 sc->scr_map[0x20], scp->term.cur_color);
  	    mark_for_update(scp, scp->cursor_pos);
  	    mark_for_update(scp, scp->cursor_pos + n + count - 1);
+ 	    sc_remove_cutmarking(scp);
  	    break;
 =20
  	case '@':   /* Insert n chars */
***************
*** 2627,2632 ****
--- 2634,2640 ----
  			 sc->scr_map[0x20], scp->term.cur_color);
  	    mark_for_update(scp, scp->cursor_pos);
  	    mark_for_update(scp, scp->cursor_pos + n + count - 1);
+ 	    sc_remove_cutmarking(scp);
  	    break;
 =20
  	case 'S':   /* scroll up n lines */
***************
*** 2636,2641 ****
--- 2644,2650 ----
  	    sc_vtb_delete(&scp->vtb, 0, n * scp->xsize,
  			  sc->scr_map[0x20], scp->term.cur_color);
      	    mark_all(scp);
+ 	    sc_remove_cutmarking(scp);
  	    break;
 =20
  	case 'T':   /* scroll down n lines */
***************
*** 2645,2650 ****
--- 2654,2660 ----
  	    sc_vtb_ins(&scp->vtb, 0, n * scp->xsize,
  		       sc->scr_map[0x20], scp->term.cur_color);
      	    mark_all(scp);
+ 	    sc_remove_cutmarking(scp);
  	    break;
 =20
  	case 'X':   /* erase n characters in line */
***************
*** 2655,2660 ****
--- 2665,2671 ----
  			 sc->scr_map[0x20], scp->term.cur_color);
  	    mark_for_update(scp, scp->cursor_pos);
  	    mark_for_update(scp, scp->cursor_pos + n - 1);
+ 	    sc_remove_cutmarking(scp);
  	    break;
 =20
  	case 'Z':   /* move n tabs backwards */
--

--=20
Rudolf Cejka   (cejkar@dcse.fee.vutbr.cz;  http://www.fee.vutbr.cz/~cejkar)
Brno University of Technology, Faculty of El. Engineering and Comp. Science
Bozetechova 2, 612 66  Brno, Czech Republic


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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