commit 15d6857b2739b53f1fd58e486a9048095f271fc2
parent 4ab80154e9e69bc8beded06383a916f03b011e43
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Sun, 31 Jul 2005 20:15:01 +0000
fix cursor position display breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2954 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/winio.c b/src/winio.c
@@ -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. */