Commit 5d1752c5 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

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: default avatarBenno Schulenberg <bensberg@justemail.net>
No related merge requests found
Showing with 3 additions and 4 deletions
+3 -4
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment