mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 17:36:29 +00:00
Merge pull request #12698 from erw7/fix-popupmenu-with-rl
ui: fix problem with the popupmenu when rightleft is set
This commit is contained in:
@@ -312,6 +312,9 @@ ScreenGrid *ui_comp_mouse_focus(int row, int col)
|
|||||||
static void compose_line(Integer row, Integer startcol, Integer endcol,
|
static void compose_line(Integer row, Integer startcol, Integer endcol,
|
||||||
LineFlags flags)
|
LineFlags flags)
|
||||||
{
|
{
|
||||||
|
// If rightleft is set, startcol may be -1. In such cases, the assertions
|
||||||
|
// will fail because no overlap is found. Adjust startcol to prevent it.
|
||||||
|
startcol = MAX(startcol, 0);
|
||||||
// in case we start on the right half of a double-width char, we need to
|
// in case we start on the right half of a double-width char, we need to
|
||||||
// check the left half. But skip it in output if it wasn't doublewidth.
|
// check the left half. But skip it in output if it wasn't doublewidth.
|
||||||
int skipstart = 0, skipend = 0;
|
int skipstart = 0, skipend = 0;
|
||||||
|
@@ -9,6 +9,7 @@ local funcs = helpers.funcs
|
|||||||
local get_pathsep = helpers.get_pathsep
|
local get_pathsep = helpers.get_pathsep
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local pcall_err = helpers.pcall_err
|
local pcall_err = helpers.pcall_err
|
||||||
|
local eval = helpers.eval
|
||||||
|
|
||||||
describe('ui/ext_popupmenu', function()
|
describe('ui/ext_popupmenu', function()
|
||||||
local screen
|
local screen
|
||||||
@@ -2196,4 +2197,20 @@ describe('builtin popupmenu', function()
|
|||||||
{2:-- INSERT --} |
|
{2:-- INSERT --} |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('does not crash when displayed in the last column with rightleft (#12032)', function()
|
||||||
|
local col = 30
|
||||||
|
local items = {'word', 'choice', 'text', 'thing'}
|
||||||
|
local max_len = 0
|
||||||
|
for _, v in ipairs(items) do
|
||||||
|
max_len = max_len < #v and #v or max_len
|
||||||
|
end
|
||||||
|
screen:try_resize(col, 8)
|
||||||
|
command('set rightleft')
|
||||||
|
command('call setline(1, repeat(" ", &columns - '..max_len..'))')
|
||||||
|
feed('$i')
|
||||||
|
funcs.complete(col - max_len, items)
|
||||||
|
feed('<c-y>')
|
||||||
|
eq(2, eval('1+1'))
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
Reference in New Issue
Block a user