Re: Bug with screen redraw introduced by 7.1.329

2012-08-19 Thread Jon Long
On Sunday, August 19, 2012 3:28:35 AM UTC-7, Bram Moolenaar wrote:
> Jon Long wrote:
> 
> 
> 
> > I recently encountered the issue described below, namely that vim
> 
> > always redraws the previous character when using utf8 starting with
> 
> > version 7.1.329.
> 
> > 
> 
> > The purpose of the patch which created this issue was to ensure that
> 
> > the right half of double-width (two cell) characters was always
> 
> > redrawn after being obstructed (e.g., by popup menus). However, the
> 
> > fix seems to redraw _any_ character whenever the right-adjacent one
> 
> > changes.
> 
> > 
> 
> > I've attached a patch which fixes this issue by checking that
> 
> > characters are actually double-width before deciding to redraw them
> 
> > when their right-adjacent partners change. I've checked that this
> 
> > preserves the functionality of the original patch (the right half of a
> 
> > double-width character is still redrawn after being obstructed by a
> 
> > popup menu) while preventing single-width characters from being always
> 
> > redrawn.
> 
> 
> 
> Thanks for the patch.
> 
> 
> 
> You drop the "cols > 1" condition, was that intentional?
> 
> 
> 

Yes. The call to mb_off2cells (which is actually utf_off2cells in this case) 
checks the equivalent condition off_from + 1 < off_from + cols.

Jon Long

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: Bug with screen redraw introduced by 7.1.329

2012-08-18 Thread Jon Long
I recently encountered the issue described below, namely that vim always 
redraws the previous character when using utf8 starting with version 7.1.329.

The purpose of the patch which created this issue was to ensure that the right 
half of double-width (two cell) characters was always redrawn after being 
obstructed (e.g., by popup menus). However, the fix seems to redraw _any_ 
character whenever the right-adjacent one changes.

I've attached a patch which fixes this issue by checking that characters are 
actually double-width before deciding to redraw them when their right-adjacent 
partners change. I've checked that this preserves the functionality of the 
original patch (the right half of a double-width character is still redrawn 
after being obstructed by a popup menu) while preventing single-width 
characters from being always redrawn.

Thanks,
Jon Long

On Tuesday, September 2, 2008 9:35:07 PM UTC-7, tyler wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> hello. I have noticed that starting from 7.1.329, using vim in the
> console with the encoding set
> to utf8, there is a bug with redrawing characters.
> The characters show up on the screen fine (at least to my screen reader), but 
> my
> screen reader is reading out the character that I type,
> then the one before the one I just typed, then the one I typed again.
> for example, I type 12345. On the 2, it says
> "1 12". 3 says "2 23", etc.
> if I comment out these lines that were changed by the patch, it works fine:
>   || (cols > 1 && ScreenLines[off_from + 1]
>!= ScreenLines[off_to + 1])))
> 
> I've confirmed this also effects 7.2.009.
> 
> I'm not sure, but while we're on the subject of redraw bugs,
> every character I type on the command line, e.g. :12345, causes the
> command line to be redrawn. Is there a quick fix for this one also?
> I'm running vim on Linux. If
> you need any other information, I can provide it.
> 
> Thanks,
> Tyler
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
> 
> iEYEARECAAYFAki+E/sACgkQTsjaYASMWKRrDQCfSHyc4keKJjUZjHxhMkTNYnQS
> U48AoKzZvku9bXwkKx5M3UynutosmqhR
> =DS2F
> -END PGP SIGNATURE-

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
*** src/screen.c	2012-08-18 18:36:36.635665817 -0700
--- src/my_screen.c	2012-08-18 18:43:17.479678374 -0700
***
*** 5332,5339 
  		&& (ScreenLinesUC[off_from] != ScreenLinesUC[off_to]
  			|| (ScreenLinesUC[off_from] != 0
  			&& comp_char_differs(off_from, off_to))
! 			|| (cols > 1 && ScreenLines[off_from + 1]
! 		 != ScreenLines[off_to + 1])))
  #endif
  	   ))
  	return TRUE;
--- 5332,5340 
  		&& (ScreenLinesUC[off_from] != ScreenLinesUC[off_to]
  			|| (ScreenLinesUC[off_from] != 0
  			&& comp_char_differs(off_from, off_to))
! 			|| ((*mb_off2cells)(off_from, off_from + cols) > 1)
! 			&& ScreenLines[off_from + 1]
! 			   != ScreenLines[off_to + 1]))
  #endif
  	   ))
  	return TRUE;