aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/screen.c9
-rw-r--r--test/functional/terminal/buffer_spec.lua17
2 files changed, 23 insertions, 3 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index e9be7eed38..1d29ae064e 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -4021,10 +4021,13 @@ win_line (
if (wp->w_buffer->terminal) {
// terminal buffers may need to highlight beyond the end of the
// logical line
- while (col < grid->Columns) {
+ int n = wp->w_p_rl ? -1 : 1;
+ while (col >= 0 && col < grid->Columns) {
schar_from_ascii(linebuf_char[off], ' ');
- linebuf_attr[off++] = term_attrs[vcol++];
- col++;
+ linebuf_attr[off] = term_attrs[vcol];
+ off += n;
+ vcol += n;
+ col += n;
}
}
grid_put_linebuf(grid, row, 0, col, grid->Columns, wp->w_p_rl, wp,
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua
index 7560b0e872..2fc7a021cb 100644
--- a/test/functional/terminal/buffer_spec.lua
+++ b/test/functional/terminal/buffer_spec.lua
@@ -5,6 +5,7 @@ local wait = helpers.wait
local eval, feed_command, source = helpers.eval, helpers.feed_command, helpers.source
local eq, neq = helpers.eq, helpers.neq
local write_file = helpers.write_file
+local command= helpers.command
describe(':terminal buffer', function()
local screen
@@ -224,6 +225,22 @@ describe(':terminal buffer', function()
neq('terminal', eval('&buftype'))
end)
end)
+
+ it('it works with set rightleft #11438', function()
+ local columns = eval('&columns')
+ feed(string.rep('a', columns))
+ command('set rightleft')
+ screen:expect([[
+ ydaer ytt|
+ {1:a}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ |
+ |
+ |
+ |
+ {3:-- TERMINAL --} |
+ ]])
+ command('bdelete!')
+ end)
end)
describe('No heap-buffer-overflow when using', function()