summaryrefslogtreecommitdiffstats
path: root/pkg/gui/context/list_context_trait.go
AgeCommit message (Collapse)Author
2024-06-23Only render visible portion of the screen for commits viewStefan Haller
2024-06-23Simplify ListContextTrait.FocusLineStefan Haller
When refreshViewportOnChange is true, we would refresh the viewport once at the end of FocusLine, and then we would check at the end of AfterLayout if the origin has changed, and refresh again if so. That's unnecessarily complicated, let's just unconditionally refresh at the end of AfterLayout only.
2024-06-23Fix searching in the divergence (left/right) viewStefan Haller
Searching in the "Divergence from upstream" view would select the wrong lines. The OnSearchSelect function gets passed a view index, and uses it to select a model line. In most views these are the same, but not in the divergence view (because of the Remote/Local section headers).
2024-01-19Disable range-select in menu and suggestions viewJesse Duffield
We don't need it there so no need to enable it. I'm leaving the disabled reason checks there, even though they're now redundant, because they're only one-liners and they communicate intent.
2024-01-19Add SetSelection function for list contexts and use it in most placesJesse Duffield
The only time we should call SetSelectedLineIdx is when we are happy for a select range to be retained which means things like moving the selected line index to top top/bottom or up/down a page as the user navigates. But in every other case we should now call SetSelection because that will set the selected index and cancel the range which is almost always what we want.
2024-01-19Add range selection ability on list contextsJesse Duffield
This adds range select ability in two ways: 1) Sticky: like what we already have with the staging view i.e. press v then use arrow keys 2) Non-sticky: where you just use shift+up/down to expand the range The state machine works like this: (no range, press 'v') -> sticky range (no range, press arrow) -> no range (no range, press shift+arrow) -> nonsticky range (sticky range, press 'v') -> no range (sticky range, press arrow) -> sticky range (sticky range, press shift+arrow) -> nonsticky range (nonsticky range, press 'v') -> no range (nonsticky range, press arrow) -> no range (nonsticky range, press shift+arrow) -> nonsticky range
2023-12-10Fall back to WithWaitingStatus if item is scrolled out of viewStefan Haller
2023-08-29Add a mechanism to insert non-model items into list contextsStefan Haller
Not used by anything yet.
2023-08-28Extract a ListRenderer structStefan Haller
I'm doing this not so much because it's a great abstraction, but just because it will make it much easier to write tests for it.
2023-08-28Call getDisplayStrings with a valid range of model indicesStefan Haller
It's nicer if clients can rely on the indices being valid, and don't have to clamp themselves.
2023-08-28Extract a renderLines functionStefan Haller
We'll make some changes to how the display strings are rendered, so it helps to have this code only once. This also fixes the problem that contexts using refreshViewportOnChange weren't able to use column alignments so far. We didn't need this yet, but it's just nice if everything works. :)
2023-08-28Change length parameter of getDisplayStrings to endIdxStefan Haller
It's more natural to work with this way, as we will see later in this branch.
2023-08-20Fix the commit graph display after selection jumps in commits viewStefan Haller
When navigating in the commits view to a line that is out of view (e.g. by pressing , or . to scroll by page, or < or > to scroll to the top or bottom), the commit graph was not correctly highlighted. Fix this by rerendering the viewport in this case.
2023-07-20Only apply right-alignment on first column of keybindings menuJesse Duffield
Previously we applied a right-align on the first column of _all_ menus, even though we really only intended for it to be on the first column of the keybindings menu (that you get from pressing '?')
2023-07-19Properly fix accordion issueJesse Duffield
The true issue was that we were focusing the line in the view before it gets resized in the layout function. This meant if the view was squashed in accordion mode, the view wouldn't know how to set the cursor/origin to focus the line. Now we've got a queue of 'after layout' functions i.e. functions to call at the end of the layout function, right before views are drawn. The only caveat is that we can't have an infinite buffer so we're arbitrarily capping it at 1000 and dropping functions if we exceed that limit. But that really should never happen.
2023-06-01Refresh commits viewport on focus lostJesse Duffield
We don't want the highlighted selection sticking around after the context loses focus.
2023-05-25Use boolean field to control whether viewport is refreshed on line focusJesse Duffield
Go really doesn't like us doing anything inheritance-y: it does not support open recursion meaning it's really hard to re-use code. As such, here we're falling back to conditional logic. This fixes an issue where our ListContextTrait was calling FocusLine which was intended to be overridden by ViewportListContextTrait, but the subclassed function wasn't being called. I'm not actually sure how this went wrong given that it was working fine in the past, but at any rate, the new code is easy to follow.
2023-05-21Right-align key labels in menuJesse Duffield
I find this makes it look a little nicer
2023-04-30move more actions into controllerJesse Duffield
2023-04-30split context common from helper commonJesse Duffield
2022-08-06refactor to only have one context per viewJesse Duffield
2022-04-16always show list countsJesse Duffield
2022-04-16do not highlight line if there are no items to displayJesse Duffield
2022-03-19use generics to DRY up context codeJesse Duffield
2022-03-17fix CIJesse Duffield
2022-03-17refactor controllersJesse Duffield
2022-03-17controller for viewing sub commitsJesse Duffield
2022-03-17refactor contextsJesse Duffield
2022-03-17refactor keybindingsJesse Duffield
2022-03-17move more view model logic into the files view modelJesse Duffield
2022-03-17cleaning upJesse Duffield
2022-03-17refactor contexts codeJesse Duffield