Skip to content

Commit

Permalink
action/command: Simplify ResetCmd
Browse files Browse the repository at this point in the history
It doesn't need to loop over the DefaultCommonSettings() again,
since they're already included in the default settings and set via
SetGlobalOptionNative().
  • Loading branch information
JoeKar committed Aug 18, 2024
1 parent 10511c9 commit 0542765
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions internal/action/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,16 +634,10 @@ func (h *BufPane) ResetCmd(args []string) {
}

option := args[0]
defaults := config.DefaultAllSettings()

defaultGlobals := config.DefaultGlobalSettings()
defaultLocals := config.DefaultCommonSettings()

if _, ok := defaultGlobals[option]; ok {
SetGlobalOptionNative(option, defaultGlobals[option])
return
}
if _, ok := defaultLocals[option]; ok {
h.Buf.SetOptionNative(option, defaultLocals[option])
if _, ok := defaults[option]; ok {
SetGlobalOptionNative(option, defaults[option])
return
}
InfoBar.Error(config.ErrInvalidOption)
Expand Down

0 comments on commit 0542765

Please sign in to comment.