nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 07e199ff0eed50e33cb3696e23c22b3ee6c4bd80
parent 6f2da6b9b262b0d8333e771cbb8154d480c9066b
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Sat, 28 Mar 2015 17:01:46 +0000

When searching, put a found off-screen string on the center line
instead of at the bottom or top, to show it in context.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5170 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

Diffstat:
MChangeLog | 7+++++++
Msrc/global.c | 2++
Msrc/proto.h | 1+
Msrc/search.c | 2++
Msrc/winio.c | 5+----
5 files changed, 13 insertions(+), 4 deletions(-)

diff --git 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 @@ -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 @@ -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 @@ -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 @@ -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. */