mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 13:15:09 -07:00
vim-patch:9.0.0608: with spelling, deleting a full stop does not update next line
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.
26f09ea54b
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
ad7cded1f3
commit
d2dc7cfa5b
@ -43,6 +43,7 @@
|
||||
#include "nvim/plines.h"
|
||||
#include "nvim/pos.h"
|
||||
#include "nvim/search.h"
|
||||
#include "nvim/spell.h"
|
||||
#include "nvim/state.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/textformat.h"
|
||||
@ -393,6 +394,12 @@ void changed_bytes(linenr_T lnum, colnr_T col)
|
||||
{
|
||||
changedOneline(curbuf, lnum);
|
||||
changed_common(lnum, col, lnum + 1, 0);
|
||||
// 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);
|
||||
}
|
||||
// notify any channels that are watching
|
||||
buf_updates_send_changes(curbuf, lnum, 1, 1);
|
||||
|
||||
|
@ -3395,14 +3395,6 @@ static bool ins_esc(long *count, int cmdchar, bool nomove)
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
int temp = curwin->w_cursor.col;
|
||||
if (disabled_redraw) {
|
||||
RedrawingDisabled--;
|
||||
|
@ -120,6 +120,7 @@
|
||||
#include "nvim/path.h"
|
||||
#include "nvim/pos.h"
|
||||
#include "nvim/sha256.h"
|
||||
#include "nvim/spell.h"
|
||||
#include "nvim/state.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/types.h"
|
||||
@ -2372,6 +2373,12 @@ static void u_undoredo(int undo, bool do_buf_event)
|
||||
}
|
||||
|
||||
changed_lines(top + 1, 0, bot, newsize - oldsize, do_buf_event);
|
||||
// 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);
|
||||
}
|
||||
|
||||
// Set the '[ mark.
|
||||
if (top + 1 < curbuf->b_op_start.lnum) {
|
||||
|
@ -115,6 +115,30 @@ describe("'spell'", function()
|
||||
{0:~ }|
|
||||
|
|
||||
]])
|
||||
-- Deleting a full stop removes missing Cap in next line
|
||||
feed('5Gddk$x')
|
||||
screen:expect([[
|
||||
This line has a {1:sepll} error. {2:and} missing caps and trailing spaces. |
|
||||
{2:another} missing cap here. |
|
||||
Not |
|
||||
and her^e |
|
||||
and here. |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
|
|
||||
]])
|
||||
-- Undo also updates the next line (go to command line to remove message)
|
||||
feed('u:<Esc>')
|
||||
screen:expect([[
|
||||
This line has a {1:sepll} error. {2:and} missing caps and trailing spaces. |
|
||||
{2:another} missing cap here. |
|
||||
Not |
|
||||
and here^. |
|
||||
{2:and} here. |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
it('extmarks, "noplainbuffer" and syntax #20385 #23398', function()
|
||||
|
@ -1018,6 +1018,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')
|
||||
|
Loading…
Reference in New Issue
Block a user