Commit graph

211 commits

Author SHA1 Message Date
Jesse Duffield 14ecc15e71 Use first class task objects instead of global counter
The global counter approach is easy to understand but it's brittle and depends on implicit behaviour that is not very discoverable.

With a global counter, if any goroutine accidentally decrements the counter twice, we'll think lazygit is idle when it's actually busy.
Likewise if a goroutine accidentally increments the counter twice we'll think lazygit is busy when it's actually idle.
With the new approach we have a map of tasks where each task can either be busy or not. We create a new task and add it to the map
when we spawn a worker goroutine (among other things) and we remove it once the task is done.

The task can also be paused and continued for situations where we switch back and forth between running a program and asking for user
input.

In order for this to work with `git push` (and other commands that require credentials) we need to obtain the task from gocui when
we create the worker goroutine, and then pass it along to the commands package to pause/continue the task as required. This is
MUCH more discoverable than the old approach which just decremented and incremented the global counter from within the commands package,
but it's at the cost of expanding some function signatures (arguably a good thing).

Likewise, whenever you want to call WithWaitingStatus or WithLoaderPanel the callback will now have access to the task for pausing/
continuing. We only need to actually make use of this functionality in a couple of places so it's a high price to pay, but I don't
know if I want to introduce a WithWaitingStatusTask and WithLoaderPanelTask function (open to suggestions).
2023-07-09 21:30:19 +10:00
Jesse Duffield 631cf1e873 Bump gocui
This includes new gocui logic for tracking busy/idle program state
2023-07-08 22:26:28 +10:00
Jesse Duffield 4df353d006 Bump gocui 2023-07-02 15:47:04 +10:00
Jesse Duffield 4ff02bd3b7 Add integration test for commit highlighting on focus
A better refactor would be to allow matchers to assert against either a string or a slice of cells, so that I could have
the same ergonomics that I have elsewhere, but this is a start.
2023-06-01 22:20:30 +10:00
Jesse Duffield cc0edd42bb
Merge pull request #2508 from Ryooooooga/remove-jesseduffield-yaml 2023-05-30 17:39:25 +10:00
Jesse Duffield 8121a0cc74 remove old integration test recording code 2023-03-24 18:42:11 +11:00
Jesse Duffield c28e25524a bump gocui to fix race condition 2023-03-19 16:30:39 +11:00
Jesse Duffield b542579db3
Better escape code parsing (thanks to Ryooooooga) (#2514) 2023-03-19 15:41:47 +11:00
Ryooooooga 33f332e28d
build: remove github.com/jesseduffield/yaml package 2023-03-17 23:19:11 +09:00
Jesse Duffield db011d8e34 Improve staging panel integration tests 2023-02-25 11:35:41 +11:00
Jesse Duffield a51f64814c show snapshot of lazygit when test fails for easier investigation 2023-02-19 15:48:09 +11:00
Jesse Duffield 01bf7f21e6 bump gocui 2023-02-18 10:28:09 +11:00
Jesse Duffield c517d1e0a2 update view cursor when selecting new line in patch explorer view 2023-02-18 10:19:34 +11:00
Ryooooooga 657b1e897f
build: bump gocui 2023-01-06 10:59:09 +09:00
Jesse Duffield abbd598992 bump gocui 2022-12-20 22:06:44 +11:00
Ryooooooga cf048e4807
bump gocui 2022-11-25 21:48:44 +09:00
Lukasz Piatkowski 4fa8586191 Update go-git to handle negative refspecs 2022-11-12 07:24:14 +01:00
Ryooooooga 4aa9147dfa
build: $ ./scripts/bump_gocui.sh 2022-10-18 22:20:04 +09:00
Gustavo Andrioli 39e84e13f4 Use lazycore utils: Clamp and GetLazyRootDirectory 2022-10-15 13:55:44 -03:00
Jesse Duffield 575afa1377 update vendor directory 2022-10-11 08:12:56 -07:00
Jesse Duffield dba0edb998 use boxlayout from lazycore 2022-10-09 08:31:14 -07:00
Jesse Duffield e3f21f0588 strip NUL bytes instead of replacing with space 2022-10-03 09:29:41 -07:00
Jesse Duffield e76fa5a6cb fix glitchy render of stale data when flicking through files and directories 2022-10-02 20:41:24 -07:00
Jesse Duffield 5670c0a301 bump gocui 2022-10-02 18:43:25 -07:00
Ryooooooga 1c82924307
build: $ ./scripts/bump_gocui.sh 2022-09-23 20:01:44 +09:00
Jesse Duffield 7af7af27c6 various changes to improve integration tests 2022-09-16 08:42:39 -07:00
Jesse Duffield 5173d7f5e1 better CLI interface 2022-08-14 17:20:52 +10:00
Jesse Duffield 225c563c63 another integration test 2022-08-11 21:24:16 +10:00
Jesse Duffield 77881a9c7d add new integration test pattern 2022-08-11 21:24:15 +10:00
Jesse Duffield 524bf83a4a refactor to only have one context per view 2022-08-06 13:49:11 +10:00
Luka Markušić 83dfc3b28b Update gocui 2022-07-29 06:59:52 +02:00
Jesse Duffield c9d891a913 better process killing 2022-06-18 13:39:22 +10:00
Jesse Duffield 3477cbc81f better weight distribution in window arrangement 2022-04-17 12:48:04 +10:00
Jesse Duffield e68093fe99 add scrollbars 2022-04-16 17:29:17 +10:00
Jesse Duffield 00afa30ebf better appearance for reverse attribute 2022-04-16 15:19:32 +10:00
Jesse Duffield 6a153acc8f clearer highlighting of current line 2022-04-16 15:19:32 +10:00
Jesse Duffield 336f2772e8 bump gocui 2022-04-08 12:15:23 +10:00
Jesse Duffield 43d3f2bcb6 refactor todo file generation 2022-03-24 20:14:41 +11:00
Jesse Duffield cb26c7a1f2 more things 2022-03-24 20:14:41 +11:00
Jesse Duffield 94a53484a1 would you believe that I'm adding even more generics 2022-03-24 20:14:41 +11:00
Jesse Duffield 1b75ed3740 many more generics 2022-03-24 20:14:41 +11:00
Jesse Duffield bf4f06ab4e more generics 2022-03-24 20:14:41 +11:00
Jesse Duffield eda8f4a5d4 lots more generics 2022-03-24 20:14:41 +11:00
Jesse Duffield c7a629c440 make more use of generics 2022-03-24 20:14:41 +11:00
Jesse Duffield 4fde97b066 update go to v1.18 2022-03-18 21:36:28 +11:00
Jesse Duffield 59d4df2a44 fix click handling 2022-03-17 19:13:40 +11:00
Jesse Duffield 145c69d9ae working again 2022-03-17 19:13:40 +11:00
Jesse Duffield 482bdc4f1e more refactoring 2022-03-17 19:13:40 +11:00
Jesse Duffield 2a1e3faa0c resetting controllers on new repo 2022-03-17 19:13:40 +11:00
Jesse Duffield 4a1d23dc27 bump gocui 2022-01-08 16:05:11 +11:00
Pieter van Loon 7539929703 use bright colors for highlighting 2022-01-08 16:05:11 +11:00
Jesse Duffield 06ca71e955 fix bug 2021-11-05 07:58:21 +11:00
Jesse Duffield 37be9dbea1 support scrolling left and right 2021-11-05 07:58:21 +11:00
Jesse Duffield 802cfb1a04 render commit graph 2021-11-05 07:58:21 +11:00
Jesse Duffield 2fc1498517 some refactoring in anticipation of the graph feature 2021-11-01 10:03:49 +11:00
Jesse Duffield f704707d29 stream output from certain git commands in command log panel 2021-10-30 18:26:06 +11:00
Jesse Duffield ca7252ef8e suggest files when picking a path to filter on
async fetching of suggestions

remove limit

cache the trie for future use

more

more
2021-10-19 09:02:42 +11:00
Jesse Duffield 71fdc5c038 better title rendering 2021-10-18 09:21:33 +11:00
Jesse Duffield a05f22efa2 support home/end keys in editors 2021-10-17 20:14:31 +11:00
Jesse Duffield e7c27b6f4a small fixes 2021-10-17 06:41:21 +00:00
Jesse Duffield 345c90ac05 fix editor 2021-10-17 04:17:59 +00:00
Jesse Duffield ab0117c416 fix some encodings 2021-09-27 19:58:24 +10:00
Jesse Duffield 3dd88d6138 bump dependencies 2021-06-15 08:12:38 +10:00
Jesse Duffield b28b2d05bd force cursor to be at end of line when opening confirmation panel 2021-04-17 21:15:54 +10:00
Jesse Duffield 730a03a3b2 fix race condition 2021-04-12 23:40:20 +10:00
Jesse Duffield 76697280c9 fix rendering issues caused by resizing 2021-04-12 21:48:08 +10:00
Jesse Duffield 0df6ac6140 bump gocui to fix resizing issue 2021-04-12 21:48:08 +10:00
Jesse Duffield e42e7e5cbd fix commit amend 2021-04-10 11:54:38 +10:00
Jesse Duffield 93fac1f312 reduce flicker without worrying about carriage returns 2021-04-09 22:50:55 +10:00
Jesse Duffield b03e2270a0 revert no-flicker due to carriage return weirdness 2021-04-08 23:17:27 +10:00
Jesse Duffield 8eb802d3a0 fix flicker issue in main view 2021-04-06 19:34:32 +10:00
Jesse Duffield d7da6dde0e allow decimal replay speeds for integration tests 2021-04-06 19:34:32 +10:00
Jesse Duffield 9593129e6a remove caching of styles in gocui 2021-04-06 19:34:32 +10:00
Jesse Duffield c9ded489c9 bump gocui 2021-04-06 19:34:32 +10:00
Jesse Duffield 4c73d070ac ignore clicks on invisible views 2021-04-06 19:34:32 +10:00
Jesse Duffield 843b8ceab0 support tcell simulation screen 2021-04-06 19:34:32 +10:00
Jesse Duffield 32d170621c remove mutex lock that caused deadlock 2021-04-06 19:34:32 +10:00
Jesse Duffield 464d022a86 minor refactor 2021-04-06 19:34:32 +10:00
Jesse Duffield 6a0066253f move recording code into gocui 2021-04-06 19:34:32 +10:00
Jesse Duffield 952c62df37 fix bug where searching through view got stuck if you went over the upper bound 2021-04-06 19:34:32 +10:00
Jesse Duffield 39ae122304 more refactoring 2021-04-06 19:34:32 +10:00
Jesse Duffield 4197921465 WIP 2021-04-06 19:34:32 +10:00
Jesse Duffield 4b69ab08c1 WIP 2021-04-06 19:34:32 +10:00
Jesse Duffield 0898a7bb57 refactor 2021-04-06 19:34:32 +10:00
Jesse Duffield 5289d49f75 more efficient gocui 2021-04-06 19:34:32 +10:00
Jesse Duffield 1a5f380c00 support alt-enter for inserting newline when typing commit message within the app 2021-04-06 19:34:32 +10:00
Jesse Duffield 3ea5e4d4b2 allow scrolling when staging lines or building patch 2021-04-06 19:34:32 +10:00
Jesse Duffield 5d0cf3d919 prioritise keybindings on editors 2021-04-06 19:34:32 +10:00
Jesse Duffield 4b1da0cf3c bump gocui again 2021-04-06 19:34:32 +10:00
Jesse Duffield 862ced3bd0 bump gocui 2021-04-06 19:34:32 +10:00
Jesse Duffield 0d6ff7d1b7 support backtab key 2021-04-06 19:34:32 +10:00
Jesse Duffield ecc5fe24a9 get tcell to cleanup the terminal if we panic 2021-04-06 19:34:32 +10:00
Jesse Duffield 6246eb9717 go mod tidy 2021-04-06 19:34:32 +10:00
Jesse Duffield 8f763c42b6 bum pgocui 2021-04-06 19:34:32 +10:00
Jesse Duffield 6472bda29e bump gocui 2021-04-06 19:34:32 +10:00
Jesse Duffield c0cad91cb6 no more termbox 2021-04-06 19:34:32 +10:00
Jesse Duffield 6a6024e38f use tcell via porting over code from awesome-gocui 2021-04-06 19:34:32 +10:00
Jesse Duffield 049849264e defend against race condition in editors 2021-03-30 09:26:06 +11:00
Jesse Duffield 56a573de86 support wide characters in the editor 2021-02-08 22:55:11 +00:00
Jesse Duffield b8ad1883f5 fix delta 2020-10-12 08:26:31 +11:00