aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2018-05-04 19:42:58 -0400
committerGitHub <noreply@github.com>2018-05-04 19:42:58 -0400
commit500931752565e0b535f4ce6013729df3febf1a56 (patch)
treeaeedacc6b0871876239f5c052f8daa8a233aaf97
parent0a349fd77de5cbf7516f6bc4f0117213b4f52b8b (diff)
parentec1a7791b00f98460c60e7ae4eec383dce741de8 (diff)
downloadrneovim-500931752565e0b535f4ce6013729df3febf1a56.tar.gz
rneovim-500931752565e0b535f4ce6013729df3febf1a56.tar.bz2
rneovim-500931752565e0b535f4ce6013729df3febf1a56.zip
Merge pull request #8358 from mhinz/screen
[RFC] screen: avoid artifacts
-rw-r--r--src/nvim/screen.c4
-rw-r--r--test/functional/ui/screen_basic_spec.lua39
2 files changed, 42 insertions, 1 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index b615f69cd3..f034ac33f1 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -5310,7 +5310,9 @@ void screen_getbytes(int row, int col, char_u *bytes, int *attrp)
bytes[0] = ScreenLines[off];
bytes[1] = NUL;
- bytes[utfc_char2bytes(off, bytes)] = NUL;
+ if (ScreenLinesUC[off] != 0) {
+ bytes[utfc_char2bytes(off, bytes)] = NUL;
+ }
}
}
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua
index 837934e529..06e4a19354 100644
--- a/test/functional/ui/screen_basic_spec.lua
+++ b/test/functional/ui/screen_basic_spec.lua
@@ -701,4 +701,43 @@ describe('Screen', function()
]])
end)
end)
+
+ -- Regression test for #8357
+ it('does not have artifacts after temporary chars in insert mode', function()
+ command('inoremap jk <esc>')
+ feed('ifooj')
+ screen:expect([[
+ foo^j |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:-- INSERT --} |
+ ]])
+ feed('k')
+ screen:expect([[
+ fo^o |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end)
end)