mirror of
https://github.com/neovim/neovim.git
synced 2026-06-06 20:14:19 +00:00
fix(float): tail truncate long title #28387
Problem: We truncate the title from start, this is somewhat inconsistent with the way vim works. Usually we use < to truncate and keep more trailing characters. Solution: Keep more trailing characters.
This commit is contained in:
@@ -2047,10 +2047,10 @@ describe('float window', function()
|
||||
eq('center', footer_pos)
|
||||
end)
|
||||
|
||||
it('center aligned title longer than window width #25746', function()
|
||||
it('truncates title longer than window width #25746 #23602', function()
|
||||
local buf = api.nvim_create_buf(false, false)
|
||||
api.nvim_buf_set_lines(buf, 0, -1, true, { ' halloj! ', ' BORDAA ' })
|
||||
local win = api.nvim_open_win(buf, false, {
|
||||
local config = {
|
||||
relative = 'editor',
|
||||
width = 9,
|
||||
height = 2,
|
||||
@@ -2059,8 +2059,8 @@ describe('float window', function()
|
||||
border = 'double',
|
||||
title = 'abcdefghijklmnopqrstuvwxyz',
|
||||
title_pos = 'center',
|
||||
})
|
||||
|
||||
}
|
||||
local win = api.nvim_open_win(buf, false, config)
|
||||
if multigrid then
|
||||
screen:expect {
|
||||
grid = [[
|
||||
@@ -2073,7 +2073,7 @@ describe('float window', function()
|
||||
## grid 3
|
||||
|
|
||||
## grid 4
|
||||
{5:╔}{11:abcdefghi}{5:╗}|
|
||||
{5:╔}{11:<stuvwxyz}{5:╗}|
|
||||
{5:║}{1: halloj! }{5:║}|
|
||||
{5:║}{1: BORDAA }{5:║}|
|
||||
{5:╚═════════╝}|
|
||||
@@ -2089,7 +2089,7 @@ describe('float window', function()
|
||||
grid = [[
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }{5:╔}{11:abcdefghi}{5:╗}{0: }|
|
||||
{0:~ }{5:╔}{11:<stuvwxyz}{5:╗}{0: }|
|
||||
{0:~ }{5:║}{1: halloj! }{5:║}{0: }|
|
||||
{0:~ }{5:║}{1: BORDAA }{5:║}{0: }|
|
||||
{0:~ }{5:╚═════════╝}{0: }|
|
||||
@@ -2097,7 +2097,9 @@ describe('float window', function()
|
||||
]],
|
||||
}
|
||||
end
|
||||
|
||||
config.title = { { 'abcd' }, { 'stuvw' }, { 'xyz' } }
|
||||
api.nvim_win_set_config(win, config)
|
||||
screen:expect_unchanged()
|
||||
api.nvim_win_close(win, false)
|
||||
assert_alive()
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user