Skip to content

Commit 6d54c19

Browse files
authored
fix: allow border title position change/retaining (#300)
1 parent a672e11 commit 6d54c19

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lua/plenary/window/border.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,18 @@ local set_title_highlights = function(bufnr, ranges, hl)
173173
end
174174
end
175175

176-
function Border:change_title(new_title)
176+
function Border:change_title(new_title, pos)
177177
if self._border_win_options.title == new_title then
178178
return
179179
end
180180

181-
self._border_win_options.title = new_title
181+
pos = pos or (self._border_win_options.title[1] and self._border_win_options.title[1].pos)
182+
if pos == nil then
183+
self._border_win_options.title = new_title
184+
else
185+
self._border_win_options.title = { { text = new_title, pos = pos } }
186+
end
187+
182188
self.contents, self.title_ranges = Border._create_lines(
183189
self.content_win_id,
184190
self.content_win_options,

0 commit comments

Comments
 (0)