Skip to content
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

Allow preserving the full filename when truncating the result lines for grep provider #537

Closed
hasufell opened this issue Oct 11, 2020 · 10 comments · Fixed by #937
Closed

Comments

@hasufell
Copy link

Screenshot_2020-10-11_17-08-33

I can't read most of the file names. I think these should always be visible (not the whole path, but the filename).

@issue-label-bot issue-label-bot bot added the bug Something isn't working label Oct 11, 2020
@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.92. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@liuchengxu
Copy link
Owner

When you move the cursor to the line, the whole filepath will be displayed in the preview window below.

@liuchengxu liuchengxu removed the bug Something isn't working label Oct 11, 2020
@hasufell
Copy link
Author

I'm aware, but that doesn't solve my issue. It's about having an overview of the results per file, so i instantly see where the results are without moving through the entire list.

@liuchengxu
Copy link
Owner

You have to understand that the window size is always limited and can't display the whole line, therefore it has to be truncated for displaying the part containing the matched items.

@hasufell
Copy link
Author

Yes and it could make sure to preserve the filename during truncation.

@liuchengxu
Copy link
Owner

Hmm, I'm not interested unless someone sends a PR.

@liuchengxu liuchengxu changed the title File names aren't always visible Allow preserving the full filename when truncating the result lines Oct 12, 2020
@liuchengxu liuchengxu reopened this Oct 12, 2020
@liuchengxu liuchengxu changed the title Allow preserving the full filename when truncating the result lines Allow preserving the full filename when truncating the result lines for grep2 provider Oct 12, 2020
@hasufell
Copy link
Author

Hmm, I'm not interested unless someone sends a PR.

I might have a look at it when I have time this week. Can you give me pointers to the code where the truncation happens?

@liuchengxu
Copy link
Owner

The truncation processing is in printer crate,

pub fn truncate_long_matched_lines<T>(

Currently it's not flexible to support various truncation style, for the result lines can have distinct formats, but at least you can fork it to meet your own need :)

@liuchengxu
Copy link
Owner

I realize this is a nice-to-have feature, we should support it. The printer crate might need to be refactored first.

@liuchengxu liuchengxu pinned this issue Apr 7, 2021
@liuchengxu liuchengxu changed the title Allow preserving the full filename when truncating the result lines for grep2 provider Allow preserving the full filename when truncating the result lines for grep provider Jan 26, 2023
@liuchengxu
Copy link
Owner

@hasufell Can you try this branch https://github.com/liuchengxu/vim-clap/tree/preserve-file-name? :Clap grep should always show the file name.

截屏2023-02-25 14 49 02

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants