summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-09-27 16:29:38 +0100
committerBram Moolenaar <Bram@vim.org>2022-09-27 16:29:38 +0100
commit26f09ea54b2c60abf21df42c60bdfc60eca17b0d (patch)
tree4a6ac8239dfc73b25d28dd410211387f464da7f8 /src
parentf802767df7b4532651fcf11d49e812ead32db45b (diff)
patch 9.0.0608: with spelling, deleting a full stop does not update next linev9.0.0608
Problem: With spell checking, deleting a full stop at the end of a line does not update SpellCap at the start of the next line. Solution: Update the next line when characters have been deleted. Also when using undo.
Diffstat (limited to 'src')
-rw-r--r--src/change.c7
-rw-r--r--src/edit.c7
-rw-r--r--src/testdir/dumps/Test_spell_4.dump8
-rw-r--r--src/testdir/dumps/Test_spell_5.dump8
-rw-r--r--src/testdir/test_spell.vim8
-rw-r--r--src/undo.c9
-rw-r--r--src/version.c2
7 files changed, 42 insertions, 7 deletions
diff --git a/src/change.c b/src/change.c
index 038f3c199f..67b70230a1 100644
--- a/src/change.c
+++ b/src/change.c
@@ -709,6 +709,13 @@ changed_bytes(linenr_T lnum, colnr_T col)
changedOneline(curbuf, lnum);
changed_common(lnum, col, lnum + 1, 0L);
+#ifdef FEAT_SPELL
+ // When text has been changed at the end of the 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) && lnum < curbuf->b_ml.ml_line_count)
+ redrawWinline(curwin, lnum + 1);
+#endif
#ifdef FEAT_DIFF
// Diff highlighting in other diff windows may need to be updated too.
if (curwin->w_p_diff)
diff --git a/src/edit.c b/src/edit.c
index 2ac544a6be..4479964591 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -3607,13 +3607,6 @@ ins_esc(
#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;
diff --git a/src/testdir/dumps/Test_spell_4.dump b/src/testdir/dumps/Test_spell_4.dump
new file mode 100644
index 0000000000..c49dc84b46
--- /dev/null
+++ b/src/testdir/dumps/Test_spell_4.dump
@@ -0,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+0&#5fd7ff255|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+0&#5fd7ff255|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| @66
+|a|n|d| |h|e|r|e|.| @65
+|~+0#4040ff13&| @73
+|~| @73
+| +0#0000000&@56|4|,|8| @10|A|l@1|
diff --git a/src/testdir/dumps/Test_spell_5.dump b/src/testdir/dumps/Test_spell_5.dump
new file mode 100644
index 0000000000..a23ce5c4ef
--- /dev/null
+++ b/src/testdir/dumps/Test_spell_5.dump
@@ -0,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+0&#5fd7ff255|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+0&#5fd7ff255|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
+|a+0&#5fd7ff255|n|d| +0&#ffffff0|h|e|r|e|.| @65
+|~+0#4040ff13&| @73
+|~| @73
+| +0#0000000&@56|4|,|9| @10|A|l@1|
diff --git a/src/testdir/test_spell.vim b/src/testdir/test_spell.vim
index 90c6d53ced..3712b54067 100644
--- a/src/testdir/test_spell.vim
+++ b/src/testdir/test_spell.vim
@@ -987,6 +987,14 @@ func Test_spell_screendump_spellcap()
call term_sendkeys(buf, "3GANot\<Esc>")
call VerifyScreenDump(buf, 'Test_spell_3', {})
+ " Deleting a full stop removes missing Cap in next line
+ call term_sendkeys(buf, "5Gddk$x")
+ call VerifyScreenDump(buf, 'Test_spell_4', {})
+
+ " Undo also updates the next line (go to command line to remove message)
+ call term_sendkeys(buf, "u:\<Esc>")
+ call VerifyScreenDump(buf, 'Test_spell_5', {})
+
" clean up
call StopVimInTerminal(buf)
call delete('XtestSpellCap')
diff --git a/src/undo.c b/src/undo.c
index 3b354528ae..60172a7312 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -2835,7 +2835,16 @@ u_undoredo(int undo)
curbuf->b_op_end.lnum += newsize - oldsize;
}
if (oldsize > 0 || newsize > 0)
+ {
changed_lines(top + 1, 0, bot, newsize - oldsize);
+#ifdef FEAT_SPELL
+ // When text has been changed, 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) && bot <= curbuf->b_ml.ml_line_count)
+ redrawWinline(curwin, bot);
+#endif
+ }
// Set the '[ mark.
if (top + 1 < curbuf->b_op_start.lnum)
diff --git a/src/version.c b/src/version.c
index 8e438af3c8..ea6f9d3920 100644
--- a/src/version.c
+++ b/src/version.c
@@ -700,6 +700,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 608,
+/**/
607,
/**/
606,