diff --git a/src/cut.c b/src/cut.c index d4e404979974fedf7d22dd56922a14a496f483f6..5b70570b453268e286898eb1cd9bc1c645671539 100644 --- a/src/cut.c +++ b/src/cut.c @@ -292,7 +292,7 @@ void do_uncut_text(void) set_modified(); /* Update current_y to account for the inserted lines. */ - place_the_cursor(); + place_the_cursor(TRUE); refresh_needed = TRUE; diff --git a/src/files.c b/src/files.c index 30ad365062944be3170e148f4579dc898d268c17..a3ba9de983fa89bcd97143d3dfeb2830632a0080 100644 --- a/src/files.c +++ b/src/files.c @@ -1198,7 +1198,7 @@ void do_insertfile(void) set_modified(); /* Update current_y to account for inserted lines. */ - place_the_cursor(); + place_the_cursor(TRUE); refresh_needed = TRUE; } diff --git a/src/nano.c b/src/nano.c index d4284b6b5f506110caa3abea478addfe3f5772a1..2a13e2da0212416916791421b68ec75fdd89e369 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2659,7 +2659,7 @@ int main(int argc, char **argv) /* Refresh just the cursor position or the entire edit window. */ if (!refresh_needed) { - place_the_cursor(); + place_the_cursor(TRUE); wnoutrefresh(edit); } else edit_refresh(); diff --git a/src/proto.h b/src/proto.h index 7db0ace28f19a07d615fd060a75cbe9924c48627..0581762fc36b6ec3107202936a1e50bec9b798f1 100644 --- a/src/proto.h +++ b/src/proto.h @@ -650,7 +650,7 @@ void warn_and_shortly_pause(const char *msg); void statusline(message_type importance, const char *msg, ...); void bottombars(int menu); void onekey(const char *keystroke, const char *desc, int length); -void place_the_cursor(void); +void place_the_cursor(bool forreal); void edit_draw(filestruct *fileptr, const char *converted, int line, size_t from_col); int update_line(filestruct *fileptr, size_t index); diff --git a/src/text.c b/src/text.c index 251a3e66f7d8c86b43a7f81c67e19767348e44f2..7fc582081461d6827688039cb7b613cf3b456b1d 100644 --- a/src/text.c +++ b/src/text.c @@ -2439,7 +2439,7 @@ void do_justify(bool full_justify) do { #endif statusbar(_("Can now UnJustify!")); - place_the_cursor(); + place_the_cursor(TRUE); curs_set(1); kbinput = do_input(FALSE); #ifndef NANO_TINY @@ -3311,7 +3311,7 @@ void do_linter(void) } /* Place and show the cursor to indicate the affected line. */ - place_the_cursor(); + place_the_cursor(TRUE); wnoutrefresh(edit); curs_set(1); @@ -3558,7 +3558,7 @@ void do_verbatim_input(void) /* TRANSLATORS: This is displayed when the next keystroke will be * inserted verbatim. */ statusbar(_("Verbatim Input")); - place_the_cursor(); + place_the_cursor(TRUE); curs_set(1); /* Read in all the verbatim characters. */ diff --git a/src/winio.c b/src/winio.c index bf6b5fb695fc8a68ce7a31963386b8949b4906a6..9f431f9595f213a895878478041bed7e5f8266f2 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1235,7 +1235,7 @@ int parse_escape_sequence(WINDOW *win, int kbinput) suppress_cursorpos = FALSE; lastmessage = HUSH; if (currmenu == MMAIN) { - place_the_cursor(); + place_the_cursor(TRUE); curs_set(1); } } @@ -2271,7 +2271,7 @@ void onekey(const char *keystroke, const char *desc, int length) /* Redetermine current_y from the position of current relative to edittop, * and put the cursor in the edit window at (current_y, "current_x"). */ -void place_the_cursor(void) +void place_the_cursor(bool forreal) { ssize_t row = 0; size_t col, xpt = xplustabs(); @@ -2293,7 +2293,7 @@ void place_the_cursor(void) col = xpt % editwincols; /* If the cursor ought to be in column zero, nudge it there. */ - if (openfile->placewewant % editwincols == 0 && col != 0) { + if (forreal && openfile->placewewant % editwincols == 0 && col != 0) { row++; col = 0; } @@ -2307,7 +2307,8 @@ void place_the_cursor(void) if (row < editwinrows) wmove(edit, row, margin + col); - openfile->current_y = row; + if (forreal) + openfile->current_y = row; } /* edit_draw() takes care of the job of actually painting a line into @@ -3089,7 +3090,7 @@ void edit_refresh(void) while (row < editwinrows) blank_row(edit, row++, 0, COLS); - place_the_cursor(); + place_the_cursor(TRUE); wnoutrefresh(edit); refresh_needed = FALSE; @@ -3248,7 +3249,7 @@ void spotlight(bool active, const char *word) room--; } - place_the_cursor(); + place_the_cursor(FALSE); if (active) wattron(edit, hilite_attribute);