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
This commit is contained in:
Benno Schulenberg 2015-03-28 17:01:46 +00:00
parent 6f2da6b9b2
commit 07e199ff0e
5 changed files with 13 additions and 4 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

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