diff --git a/ChangeLog b/ChangeLog index d72b718d0a108f8d8fe58a3e33eabb39ab55cd00..241e8ef7bc574d65f44ea910b96b5bd2a0a434f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2015-03-28 Benno Schulenberg <bensberg@justemail.net> + * src/search.c (search_init_globals, search_replace_abort), + src/winio.c (edit_redraw), src/proto.h, src/global.c: When finding + an off-screen string, put it on the center line of the screen and + not on the bottom or top line. This restores the old behaviour + that was unintentionally changed in r5149 six days ago. + 2015-03-27 Mark Majeres <mark@engine12.com> * src/text.c (do_alt_speller): Adjust the end point of the marked region for any change in length of the region's last line. diff --git a/src/global.c b/src/global.c index 27ff938dd67b00a441852cc8742b8b8c743dca03..a26ded460425975f87d37ccb1897a50585aed877 100644 --- a/src/global.c +++ b/src/global.c @@ -42,6 +42,8 @@ bool meta_key; /* Whether the current keystroke is a Meta key. */ bool func_key; /* Whether the current keystroke is an extended keypad value. */ +bool focusing = FALSE; + /* Whether an update of the edit window should center the cursor. */ #ifndef DISABLE_WRAPJUSTIFY ssize_t fill = 0; diff --git a/src/proto.h b/src/proto.h index 9199ac04935e2007ce509906922bbd0c5b64e423..f8c8841ed8343713c99f67921ede4ae356369945 100644 --- a/src/proto.h +++ b/src/proto.h @@ -34,6 +34,7 @@ extern bool jump_buf_main; extern bool meta_key; extern bool func_key; +extern bool focusing; #ifndef DISABLE_WRAPJUSTIFY extern ssize_t fill; diff --git a/src/search.c b/src/search.c index 104f823def6d27e7e48e8161e2f8ebc767a13033..a1e2bb3b3516b22b793e4f93675f3cf22c41aea3 100644 --- a/src/search.c +++ b/src/search.c @@ -106,6 +106,7 @@ void not_found_msg(const char *str) void search_replace_abort(void) { display_main_list(); + focusing = FALSE; #ifndef NANO_TINY if (openfile->mark_set) edit_refresh(); @@ -118,6 +119,7 @@ void search_replace_abort(void) /* Initialize the global search and replace strings. */ void search_init_globals(void) { + focusing = TRUE; if (last_search == NULL) last_search = mallocstrcpy(NULL, ""); if (last_replace == NULL) diff --git a/src/winio.c b/src/winio.c index 3dbc1d05a6ece3f6251769abb7b152add305438e..a1e30212d578e18f483769a9c0c7ba997b4383f3 100644 --- a/src/winio.c +++ b/src/winio.c @@ -3161,10 +3161,7 @@ void edit_redraw(filestruct *old_current, size_t pww_save) #endif /* !NANO_TINY */ /* Make sure the current line is on the screen. */ - if (ISSET(SMOOTH_SCROLL)) - edit_update(NONE); - else - edit_update(CENTER); + edit_update((ISSET(SMOOTH_SCROLL) && !focusing) ? NONE : CENTER); /* Update old_current if we're not on the same page as * before. */