Add Go to line feature for the blame view by andrea-berling · Pull Request #2262 · gitui-org/gitui

extrawurst

cruessler

andrea-berling added a commit to andrea-berling/gitui that referenced this pull request

Jul 6, 2024

@andrea-berling

cruessler

extrawurst

extrawurst

extrawurst

Add new stackable popup to get a line number to go to from the user

Add a new internal event to change the selection in the most recent
blame view as a result of using the go to line popup

Add new keybinding for the go to line functionality (Shift-L)

Add boolean to BlameFilePopup to check whether the view is currently
shadowed by the go to line popup and, if so, let the key events bubble
up to the go to line popup

Add new command definition for the go to line functionality in BlameFilePopup

Add clamping of the selected row in set_open_selection

@andrea-berling @extrawurst

Remove unnecessary goto_line_popup_is_open boolean
Add Context enum to keep the blame status across line jumps

Add a context field to the GotoLinePopup

Add blame field to BlameFilePopup

Use the blame field in BlameFilePopup.open if not None

@andrea-berling @extrawurst

Modiy uses of BlameFileOpen accordingly

Make the blame field of BlameFilePopup private again
Add a context struct for the go to line popup to keep the max line
number allowed

Add support for negative values for the go to line popup input (go to
the -n-th to last line)

Make the go to line input box red when invalid values are provided

Add an error message to the Go to line popup when invalid values are
used

Allow arbitrarily large values in the Go to line input box

@andrea-berling

@andrea-berling

@andrea-berling

@andrea-berling

@andrea-berling

@andrea-berling

@andrea-berling

@extrawurst

@andrea-berling

@andrea-berling

@andrea-berling

extrawurst

@andrea-berling

@andrea-berling

@andrea-berling

The "Go to Line" popup was previously managed as a stackable popup,
which added unnecessary complexity.

This commit changes it to be a non-stackable popup, simplifying the
interaction and removing it from the main popup stack management. This
makes the code easier to reason about and maintain.

This also simplifies the BlameFilePopup API by removing the
now-redundant BlameRequest enum.
This commit removes a number of unused `#[derive(Debug)]`
implementations across the codebase to reduce code size and improve
compile times.

@andrea-berling

extrawurst

@andrea-berling

The `GotoLineContext` struct was unnecessary, as it only contained a
single `max_line` field.

This commit refactors the `GotoLinePopup` to accept `max_line` directly,
simplifying the code and removing the need for the `GotoLineContext`
struct.