From cfffbf71ce98f791ceabd202e9b2d684daa0b2c8 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Wed, 16 Nov 2005 03:14:11 +0000
Subject: [PATCH] in reset_statusbar_cursor(), fix cursor placement problem by
 modeling the code more closely after reset_cursor()

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3185 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog    | 9 +++++++--
 src/prompt.c | 6 +++---
 src/winio.c  | 4 ++--
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fc8d9916..70e3d193 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -136,17 +136,20 @@ CVS code -
 - prompt.c:
   do_statusbar_input()
 	- Fix misplaced break when handling NANO_VERBATIM_KEY. (DLR)
+  reset_statusbar_cursor()
+	- Fix cursor placement problem by modeling the code more closely
+	  after reset_cursor(). (DLR)
 - rcfile.c:
   do_rcfile()
 	- Remove unneeded assert. (DLR)
 - search.c:
   findnextstr()
 	- Remove parameter can_display_wrap, as it's always set to TRUE
-	  now, and rename parameter wholeword to whole_word for
+	  now, and rename parameter wholeword to whole_word, for
 	  consistency. (DLR)
   do_replace_loop()
 	- Change order of parameters to more closely match those of
-	  findnextstr(), and rename parameter wholewords to whole_word
+	  findnextstr(), and rename parameter wholewords to whole_word,
 	  for consistency. (DLR)
 - text.c:
   begpar()
@@ -169,6 +172,8 @@ CVS code -
 - winio.c:
   nanoget_repaint()
 	- Rename parameter inputbuf to buf, for consistency. (DLR)
+  reset_cursor()
+	- Rename variable x to xpt, to avoid confusion. (DLR)
   update_line()
 	- Remove now-unneeded logic that set the index parameter to zero
 	  if the fileptr parameter didn't point to current. (DLR)
diff --git a/src/prompt.c b/src/prompt.c
index c2db21bc..5d08f04e 100644
--- a/src/prompt.c
+++ b/src/prompt.c
@@ -692,10 +692,10 @@ void update_statusbar_line(const char *curranswer, size_t index)
 void reset_statusbar_cursor(void)
 {
     size_t start_col = strlenpt(prompt) + 1;
-    size_t page_start = get_statusbar_page_start(start_col,
-	start_col + statusbar_x);
+    size_t xpt = statusbar_xplustabs();
 
-    wmove(bottomwin, 0, start_col + statusbar_x + 1 - page_start);
+    wmove(bottomwin, 0, start_col + 1 + xpt -
+	get_statusbar_page_start(start_col, start_col + xpt));
 }
 
 /* Return TRUE if we need an update after moving horizontally, and FALSE
diff --git a/src/winio.c b/src/winio.c
index 9b0d5ba2..6cee66f5 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2200,8 +2200,8 @@ void reset_cursor(void)
     openfile->current_y = openfile->current->lineno -
 	openfile->edittop->lineno;
     if (openfile->current_y < editwinrows) {
-	size_t x = xplustabs();
-	wmove(edit, openfile->current_y, x - get_page_start(x));
+	size_t xpt = xplustabs();
+	wmove(edit, openfile->current_y, xpt - get_page_start(xpt));
      }
 }
 
-- 
GitLab