]> git.wh0rd.org Git - nano.git/commitdiff
fix cursor position display breakage
authorDavid Lawrence Ramsey <pooka109@gmail.com>
Sun, 31 Jul 2005 20:15:01 +0000 (20:15 +0000)
committerDavid Lawrence Ramsey <pooka109@gmail.com>
Sun, 31 Jul 2005 20:15:01 +0000 (20:15 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2954 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

src/winio.c

index 58b027df3a25a9611b4073598cd7c09b794298fa..554697f87129180ea6871842fd1234b10300df6b 100644 (file)
@@ -3823,6 +3823,7 @@ void display_main_list(void)
  * display the current cursor position next time. */
 void do_cursorpos(bool constant)
 {
+    char c;
     size_t i = 0, cur_xpt = xplustabs() + 1;
     size_t cur_lenpt = strlenpt(openfile->current->data) + 1;
     int linepct, colpct, charpct;
@@ -3831,7 +3832,10 @@ void do_cursorpos(bool constant)
 
     if (openfile->current->prev != NULL)
        i += get_totsize(openfile->fileage, openfile->current->prev);
-    i += mbstrnlen(openfile->current->data, openfile->current_x);
+    c = openfile->current->data[openfile->current_x];
+    openfile->current->data[openfile->current_x] = '\0';
+    i += mbstrlen(openfile->current->data);
+    openfile->current->data[openfile->current_x] = c;
 
     /* Check whether totsize is correct.  If it isn't, there is a bug
      * somewhere. */