Package: most
Version: 4.10.2-3.0.1
Severity: normal
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

There is a glitch in the tab expansion rendering when scrolling horizontally. 
This patch fixes the issue.

As an added extra, I documented the most obscure variable in one of the most 
esoteric and frequently called functions in the application :)

- -- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-ck5
Locale: LANG=es_AR.UTF-8, LC_CTYPE=es_AR.UTF-8 (charmap=UTF-8)

Versions of packages most depends on:
ii  libc6                         2.3.6-2    GNU C Library: Shared libraries an
ii  libslang2                     2.0.5-3    The S-Lang programming library - r

most recommends no packages.

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFECnBL823633cP2P8RAozyAKCRiOkSGS4VqZB3yvJo13EKfhYQhACfTUVG
uJX1rNM8866MBMGD1Qh0Hfg=
=HCb5
-----END PGP SIGNATURE-----
Sólo en most-4.10.2.jkohen/src/: config.h
diff -ur most-4.10.2/src/line.c most-4.10.2.jkohen/src/line.c
--- most-4.10.2/src/line.c	2006-03-03 19:39:38.000000000 -0300
+++ most-4.10.2.jkohen/src/line.c	2006-03-05 01:46:08.000000000 -0300
@@ -124,12 +124,22 @@
 {
    unsigned char *pout;
    char* pattributes;
-   unsigned int i, i_max;
+
+   /* Holds the number of columns for the current character counting
+    * from the left margin (in contrast to the leftmost visible
+    * column).
+    */
+   unsigned int col;
+
+   /* Holds the number of the column up to which to apply the
+    * current/following formatting. Only meaningful when format_rlim > i.
+    */
+   unsigned int format_rlim;
 
    beg = most_forward_columns(beg, end, Most_Column - 1, 0);
    pout = out;
    pattributes = attributes;
-   i = i_max = 0;
+   col = format_rlim = 0;
 
    while (beg < end)
      {
@@ -141,15 +151,15 @@
 	
 	if ((ch == '\r') && (Most_V_Opt == 0))
 	  {
-	     if (i > i_max) i_max = i;
-	     i = 0;
+	     if (col > format_rlim) format_rlim = col;
+	     col = 0;
 	     continue;
 	  }
 	
 	if ((ch == '\b') && (Most_V_Opt == 0))
 	  {
-	     if (i > i_max) i_max = i;
-	     if (i > 0)
+	     if (col > format_rlim) format_rlim = col;
+	     if (col > 0)
 	       {
 		  if (Most_UTF8_Mode)
 		    {
@@ -159,21 +169,21 @@
 			 {
 			    unsigned int char_len = SLwchar_wcwidth(wc);
 			    if (char_len > 1)
-			      i -= char_len - 1;
+			      col -= char_len - 1;
 			 }
 		    }
 		  else
 		    pout--;
 		  pattributes--;
-		  i--;
+		  col--;
 	       }
 	     continue;
 	  }
 	
-	if (i < i_max)		       /* overstrike */
+	if (col < format_rlim)		       /* overstrike */
 	  {
 	     attr = 'b';
-	     if (i < SLtt_Screen_Cols)
+	     if (col < SLtt_Screen_Cols)
 	       {
 		  if (*pout == '_')
 		    attr = 'u';
@@ -185,7 +195,7 @@
 	       }
 	     if (ch == ' ')
 	       {
-		  i++;
+		  col++;
 		  continue;
 	       }
 	     /* drop */
@@ -200,7 +210,7 @@
 	     {
 	        unsigned int char_len = SLwchar_wcwidth(wc);
 		if (char_len > 1)
-	          i += char_len - 1;
+	          col += char_len - 1;
 	     }
 
 	   beg = SLutf8_skip_char(beg, end);
@@ -208,40 +218,45 @@
 
 	   if (len > 1) {
 	     /* Non-ASCII char, display it. */
-	     if (i < SLtt_Screen_Cols)
+	     if (col < SLtt_Screen_Cols)
 	       {
 		  memcpy(pout, prev, len);
 		  pout += len;
 		  *pattributes++ = attr;
 	       }
-	     i++;
+	     col++;
 	     continue;
 	   }
 	}
 
 	if (most_isprint(ch))
 	  {
-	     if (i < SLtt_Screen_Cols)
+	     if (col < SLtt_Screen_Cols)
 	       {
 		  *pout++ = ch;
 		  *pattributes++ = attr;
 	       }
-	     i++;
+	     col++;
 	     continue;
 	  }
 
 	if ((ch == '\t') && (Most_T_Opt == 0) && (Most_Tab_Width))
 	  {
-
-	     int nspaces = Most_Tab_Width - (i % Most_Tab_Width);
+	     /* Tab expansion must take into consideration the
+	      * leftmost visible column. However, variable col holds the
+	      * number of columns from the left margin and must be
+	      * corrected.
+	      */
+	     int vis_col = col + Most_Column - 1;
+	     int nspaces = Most_Tab_Width - (vis_col % Most_Tab_Width);
 	     while (nspaces > 0)
 	       {
-		  if (i < SLtt_Screen_Cols)
+		  if (col < SLtt_Screen_Cols)
 		    {
 		       *pout++ = ' ';
 		       *pattributes++ = attr;
 		    }
-		  i++;
+		  col++;
 		  nspaces--;
 	       }
 	     continue;
@@ -249,36 +264,36 @@
 
 	if (ch & 0x80)
 	  {
-	     if (i < SLtt_Screen_Cols)
+	     if (col < SLtt_Screen_Cols)
 	       {
 		  *pout++ = '~';
 		  *pattributes++ = attr;
 	       }
-	     i++;
+	     col++;
 	     ch &= 0x7F;
 	     /* drop */
 	  }
 	
-	if (i < SLtt_Screen_Cols)
+	if (col < SLtt_Screen_Cols)
 	  {
 	     *pout++ = '^';
 	     *pattributes++ = attr;
 	  }
-	i++;
+	col++;
 	
 	if (ch == 0x7F) ch = '?';
 	else ch += '@';
 	
-	if (i < SLtt_Screen_Cols)
+	if (col < SLtt_Screen_Cols)
 	  {
 	     *pout++ = ch;
 	     *pattributes++ = attr;
 	  }
-	i++;
+	col++;
      }
 
-   if (i < i_max) 
-     i = i_max;
+   if (col < format_rlim) 
+     col = format_rlim;
 
    /* Now add "..." if selective display.  To do that, the next line needs to 
     * be dealt with to determine whether or not it will be hidden.
@@ -286,7 +301,7 @@
    if (Most_Selective_Display 
        && (Most_W_Opt == 0)
        && (beg < Most_Eob)
-       && (i < SLtt_Screen_Cols))
+       && (col < SLtt_Screen_Cols))
      {
 	if (*beg == '\n') beg++;
 
@@ -297,15 +312,16 @@
 	if ((beg >= Most_Eob) || (*beg == '\n') 
 	    || (most_apparant_distance(beg) >= Most_Selective_Display))
 	  {
-	     i_max = i + 3;
-	     while (i < i_max)
+	     /* Add an ellipsis, if they fit on the screen. */
+	     int rlimit = col + 3;
+	     while (col < rlimit)
 	       {
-		  if (i < SLtt_Screen_Cols)
+		  if (col < SLtt_Screen_Cols)
 		    {
 		       *pout++ = '.';
 		       *pattributes++ = ' ';
 		    }
-		  i++;
+		  col++;
 	       }
 	  }
      }
@@ -570,7 +586,7 @@
 	       if (Most_T_Opt == 0)
 		 col = Most_Tab_Width * (col/Most_Tab_Width + 1);
 	       else
-		 col += 2;
+		 col += 2; /* ^I is two chars long. */
 	       break;
 	    }
 	else if (ch & 0x80)
Sólo en most-4.10.2.jkohen/src/: line.c~
Sólo en most-4.10.2.jkohen/src/: Makefile
Sólo en most-4.10.2.jkohen/src/: objs
Sólo en most-4.10.2.jkohen/src/: tags
Sólo en most-4.10.2.jkohen/src/: TAGS
Sólo en most-4.10.2.jkohen/src/: .#window.c
Sólo en most-4.10.2.jkohen/src/: #window.c#

Reply via email to