commit 5561d22f19b8ec671f514f5daae7e9a3a2491502
parent aa45994bbbe1000ad121cffd6580e2e462d6f707
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Mon, 18 Sep 2017 19:57:57 -0500
search: trim a failed search string for width instead of length
When reducing the search string to at most half the screen width,
it should employ its width in columns, not its length in bytes.
Also adjust the type of a variable.
This fixes http://savannah.gnu.org/bugs/?52057.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/search.c b/src/search.c
@@ -70,12 +70,12 @@ void regexp_cleanup(void)
void not_found_msg(const char *str)
{
char *disp;
- int numchars;
+ size_t numchars;
assert(str != NULL);
disp = display_string(str, 0, (COLS / 2) + 1, FALSE);
- numchars = actual_x(disp, mbstrnlen(disp, COLS / 2));
+ numchars = actual_x(disp, strnlenpt(disp, COLS / 2));
statusline(HUSH, _("\"%.*s%s\" not found"), numchars, disp,
(disp[numchars] == '\0') ? "" : "...");