1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-01 00:54:58 +02:00
Commit Graph

19 Commits

Author SHA1 Message Date
bd46e9c5b0 delete menu keybinding before setting new one 2019-03-23 13:26:17 +11:00
d84dfc23e7 Rely on model rather than view to focus a point
Currently when we want to focus a point on a view (i.e. highlight a
line and ensure it's within the bounds of a view's box, we use the
LinesHeight method on the view to work out how many lines in total
there are.

This is bad because for example if we come back from editing a file,
the view will have no contents so LinesHeight == 0, but we might
be trying to select line 10 because there are actual ten things we
expect to be rendered already. This causes a crash when e.g. 10 is
greater than the height of the view.

So we need to pass in to our FocusPoint method the actual number of
items we want to render, rather than having the method rely on the
LinesHeight, so that the method knows to scroll a bit before setting
the cursor's y position.

Unfortunately this makes for some awkward code with our current setup.
We don't have a good interface type on these state objects so we now
need to explicitly obtain the len() of whatever array we're rendering.

In the case of the menu panel this is even more awkward because the items
list is just an interface{} and it's not easy to get the list of that, so
now when we instantiate a menu we need to pass in the count of items
as well.

The better solution would be to define an interface with a getItems
and getLength method and have all these item arrays become structs
implementing the interface, but I am too lazy to do this right now :)
2019-03-23 11:54:25 +11:00
ac5088eee6 allow both enter and space to execute menu item 2019-03-03 23:18:28 +11:00
ad93b4c863 consider whether the view has focus when rendering the contents of a view 2019-02-16 15:17:44 +11:00
198cbee498 introduce panel contexts and more work on rebasing 2019-02-16 12:07:27 +11:00
3d343e9b57 Merge branch 'master' into feature/rebasing 2019-02-11 21:02:53 +11:00
695b092c41 Directly send wrap argument rather than the view 2019-01-17 10:29:52 +11:00
9489a94473 Make merge panel its own panel 2018-12-11 22:02:12 +11:00
ff856b7630 fetching branches without checking out 2018-12-08 11:51:47 +11:00
ca3afa2a39 standardising how list panels deal with cursor movement 2018-12-08 11:51:47 +11:00
b384fcf6af generalise popup menu panel 2018-09-18 21:07:25 +10:00
a66ac8092e minor refactor 2018-09-17 21:27:53 +10:00
c00c834b35 standardise rendering of lists in panels 2018-09-17 21:02:30 +10:00
31c33dfdcb remove redundant comments 2018-09-12 18:47:37 +10:00
52b132fe01 better handling of cursor and origin positionings 2018-09-10 20:17:39 +10:00
9cef98f779 ladies and gentlemen...
this is fmt number x+1
2018-09-07 14:23:08 +02:00
ba6dedfb22 rewrite some of menu panel logic
panel keybindings are now on top and
global keybindings are below separated with empty newline
2018-09-07 14:19:16 +02:00
906f8e252e include global keybindings in menu 2018-09-05 13:16:40 +02:00
557009e660 help -> menu 2018-09-05 11:12:11 +02:00