Skip to content

fix(popups): dont add spacing when the title is empty #1488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading