nano

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

commit 5d1752c5e3347eaf37d729261de111138fa0eb78
parent 523bc0fd4f1c6cc12bb24f7bf58cffc2392b1241
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Mon,  4 Apr 2016 17:53:26 +0200

speller: simplify the calculation of the width of the misspelled word

When finding a misspelled word, the length of the match is simply the
length of that word, and its span in columns is simply the number of
columns that it occupies.  Compute it thus directly.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>

Diffstat:
Msrc/text.c | 7+++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/text.c b/src/text.c @@ -2354,7 +2354,7 @@ void do_full_justify(void) bool do_int_spell_fix(const char *word) { char *save_search, *exp_word; - size_t match_len, current_x_save = openfile->current_x; + size_t current_x_save = openfile->current_x; size_t pww_save = openfile->placewewant; filestruct *edittop_save = openfile->edittop; filestruct *current_save = openfile->current; @@ -2422,15 +2422,14 @@ bool do_int_spell_fix(const char *word) findnextstr_wrap_reset(); /* Find the first whole occurrence of word. */ - result = findnextstr(TRUE, openfile->fileage, 0, word, &match_len); + result = findnextstr(TRUE, openfile->fileage, 0, word, NULL); /* The word must exist; if not, something is wrong. */ if (result == 0) statusbar("Internal error: speller listed unfindable word"); else if (result == 1) { exp_word = display_string(openfile->current->data, xplustabs(), - strnlenpt(openfile->current->data, - openfile->current_x + match_len) - xplustabs(), FALSE); + strlenpt(word), FALSE); edit_refresh();