replacing: don't let placewewant influence the placement of the cursor
When spotlighting the string to be replaced, placewewant isn't valid, so tell place_the_cursor() to ignore its value to avoid the cursor getting mistakenly placed at the beginning of the next row. This fixes https://savannah.gnu.org/bugs/?50997. Reported-by: David Lawrence Ramsey <pooka109@gmail.com>master
parent
08fd5b349b
commit
28beb3f9c5
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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. */
|
||||
|
|
13
src/winio.c
13
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);
|
||||
|
|
Loading…
Reference in New Issue