Re: system/5749: vi crashes due to multiple tabs with line numbering on

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Otto Moerbeek <otto@...>
Cc: Johan Mson Lindman <jl@...>, <bugs@...>
Date: Tuesday, March 4, 2008 - 2:03 am

On Sun, Mar 02, 2008 at 11:19:34PM +0100, Otto Moerbeek wrote:

Hey guys, could you give this patch a try? I believe it fixes the
problem, but I have not been able to test it extensively.

The code that keeps track of the number of columns a particular
line takes was not quite right. Without this patch, "curoff" is
behind by 8 characters, and so when you hit a tab at the
beginning of the second terminal line, the TAB_RESET macro
actually subtracts 8 from scno. So at the beginning of the second
terminal line scno (the number of columns) is 80, then after another
tab it is still at 80, which causes all sorts of stuff to go
haywire :P

-Nate


--- vs_relative.c.orig	Tue Mar  4 00:54:55 2008
+++ vs_relative.c	Tue Mar  4 00:55:06 2008
@@ -117,10 +117,13 @@
 	 * Initialize the screen offset.
 	 */
 	scno = 0;
+	curoff = 0;
 
 	/* Leading number if O_NUMBER option set. */
-	if (O_ISSET(sp, O_NUMBER))
+	if (O_ISSET(sp, O_NUMBER)) {
 		scno += O_NUMBER_LENGTH;
+		curoff += O_NUMBER_LENGTH;
+	}
 
 	/* Need the line to go any further. */
 	if (lp == NULL) {
@@ -141,11 +144,9 @@
 	leftright = O_ISSET(sp, O_LEFTRIGHT);
 
 	/*
-	 * Initialize the pointer into the buffer and screen and current
-	 * offsets.
+	 * Initialize the pointer into the buffer.
 	 */
 	p = lp;
-	curoff = 0;
 
 	/* Macro to return the display length of any signal character. */
 #define	CHLEN(val) (ch = *(u_char *)p++) == '\t' &&			\


 
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: system/5749: vi crashes due to multiple tabs with line n..., Johan Mson Lindman, (Sun Mar 2, 1:25 pm)
Re: system/5749: vi crashes due to multiple tabs with line n..., Nathan Houghton, (Tue Mar 4, 2:03 am)