Skip to content

Commit e54326c

Browse files
committed
Added SwitchToPreviousContext function
1 parent fac3962 commit e54326c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

bubblehelp.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ var (
1818

1919
// ShowAll is the flag to define whether it's the full or short help that will be rendered.
2020
ShowAll bool
21+
22+
// previousContext allows to reset the previous context.
23+
previousContext KeymapContext
2124
)
2225

2326
// Init is the first function that needs to be called in the start of the app.
@@ -55,10 +58,15 @@ func SwitchContext(context KeymapContext) {
5558
keymap.Reset()
5659
}
5760

61+
previousContext = CurrentContext
5862
CurrentContext = context
5963
ShowAll = false
6064
}
6165

66+
func SwitchToPreviousContext() {
67+
SwitchContext(previousContext)
68+
}
69+
6270
// UpdateKeybindHelpDesc allows to temporary change the help description for a keybind in the current Keymap context.
6371
func UpdateKeybindHelpDesc(keybind key.Binding, desc string) {
6472
keymap := GetCurrentContextKeymap()

0 commit comments

Comments
 (0)