Skip to content

Commit

Permalink
Display a message when search with ^W modifier wraps.
Browse files Browse the repository at this point in the history
  • Loading branch information
gwsw committed Dec 10, 2023
1 parent 989b659 commit 55044e0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

* Change default character set on Windows from dos to utf-8.

* Add message when search with ^W wraps (github #459).

* UCRT builds on Windows 10 and later now support Unicode file names
(github #438).

Expand Down
9 changes: 9 additions & 0 deletions command.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ extern void *ml_examine;
extern int wheel_lines;
extern int def_search_type;
extern int updown_match;
extern lbool search_wrapped;
#if SHELL_ESCAPE || PIPEC
extern void *ml_shell;
#endif
Expand Down Expand Up @@ -903,6 +904,14 @@ static void prompt(void)
if (is_filtering())
putstr("& ");
#endif
if (search_wrapped)
{
if (search_type & SRCH_BACK)
error("Search hit top; continuing at bottom", NULL_PARG);
else
error("Search hit bottom; continuing at top", NULL_PARG);
search_wrapped = FALSE;
}
if (p == NULL || *p == '\0')
{
at_enter(AT_NORMAL|AT_COLOR_PROMPT);
Expand Down
2 changes: 2 additions & 0 deletions search.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static POSITION prep_startpos;
static POSITION prep_endpos;
public POSITION header_start_pos = NULL_POSITION;
static POSITION header_end_pos;
public lbool search_wrapped = FALSE;

/*
* Structures for maintaining a set of ranges for hilites and filtered-out
Expand Down Expand Up @@ -1332,6 +1333,7 @@ static int search_range(POSITION pos, POSITION endpos, int search_type, int matc
* the flag so we don't wrap again, and
* continue the search at new pos.
*/
search_wrapped = TRUE;
search_type &= ~SRCH_WRAP;
linenum = find_linenum(pos);
continue;
Expand Down
3 changes: 2 additions & 1 deletion version.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,8 @@ v647 11/16/23 Fix --+option; fix compiler warnings.
v648 11/16/23 Add lang.h to release.
v649 12/1/23 Add line number param to --header.
v650 Add --no-search-header-lines and --no-search-header-columns;
add ^L search modifier; add ^P shell command modifier.
add ^L search modifier; add ^P shell command modifier;
add search wrap message.
*/

char version[] = "650x";

0 comments on commit 55044e0

Please sign in to comment.