1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00
Commit Graph

38 Commits

Author SHA1 Message Date
c64a7904b7 Add ability to configure branch color patterns 2025-01-12 13:44:26 +01:00
3e623cd1ce Remove the automatic coloring of certain branch names
We used to automatically color branches starting with "feature/", "bugfix/", or
"hotfix/". For those who don't want this, it's a bit non-obvious to turn off,
but it's actually pretty easy to configure manually for those who want this, so
we just remove this default coloring.
2025-01-11 22:13:33 +01:00
26132cf5bd Use utils.StringWidth to optimize rendering performance
runewidth.StringWidth is an expensive call, even if the input string is pure
ASCII. Improve this by providing a wrapper that short-circuits the call to len
if the input is ASCII.

Benchmark results show that for non-ASCII strings it makes no noticable
difference, but for ASCII strings it provides a more than 200x speedup.

BenchmarkStringWidthAsciiOriginal-10            718135       1637 ns/op
BenchmarkStringWidthAsciiOptimized-10        159197538          7.545 ns/op
BenchmarkStringWidthNonAsciiOriginal-10         486290       2391 ns/op
BenchmarkStringWidthNonAsciiOptimized-10        502286       2383 ns/op
2024-06-23 13:10:48 +02:00
d406ec06af Fix truncation of long branch names containing non-ASCII characters 2024-06-23 12:25:28 +02:00
373b1970ca Show divergence from base branch in branches list 2024-06-03 13:59:43 +02:00
5b613f5bc7 Remove ColoredBranchStatus and branchStatusColor
Previously the entire status was colored in a single color, so the API made
sense. This is going to change in the next commit, so now we must include the
color in the string returned from BranchStatus(), which means that callers who
need to do hit detection or measure the length need to decolorize it.

While we're at it, switch the order of ↑3↓7 to ↓7↑3. For some reason that I
can't really explain I find it more logical this way. The software out there is
pretty undecided about it, it seems: VS Code puts ↓7 first, and so does the
shell prompt that comes with git; git status and git branch -v put "ahead" first
though. Shrug.
2024-06-03 13:02:46 +02:00
0aba686f97 Rename Pushables/Pullables to AheadForPull/BehindForPull
In preparation for adding AheadForPush/BehindForPush in the next commit.
2024-05-19 09:44:38 +02:00
05fb12b1d5 rename sha to hash 6, update short hash 2024-04-12 08:33:47 +02:00
f933a2f7ec Replace min/max helpers with built-in min/max
We upgraded our minimum Go version to 1.21 in commit
57ac9c2189. We can now replace our
`utils.Min` and `utils.Max` functions with the built-in `min` and `max`.

Reference: https://go.dev/ref/spec#Min_and_max
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2024-04-07 23:24:10 +08:00
f3dba743f0 Add SpinnerConfig
This new config section allows to customize frames and rate of
thespinner
2024-04-06 13:46:15 +02:00
36e57d16bd Don't try to shorten branch names that are already 3 characters or less
This fixes a potential crash when the available width is very small and the
branch name is one to three characters long.
2024-01-15 13:27:49 +01:00
0fd4983c66 Fall back to WithWaitingStatus if view showing the item is not visible 2023-12-10 15:57:51 +01:00
c550737a4f Truncate long branch names to make branch status visible 2023-10-16 13:15:05 +02:00
23befdd13a Pass "now" into utils.Loader
This makes it possible to write deterministic tests for views that use it.
2023-10-16 09:03:07 +02:00
707fa37160 Add inline status for pushing/pulling/fast-forwarding branches
When pulling/pushing/fast-forwarding a branch, show this state in the branches
list for that branch for as long as the operation takes, to make it easier to
see when it's done (without having to stare at the status bar in the lower
left).

This will hopefully help with making these operations feel more predictable, now
that we no longer show a loader panel for them.
2023-10-08 18:45:36 +02:00
0c07963a2e Store full sha in branch model
The model will be used for logic, so the full hash is needed there; a shortened
hash of 8 characters might be too short to be unique in very large repos. If
some view wants to display a shortened hash, it should truncate it at
presentation time.
2023-07-31 08:34:01 +02:00
e33fe37a99 Standardise on using lo for slice functions
We've been sometimes using lo and sometimes using my slices package, and we need to pick one
for consistency. Lo is more extensive and better maintained so we're going with that.

My slices package was a superset of go's own slices package so in some places I've just used
the official one (the methods were just wrappers anyway).

I've also moved the remaining methods into the utils package.
2023-07-30 18:51:23 +10:00
ec839e9e96 Associate branches with worktrees even when mid-rebase 2023-07-30 18:35:22 +10:00
2082fdf84a i18n for worktrees 2023-07-30 18:35:22 +10:00
e8ec41fb0f Refactor 2023-07-30 18:35:22 +10:00
a4db44bc3d show commits against branches 2023-06-01 19:21:24 +10:00
ec3a28df43 Right-align key labels in menu
I find this makes it look a little nicer
2023-05-21 12:09:43 +10:00
11d0e7e17d feat(gui): show branch icons 2022-04-23 12:25:41 +09:00
dfb293c985 better upstream changes presentation 2022-04-18 11:03:28 +10:00
1b75ed3740 many more generics 2022-03-24 20:14:41 +11:00
dde30fa104 add gone branches status 2022-03-24 17:50:25 +11:00
9adf4a1908 Add shared function for loading map of custom colors 2022-02-01 18:55:45 +11:00
4df7646654 Add configurable colors for branch prefixes
Branches can now be colored based on their prefix, if it matches
a user defined prefix in the config file. If no user defined
prefix matches, then it will fallback to the defaults: green for
'feature', yellow for 'bugfix', and red for 'hotfix'. All
remaining branches will be set to the default text color.
2022-02-01 18:55:45 +11:00
1c84f77319 always specify upstream when pushing/pulling 2022-01-15 15:34:01 +11:00
d626bcac00 color fixups 2021-08-01 16:14:56 +10:00
79848087bc Switch to github.com/gookit/color for terminal colors 2021-07-30 15:14:46 +02:00
9fdf92b226 more refactoring
WIP

WIP
2021-06-06 09:12:49 +10:00
ce6f8ed1bc move models folder into commands folder 2020-09-29 20:48:49 +10:00
44248d9ab0 pull branch model out into models package 2020-09-29 20:48:49 +10:00
40fbce91ce add new diff mode
WIP

WIP

WIP

WIP

WIP

WIP

WIP
2020-03-29 18:26:24 +11:00
d027cf969c better handling of current branch name 2020-03-26 20:37:06 +11:00
1be0ff8da7 better upstream tracking and allow renaming a branch 2020-03-18 21:29:06 +11:00
f94d0be2c9 refactor the way we render lists 2020-02-25 21:21:07 +11:00