-
-
Notifications
You must be signed in to change notification settings - Fork 629
fix(#2746): background and right aligned icons in floating windows #3128
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
alex-courtis
merged 5 commits into
master
from
2746-float-window-for-full-filenames-has-wrong-bg
May 24, 2025
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e7a7ad7
fix(#2746): fix cursorcolumn and right aligned icons in floating windows
simonmandlik 29c88bb
feat: remove right aligned icons from full name float, show float ove…
simonmandlik 6656d82
refactoring: move `extmarks_length` to utils.lua
simonmandlik 56ba24b
fix: decrease `win_width` instead of increasing `text_width` when com…
simonmandlik 1872b04
Merge branch 'master' into 2746-float-window-for-full-filenames-has-w…
alex-courtis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -302,6 +302,21 @@ function M.open(options) | |
log.profile_end(profile) | ||
end | ||
|
||
---@param extmarks table | ||
---@return number | ||
function M.extmarks_length(extmarks) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for abstracting this. Small request: move this to |
||
local length = 0 | ||
for _, extmark in ipairs(extmarks) do | ||
local details = extmark[4] | ||
if details and details.virt_text then | ||
for _, text in ipairs(details.virt_text) do | ||
length = length + vim.fn.strchars(text[1]) | ||
end | ||
end | ||
end | ||
return length | ||
end | ||
|
||
local function grow() | ||
local starts_at = M.is_root_folder_visible(require("nvim-tree.core").get_cwd()) and 1 or 0 | ||
local lines = vim.api.nvim_buf_get_lines(M.get_bufnr(), starts_at, -1, false) | ||
|
@@ -329,14 +344,7 @@ local function grow() | |
local count = vim.fn.strchars(l) | ||
-- also add space for right-aligned icons | ||
local extmarks = vim.api.nvim_buf_get_extmarks(M.get_bufnr(), ns_id, { line_nr, 0 }, { line_nr, -1 }, { details = true }) | ||
for _, extmark in ipairs(extmarks) do | ||
local virt_texts = extmark[4].virt_text | ||
if virt_texts then | ||
for _, virt_text in ipairs(virt_texts) do | ||
count = count + vim.fn.strchars(virt_text[1]) | ||
end | ||
end | ||
end | ||
count = count + M.extmarks_length(extmarks) | ||
if resizing_width < count then | ||
resizing_width = count | ||
end | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.