]> git.wh0rd.org Git - nano.git/commitdiff
revert previous simplification, as it only moved complexity from one
authorDavid Lawrence Ramsey <pooka109@gmail.com>
Mon, 1 Aug 2005 02:18:05 +0000 (02:18 +0000)
committerDavid Lawrence Ramsey <pooka109@gmail.com>
Mon, 1 Aug 2005 02:18:05 +0000 (02:18 +0000)
place to another, and add formatting fixes to the old code

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2957 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/winio.c

index 3f10da681b6ddefb4bf2779d702751f902f7a331..b3f3e1e6d48145a4867a048440c7e7a26ab21723 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -274,7 +274,7 @@ CVS code -
          the status when we're in the file browser, since Pico doesn't.
          (DLR)
   do_cursorpos()
-       - Simplify, and remove unneeded assert. (DLR)
+       - Remove unneeded assert. (DLR)
 - configure.ac:
        - Since we only use vsnprintf() now, remove the tests for
          snprintf(). (DLR)
index a42722562d642812958afaf85a287a64a6eac0f3..236e5f2a0126010c9753c0fc5e9219988bd293bc 100644 (file)
@@ -3823,6 +3823,7 @@ void display_main_list(void)
  * display the current cursor position next time. */
 void do_cursorpos(bool constant)
 {
+    filestruct *f;
     char c;
     size_t i, cur_xpt = xplustabs() + 1;
     size_t cur_lenpt = strlenpt(openfile->current->data) + 1;
@@ -3830,12 +3831,16 @@ void do_cursorpos(bool constant)
 
     assert(openfile->fileage != NULL && openfile->current != NULL);
 
-    i = (openfile->current->prev != NULL) ?
-       get_totsize(openfile->fileage, openfile->current->prev) : 0;
+    f = openfile->current->next;
     c = openfile->current->data[openfile->current_x];
+
+    openfile->current->next = NULL;
     openfile->current->data[openfile->current_x] = '\0';
-    i += mbstrlen(openfile->current->data);
+
+    i = get_totsize(openfile->fileage, openfile->current);
+
     openfile->current->data[openfile->current_x] = c;
+    openfile->current->next = f;
 
     /* Check whether totsize is correct.  If it isn't, there is a bug
      * somewhere. */