comparison src/spellsuggest.c @ 20786:90b96fa35e4b v8.2.0945

patch 8.2.0945: cannot use "z=" when 'spell' is off Commit: https://github.com/vim/vim/commit/152e79e94bb935e75b866bd55479648cde11066a Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jun 10 15:32:08 2020 +0200 patch 8.2.0945: cannot use "z=" when 'spell' is off Problem: Cannot use "z=" when 'spell' is off. Solution: Make "z=" work even when 'spell' is off. (Christian Brabandt, Gary Johnson, closes #6227)
author Bram Moolenaar <Bram@vim.org>
date Wed, 10 Jun 2020 15:45:04 +0200
parents aadd1cae2ff5
children e01b20e3a720
comparison
equal deleted inserted replaced
20785:919ff930619d 20786:90b96fa35e4b
469 int need_cap; 469 int need_cap;
470 int limit; 470 int limit;
471 int selected = count; 471 int selected = count;
472 int badlen = 0; 472 int badlen = 0;
473 int msg_scroll_save = msg_scroll; 473 int msg_scroll_save = msg_scroll;
474 474 int wo_spell_save = curwin->w_p_spell;
475 if (no_spell_checking(curwin)) 475
476 if (!curwin->w_p_spell)
477 {
478 did_set_spelllang(curwin);
479 curwin->w_p_spell = TRUE;
480 }
481
482 if (*curwin->w_s->b_p_spl == NUL)
483 {
484 emsg(_(e_no_spell));
476 return; 485 return;
486 }
477 487
478 if (VIsual_active) 488 if (VIsual_active)
479 { 489 {
480 // Use the Visually selected text as the bad word. But reject 490 // Use the Visually selected text as the bad word. But reject
481 // a multi-line selection. 491 // a multi-line selection.
684 curwin->w_cursor = prev_cursor; 694 curwin->w_cursor = prev_cursor;
685 695
686 spell_find_cleanup(&sug); 696 spell_find_cleanup(&sug);
687 skip: 697 skip:
688 vim_free(line); 698 vim_free(line);
699 curwin->w_p_spell = wo_spell_save;
689 } 700 }
690 701
691 /* 702 /*
692 * Find spell suggestions for "word". Return them in the growarray "*gap" as 703 * Find spell suggestions for "word". Return them in the growarray "*gap" as
693 * a list of allocated strings. 704 * a list of allocated strings.