1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

use reflog undo history pointer

This commit is contained in:
Jesse Duffield
2020-03-21 11:56:34 +11:00
parent b1b0219f04
commit f80d15062b
8 changed files with 84 additions and 27 deletions

View File

@ -214,6 +214,21 @@ type guiState struct {
PrevMainWidth int
PrevMainHeight int
OldInformation string
Undo UndoState
}
// we facilitate 'undo' actions via parsing the reflog and doing the reverse
// of the most recent entry. In order to to multiple undo's in a row we need to
// keep track of where we are in the reflog. We do that via a key which is the
// concatenation of the reflog's timestamp and message.
// We also store the index of that reflog entry so that if we end up with a
// different entry at that index we know the user must have done something
// themselves (e.g. checked out a branch) to cause new reflog entries to be created
// meaning we can reset the undo state.
type UndoState struct {
ReflogKey string
ReflogIdx int
}
// for now the split view will always be on