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

switching repos without restarting the gui

This commit is contained in:
Jesse Duffield
2021-04-03 13:43:43 +11:00
parent bc9a99387f
commit f1d7f59e49
13 changed files with 182 additions and 113 deletions

View File

@ -365,6 +365,10 @@ func ResolveTemplate(templateStr string, object interface{}) (string, error) {
// Safe will close tcell if a panic occurs so that we don't end up in a malformed
// terminal state
func Safe(f func()) {
_ = SafeWithError(func() error { f(); return nil })
}
func SafeWithError(f func() error) error {
panicking := true
defer func() {
if panicking && gocui.Screen != nil {
@ -372,7 +376,9 @@ func Safe(f func()) {
}
}()
f()
err := f()
panicking = false
return err
}