To: vim_dev@googlegroups.com Subject: Patch 9.0.0590 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0590 Problem: After exiting Insert mode spelling is not checked in the next line. Solution: When spelling is enabled redraw the next line after exiting Insert mode in case the spell highlight needs updating. Files: src/edit.c, src/spell.c, src/proto/spell.pro, src/drawline.c, src/testdir/test_spell.vim, src/testdir/dumps/Test_spell_3.dump *** ../vim-9.0.0589/src/edit.c 2022-08-16 14:51:49.442515641 +0100 --- src/edit.c 2022-09-25 20:47:07.549684333 +0100 *************** *** 3587,3592 **** --- 3587,3599 ---- #ifdef FEAT_SPELL check_spell_redraw(); + + // When text has been changed in this line, possibly the start of the next + // line may have SpellCap that should be removed or it needs to be + // displayed. Schedule the next line for redrawing just in case. + if (spell_check_window(curwin) + && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) + redrawWinline(curwin, curwin->w_cursor.lnum + 1); #endif temp = curwin->w_cursor.col; *** ../vim-9.0.0589/src/spell.c 2022-08-14 14:16:07.999582175 +0100 --- src/spell.c 2022-09-25 20:48:29.489665830 +0100 *************** *** 1238,1255 **** } /* ! * Return TRUE if spell checking is not enabled. */ static int no_spell_checking(win_T *wp) { ! if (!wp->w_p_spell || *wp->w_s->b_p_spl == NUL ! || wp->w_s->b_langp.ga_len == 0) ! { ! emsg(_(e_spell_checking_is_not_possible)); ! return TRUE; ! } ! return FALSE; } /* --- 1238,1264 ---- } /* ! * Return TRUE if spell checking is enabled for "wp". ! */ ! int ! spell_check_window(win_T *wp) ! { ! return wp->w_p_spell ! && *wp->w_s->b_p_spl != NUL ! && wp->w_s->b_langp.ga_len > 0 ! && *(char **)(wp->w_s->b_langp.ga_data) != NULL; ! } ! ! /* ! * Return TRUE and give an error if spell checking is not enabled. */ static int no_spell_checking(win_T *wp) { ! if (spell_check_window(wp)) ! return FALSE; ! emsg(_(e_spell_checking_is_not_possible)); ! return TRUE; } /* *** ../vim-9.0.0589/src/proto/spell.pro 2022-06-27 23:15:23.000000000 +0100 --- src/proto/spell.pro 2022-09-25 20:46:36.365684178 +0100 *************** *** 5,10 **** --- 5,11 ---- int match_compoundrule(slang_T *slang, char_u *compflags); int valid_word_prefix(int totprefcnt, int arridx, int flags, char_u *word, slang_T *slang, int cond_req); int spell_valid_case(int wordflags, int treeflags); + int spell_check_window(win_T *wp); int spell_move_to(win_T *wp, int dir, int allwords, int curline, hlf_T *attrp); void spell_cat_line(char_u *buf, char_u *line, int maxlen); char_u *spell_enc(void); *** ../vim-9.0.0589/src/drawline.c 2022-09-21 16:38:08.873814058 +0100 --- src/drawline.c 2022-09-25 20:49:00.121652523 +0100 *************** *** 1125,1134 **** #endif #ifdef FEAT_SPELL ! if (wp->w_p_spell ! && *wp->w_s->b_p_spl != NUL ! && wp->w_s->b_langp.ga_len > 0 ! && *(char **)(wp->w_s->b_langp.ga_data) != NULL) { // Prepare for spell checking. has_spell = TRUE; --- 1125,1131 ---- #endif #ifdef FEAT_SPELL ! if (spell_check_window(wp)) { // Prepare for spell checking. has_spell = TRUE; *** ../vim-9.0.0589/src/testdir/test_spell.vim 2022-08-09 12:24:51.196531689 +0100 --- src/testdir/test_spell.vim 2022-09-25 20:56:03.485212787 +0100 *************** *** 983,988 **** --- 983,992 ---- let buf = RunVimInTerminal('-S XtestSpellCap', {'rows': 8}) call VerifyScreenDump(buf, 'Test_spell_2', {}) + " After adding word missing Cap in next line is updated + call term_sendkeys(buf, "3GANot\") + call VerifyScreenDump(buf, 'Test_spell_3', {}) + " clean up call StopVimInTerminal(buf) call delete('XtestSpellCap') *** ../vim-9.0.0589/src/testdir/dumps/Test_spell_3.dump 2022-09-25 20:57:35.077073407 +0100 --- src/testdir/dumps/Test_spell_3.dump 2022-09-25 20:56:20.261188136 +0100 *************** *** 0 **** --- 1,8 ---- + | +0&#ffffff0@2|T|h|i|s| |l|i|n|e| |h|a|s| |a| |s+0&#ffd7d7255|e|p|l@1| +0&#ffffff0|e|r@1|o|r|.| |a+0fd7ff255|n|d| +0&#ffffff0|m|i|s@1|i|n|g| |c|a|p|s| |a|n|d| |t|r|a|i|l|i|n|g| |s|p|a|c|e|s|.| @5 + |a+0fd7ff255|n|o|t|h|e|r| +0&#ffffff0|m|i|s@1|i|n|g| |c|a|p| |h|e|r|e|.| @49 + |N|o>t| @71 + |a|n|d| |h|e|r|e|.| @65 + @75 + |a+0fd7ff255|n|d| +0&#ffffff0|h|e|r|e|.| @65 + |~+0#4040ff13&| @73 + | +0#0000000&@56|3|,|3| @10|A|l@1| *** ../vim-9.0.0589/src/version.c 2022-09-25 20:12:17.852221938 +0100 --- src/version.c 2022-09-25 20:41:21.750385496 +0100 *************** *** 701,702 **** --- 701,704 ---- { /* Add new patch number below this line */ + /**/ + 590, /**/ -- If Microsoft would build a car... ... the oil, water temperature, and alternator warning lights would all be replaced by a single "General Protection Fault" warning light. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///