From b98d1cf68bd1d78d8170a8d994ba7dae5540962a Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Mon, 1 Jul 2019 13:42:46 +0200 Subject: cmdline: correct the column position of wildoptions=pum popupmenu - position might get invalid with "longest" match - position might be wrong when completed pattern ends in "/" --- test/functional/fixtures/compdir/file1 | 0 test/functional/fixtures/compdir/file2 | 0 test/functional/ui/popupmenu_spec.lua | 48 ++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 test/functional/fixtures/compdir/file1 create mode 100644 test/functional/fixtures/compdir/file2 (limited to 'test') diff --git a/test/functional/fixtures/compdir/file1 b/test/functional/fixtures/compdir/file1 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/functional/fixtures/compdir/file2 b/test/functional/fixtures/compdir/file2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index 466e078277..ffa803e7e1 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -6,6 +6,7 @@ local insert = helpers.insert local meths = helpers.meths local command = helpers.command local funcs = helpers.funcs +local get_pathsep = helpers.get_pathsep describe('ui/ext_popupmenu', function() local screen @@ -1503,6 +1504,53 @@ describe('builtin popupmenu', function() {3:lå}{n: långfile2 }{3: }| :b långfile1^ | ]]) + + -- position is calculated correctly with "longest" + feed('') + command('set wildmode=longest:full,full') + feed(':b lå') + screen:expect([[ + | + {1:~ }| + {4:långfile2 }| + | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }{n: långfile1 }{1: }| + {3:lå}{n: långfile2 }{3: }| + :b långfile^ | + ]]) + + -- special case: when patterns ends with "/", show menu items aligned + -- after the "/" + feed('') + command("close") + command('set wildmode=full') + command("cd test/functional/fixtures/") + feed(':e compdir/') + screen:expect([[ + | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }{s: file1 }{1: }| + {1:~ }{n: file2 }{1: }| + :e compdir]]..get_pathsep()..[[file1^ | + ]]) end) it("'pumblend' RGB-color", function() -- cgit