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

Fix highlight of commit hash in git branches preview #2921

Merged
merged 2 commits into from
Feb 17, 2024
Merged

Fix highlight of commit hash in git branches preview #2921

merged 2 commits into from
Feb 17, 2024

Conversation

petobens
Copy link
Contributor

Description

In repos with many commits, git log flag --abbrev-commit will increase the number of characters from 7 to 8 to ensure unicity. The git branches preview highlight is therefore off by one in this case.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Before and after:
image
image

Configuration:

  • Neovim version (nvim --version): NVIM v0.10.0-dev-2361+ga376d979bd
  • Operating system and version: Arch Linux

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (lua annotations)

@jamestrew
Copy link
Contributor

Thanks, you're right but by extension, the bigger the repo, the larger the commit hash abbreviations will get.
image

Are you able to come up with a more dynamic approach?

@petobens
Copy link
Contributor Author

Hi @jamestrew. I added a new regex to dynamically obtain the end char. Hope it helps

@petobens petobens changed the title Increase git branch log preview commit highlight to 8 characters Fix highlight of commit hash in git branches preview Feb 15, 2024
Copy link
Contributor

@jamestrew jamestrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@jamestrew jamestrew merged commit b744cf5 into nvim-telescope:master Feb 17, 2024
6 checks passed
Conni2461 pushed a commit that referenced this pull request Mar 11, 2024
* Fix highlight of commit hash in git branches preview

* Update lua/telescope/previewers/buffer_previewer.lua

Co-authored-by: James Trew <[email protected]>

---------

Co-authored-by: James Trew <[email protected]>
(cherry picked from commit b744cf5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants