Skip to content

Commit

Permalink
fix(popups): dont add spacing when the title is empty (#1488)
Browse files Browse the repository at this point in the history
  • Loading branch information
sand4rt committed May 31, 2024
1 parent 29f7c21 commit 974bbd4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lua/neo-tree/ui/popups.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ local log = require("neo-tree.log")
local M = {}

M.popup_options = function(title, min_width, override_options)
if string.len(title) ~= 0 then
title = " " .. title .. " "
end
min_width = min_width or 30
local width = string.len(title) + 2

local nt = require("neo-tree")
local popup_border_style = nt.config.popup_border_style
local popup_border_text = NuiText(" " .. title .. " ", highlights.FLOAT_TITLE)
local popup_border_text = NuiText(title, highlights.FLOAT_TITLE)
local col = 0
-- fix popup position when using multigrid
local popup_last_col = vim.api.nvim_win_get_position(0)[2] + width + 2
Expand Down Expand Up @@ -49,7 +52,7 @@ M.popup_options = function(title, min_width, override_options)

if popup_border_style == "NC" then
local blank = NuiText(" ", highlights.TITLE_BAR)
popup_border_text = NuiText(" " .. title .. " ", highlights.TITLE_BAR)
popup_border_text = NuiText(title, highlights.TITLE_BAR)
popup_options.border = {
style = { "", blank, "", "", " ", "", " ", "" },
highlight = highlights.FLOAT_BORDER,
Expand Down

0 comments on commit 974bbd4

Please sign in to comment.