1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-12 11:15:00 +02:00
Commit Graph

15 Commits

Author SHA1 Message Date
Jesse Duffield
5b9996b16f remove old createMenu function 2020-02-15 08:47:36 +11:00
Jesse Duffield
d929b84786 refactor recent repos menu panel 2020-02-15 08:47:36 +11:00
Jesse Duffield
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
Jesse Duffield
76a27f417f rename any commit 2019-02-18 21:29:43 +11:00
Jesse Duffield
ad93b4c863 consider whether the view has focus when rendering the contents of a view 2019-02-16 15:17:44 +11:00
Jesse Duffield
3d343e9b57 Merge branch 'master' into feature/rebasing 2019-02-11 21:02:53 +11:00
Jesse Duffield
9489a94473 Make merge panel its own panel 2018-12-11 22:02:12 +11:00
mjarkk
e20d8366e1 Made gobot happy 2018-12-10 14:21:00 +01:00
mjarkk
76e9582739 Not always git fetch 2018-12-10 13:45:03 +01:00
mjarkk
3c17bf761a Better name for this function 2018-12-10 07:46:26 +01:00
mjarkk
696d6dc20c Fixed loop before error check 2018-12-10 07:43:32 +01:00
mjarkk
ced81e11f0 Only show private repo popup when opening repo for first time 2018-12-06 22:05:16 +01:00
BlakeMScurr
181f91d2ef Add full stops to new comments. 2018-11-30 13:47:14 +13:00
BlakeMScurr
643cdd3461 Add simple comments to uncommented functions. 2018-11-30 11:04:08 +13:00
Jesse Duffield
e91fb21233 add recent repos menu option 2018-09-19 19:15:29 +10:00