From: Chris Allegretta Date: Sun, 15 Nov 2015 06:52:33 +0000 (+0000) Subject: Backport r5362 from trunk. X-Git-Tag: v2.4.3~7 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=ff9423d068fc6a4c18ad341252af795a981ea908;p=nano.git Backport r5362 from trunk. git-svn-id: svn://svn.savannah.gnu.org/nano/branches/nano_2_4_branch@5417 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index b9302b1f..3489d720 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-08-14 Benno Schulenberg + * src/help.c (help_line_len): The wrap location can be beyond the EOL, + so for determining the length of the current line, don't start at that + location but at the beginning. This fixes Savannah bug #45770. + 2015-08-13 Benno Schulenberg * src/search.c (do_find_bracket): Remove mistaken comparison between pointer and literal character. Found with cppcheck. diff --git a/src/help.c b/src/help.c index 1d4d758c..7efef8e2 100644 --- a/src/help.c +++ b/src/help.c @@ -507,6 +507,8 @@ size_t help_line_len(const char *ptr) size_t retval = (wrap_loc < 0) ? 0 : wrap_loc; size_t retval_save = retval; + retval = 0; + /* Get the length of the entire line up to a null or a newline. */ while (*(ptr + retval) != '\0' && *(ptr + retval) != '\n') retval += move_mbright(ptr + retval, 0);