2018-08-12 11:31:27 +02:00
|
|
|
package gui
|
2018-08-08 11:18:41 +02:00
|
|
|
|
2018-09-17 13:02:30 +02:00
|
|
|
import (
|
2020-09-23 11:49:41 +02:00
|
|
|
"fmt"
|
2019-12-05 05:16:47 +02:00
|
|
|
"log"
|
2019-12-05 04:01:01 +02:00
|
|
|
"strings"
|
2020-08-12 11:19:32 +02:00
|
|
|
"unicode/utf8"
|
|
|
|
|
2020-01-07 12:42:33 +02:00
|
|
|
"github.com/jesseduffield/gocui"
|
2021-04-11 15:32:20 +02:00
|
|
|
"github.com/jesseduffield/lazygit/pkg/constants"
|
2022-01-29 10:15:46 +02:00
|
|
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
2022-02-13 01:39:14 +02:00
|
|
|
"github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers"
|
2022-01-28 11:44:36 +02:00
|
|
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
2018-09-17 13:02:30 +02:00
|
|
|
)
|
2018-08-08 11:18:41 +02:00
|
|
|
|
2020-01-06 17:37:33 +02:00
|
|
|
var keyMapReversed = map[gocui.Key]string{
|
2022-02-27 07:46:27 +02:00
|
|
|
gocui.KeyF1: "f1",
|
|
|
|
gocui.KeyF2: "f2",
|
|
|
|
gocui.KeyF3: "f3",
|
|
|
|
gocui.KeyF4: "f4",
|
|
|
|
gocui.KeyF5: "f5",
|
|
|
|
gocui.KeyF6: "f6",
|
|
|
|
gocui.KeyF7: "f7",
|
|
|
|
gocui.KeyF8: "f8",
|
|
|
|
gocui.KeyF9: "f9",
|
|
|
|
gocui.KeyF10: "f10",
|
|
|
|
gocui.KeyF11: "f11",
|
|
|
|
gocui.KeyF12: "f12",
|
|
|
|
gocui.KeyInsert: "insert",
|
|
|
|
gocui.KeyDelete: "delete",
|
|
|
|
gocui.KeyHome: "home",
|
|
|
|
gocui.KeyEnd: "end",
|
|
|
|
gocui.KeyPgup: "pgup",
|
|
|
|
gocui.KeyPgdn: "pgdown",
|
|
|
|
gocui.KeyArrowUp: "▲",
|
|
|
|
gocui.KeyArrowDown: "▼",
|
|
|
|
gocui.KeyArrowLeft: "◄",
|
|
|
|
gocui.KeyArrowRight: "►",
|
|
|
|
gocui.KeyTab: "tab", // ctrl+i
|
|
|
|
gocui.KeyBacktab: "shift+tab",
|
|
|
|
gocui.KeyEnter: "enter", // ctrl+m
|
|
|
|
gocui.KeyAltEnter: "alt+enter",
|
|
|
|
gocui.KeyEsc: "esc", // ctrl+[, ctrl+3
|
|
|
|
gocui.KeyBackspace: "backspace", // ctrl+h
|
|
|
|
gocui.KeyCtrlSpace: "ctrl+space", // ctrl+~, ctrl+2
|
|
|
|
gocui.KeyCtrlSlash: "ctrl+/", // ctrl+_
|
|
|
|
gocui.KeySpace: "space",
|
|
|
|
gocui.KeyCtrlA: "ctrl+a",
|
|
|
|
gocui.KeyCtrlB: "ctrl+b",
|
|
|
|
gocui.KeyCtrlC: "ctrl+c",
|
|
|
|
gocui.KeyCtrlD: "ctrl+d",
|
|
|
|
gocui.KeyCtrlE: "ctrl+e",
|
|
|
|
gocui.KeyCtrlF: "ctrl+f",
|
|
|
|
gocui.KeyCtrlG: "ctrl+g",
|
|
|
|
gocui.KeyCtrlJ: "ctrl+j",
|
|
|
|
gocui.KeyCtrlK: "ctrl+k",
|
|
|
|
gocui.KeyCtrlL: "ctrl+l",
|
|
|
|
gocui.KeyCtrlN: "ctrl+n",
|
|
|
|
gocui.KeyCtrlO: "ctrl+o",
|
|
|
|
gocui.KeyCtrlP: "ctrl+p",
|
|
|
|
gocui.KeyCtrlQ: "ctrl+q",
|
|
|
|
gocui.KeyCtrlR: "ctrl+r",
|
|
|
|
gocui.KeyCtrlS: "ctrl+s",
|
|
|
|
gocui.KeyCtrlT: "ctrl+t",
|
|
|
|
gocui.KeyCtrlU: "ctrl+u",
|
|
|
|
gocui.KeyCtrlV: "ctrl+v",
|
|
|
|
gocui.KeyCtrlW: "ctrl+w",
|
|
|
|
gocui.KeyCtrlX: "ctrl+x",
|
|
|
|
gocui.KeyCtrlY: "ctrl+y",
|
|
|
|
gocui.KeyCtrlZ: "ctrl+z",
|
|
|
|
gocui.KeyCtrl4: "ctrl+4", // ctrl+\
|
|
|
|
gocui.KeyCtrl5: "ctrl+5", // ctrl+]
|
|
|
|
gocui.KeyCtrl6: "ctrl+6",
|
|
|
|
gocui.KeyCtrl8: "ctrl+8",
|
|
|
|
gocui.MouseWheelUp: "mouse wheel up",
|
|
|
|
gocui.MouseWheelDown: "mouse wheel down",
|
2020-01-06 17:37:33 +02:00
|
|
|
}
|
|
|
|
|
2019-12-05 04:01:01 +02:00
|
|
|
var keymap = map[string]interface{}{
|
|
|
|
"<c-a>": gocui.KeyCtrlA,
|
|
|
|
"<c-b>": gocui.KeyCtrlB,
|
|
|
|
"<c-c>": gocui.KeyCtrlC,
|
|
|
|
"<c-d>": gocui.KeyCtrlD,
|
|
|
|
"<c-e>": gocui.KeyCtrlE,
|
|
|
|
"<c-f>": gocui.KeyCtrlF,
|
|
|
|
"<c-g>": gocui.KeyCtrlG,
|
|
|
|
"<c-h>": gocui.KeyCtrlH,
|
|
|
|
"<c-i>": gocui.KeyCtrlI,
|
|
|
|
"<c-j>": gocui.KeyCtrlJ,
|
|
|
|
"<c-k>": gocui.KeyCtrlK,
|
|
|
|
"<c-l>": gocui.KeyCtrlL,
|
|
|
|
"<c-m>": gocui.KeyCtrlM,
|
|
|
|
"<c-n>": gocui.KeyCtrlN,
|
|
|
|
"<c-o>": gocui.KeyCtrlO,
|
|
|
|
"<c-p>": gocui.KeyCtrlP,
|
|
|
|
"<c-q>": gocui.KeyCtrlQ,
|
|
|
|
"<c-r>": gocui.KeyCtrlR,
|
|
|
|
"<c-s>": gocui.KeyCtrlS,
|
|
|
|
"<c-t>": gocui.KeyCtrlT,
|
|
|
|
"<c-u>": gocui.KeyCtrlU,
|
|
|
|
"<c-v>": gocui.KeyCtrlV,
|
|
|
|
"<c-w>": gocui.KeyCtrlW,
|
|
|
|
"<c-x>": gocui.KeyCtrlX,
|
|
|
|
"<c-y>": gocui.KeyCtrlY,
|
|
|
|
"<c-z>": gocui.KeyCtrlZ,
|
|
|
|
"<c-~>": gocui.KeyCtrlTilde,
|
|
|
|
"<c-2>": gocui.KeyCtrl2,
|
|
|
|
"<c-3>": gocui.KeyCtrl3,
|
|
|
|
"<c-4>": gocui.KeyCtrl4,
|
|
|
|
"<c-5>": gocui.KeyCtrl5,
|
|
|
|
"<c-6>": gocui.KeyCtrl6,
|
|
|
|
"<c-7>": gocui.KeyCtrl7,
|
|
|
|
"<c-8>": gocui.KeyCtrl8,
|
|
|
|
"<c-space>": gocui.KeyCtrlSpace,
|
|
|
|
"<c-\\>": gocui.KeyCtrlBackslash,
|
|
|
|
"<c-[>": gocui.KeyCtrlLsqBracket,
|
|
|
|
"<c-]>": gocui.KeyCtrlRsqBracket,
|
|
|
|
"<c-/>": gocui.KeyCtrlSlash,
|
|
|
|
"<c-_>": gocui.KeyCtrlUnderscore,
|
|
|
|
"<backspace>": gocui.KeyBackspace,
|
|
|
|
"<tab>": gocui.KeyTab,
|
2021-04-11 15:32:20 +02:00
|
|
|
"<backtab>": gocui.KeyBacktab,
|
2019-12-05 04:01:01 +02:00
|
|
|
"<enter>": gocui.KeyEnter,
|
2021-04-02 06:08:15 +02:00
|
|
|
"<a-enter>": gocui.KeyAltEnter,
|
2019-12-05 04:01:01 +02:00
|
|
|
"<esc>": gocui.KeyEsc,
|
|
|
|
"<space>": gocui.KeySpace,
|
|
|
|
"<f1>": gocui.KeyF1,
|
|
|
|
"<f2>": gocui.KeyF2,
|
|
|
|
"<f3>": gocui.KeyF3,
|
|
|
|
"<f4>": gocui.KeyF4,
|
|
|
|
"<f5>": gocui.KeyF5,
|
|
|
|
"<f6>": gocui.KeyF6,
|
|
|
|
"<f7>": gocui.KeyF7,
|
|
|
|
"<f8>": gocui.KeyF8,
|
|
|
|
"<f9>": gocui.KeyF9,
|
|
|
|
"<f10>": gocui.KeyF10,
|
|
|
|
"<f11>": gocui.KeyF11,
|
|
|
|
"<f12>": gocui.KeyF12,
|
|
|
|
"<insert>": gocui.KeyInsert,
|
|
|
|
"<delete>": gocui.KeyDelete,
|
|
|
|
"<home>": gocui.KeyHome,
|
|
|
|
"<end>": gocui.KeyEnd,
|
|
|
|
"<pgup>": gocui.KeyPgup,
|
|
|
|
"<pgdown>": gocui.KeyPgdn,
|
|
|
|
"<up>": gocui.KeyArrowUp,
|
|
|
|
"<down>": gocui.KeyArrowDown,
|
|
|
|
"<left>": gocui.KeyArrowLeft,
|
|
|
|
"<right>": gocui.KeyArrowRight,
|
|
|
|
}
|
|
|
|
|
2020-01-07 19:50:25 +02:00
|
|
|
func (gui *Gui) getKeyDisplay(name string) string {
|
|
|
|
key := gui.getKey(name)
|
|
|
|
return GetKeyDisplay(key)
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetKeyDisplay(key interface{}) string {
|
|
|
|
keyInt := 0
|
|
|
|
|
2020-03-09 02:34:10 +02:00
|
|
|
switch key := key.(type) {
|
2020-01-07 19:50:25 +02:00
|
|
|
case rune:
|
2020-03-09 02:34:10 +02:00
|
|
|
keyInt = int(key)
|
2020-01-07 19:50:25 +02:00
|
|
|
case gocui.Key:
|
2020-03-09 02:34:10 +02:00
|
|
|
value, ok := keyMapReversed[key]
|
2020-01-07 19:50:25 +02:00
|
|
|
if ok {
|
|
|
|
return value
|
|
|
|
}
|
2020-03-09 02:34:10 +02:00
|
|
|
keyInt = int(key)
|
2020-01-07 19:50:25 +02:00
|
|
|
}
|
|
|
|
|
2020-09-23 11:49:41 +02:00
|
|
|
return fmt.Sprintf("%c", keyInt)
|
2020-01-07 19:50:25 +02:00
|
|
|
}
|
|
|
|
|
2020-10-03 06:54:55 +02:00
|
|
|
func (gui *Gui) getKey(key string) interface{} {
|
2020-08-12 11:19:32 +02:00
|
|
|
runeCount := utf8.RuneCountInString(key)
|
|
|
|
if runeCount > 1 {
|
2019-12-05 05:16:47 +02:00
|
|
|
binding := keymap[strings.ToLower(key)]
|
|
|
|
if binding == nil {
|
2021-04-11 15:32:20 +02:00
|
|
|
log.Fatalf("Unrecognized key %s for keybinding. For permitted values see %s", strings.ToLower(key), constants.Links.Docs.CustomKeybindings)
|
2019-12-05 05:16:47 +02:00
|
|
|
} else {
|
|
|
|
return binding
|
|
|
|
}
|
2020-08-12 11:19:32 +02:00
|
|
|
} else if runeCount == 1 {
|
2019-12-05 04:01:01 +02:00
|
|
|
return []rune(key)[0]
|
|
|
|
}
|
2020-10-03 06:54:55 +02:00
|
|
|
log.Fatal("Key empty for keybinding: " + strings.ToLower(key))
|
2019-12-05 04:01:01 +02:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-01-16 05:46:53 +02:00
|
|
|
func (gui *Gui) noPopupPanel(f func() error) func() error {
|
|
|
|
return func() error {
|
|
|
|
if gui.popupPanelFocused() {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return f()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-13 01:39:14 +02:00
|
|
|
// only to be called from the cheatsheet generate script. This mutates the Gui struct.
|
|
|
|
func (self *Gui) GetCheatsheetKeybindings() []*types.Binding {
|
|
|
|
self.helpers = helpers.NewStubHelpers()
|
|
|
|
self.State = &GuiRepoState{}
|
|
|
|
self.State.Contexts = self.contextTree()
|
|
|
|
self.resetControllers()
|
|
|
|
bindings, _ := self.GetInitialKeybindings()
|
|
|
|
return bindings
|
|
|
|
}
|
|
|
|
|
2022-02-06 06:54:26 +02:00
|
|
|
// renaming receiver to 'self' to aid refactoring. Will probably end up moving all Gui handlers to this pattern eventually.
|
|
|
|
func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBinding) {
|
|
|
|
config := self.c.UserConfig.Keybinding
|
2022-01-16 05:46:53 +02:00
|
|
|
|
|
|
|
guards := types.KeybindingGuards{
|
2022-02-06 06:54:26 +02:00
|
|
|
OutsideFilterMode: self.outsideFilterMode,
|
|
|
|
NoPopupPanel: self.noPopupPanel,
|
|
|
|
}
|
|
|
|
|
|
|
|
opts := types.KeybindingsOpts{
|
|
|
|
GetKey: self.getKey,
|
|
|
|
Config: config,
|
|
|
|
Guards: guards,
|
2022-01-16 05:46:53 +02:00
|
|
|
}
|
2020-10-03 06:54:55 +02:00
|
|
|
|
2022-01-28 11:44:36 +02:00
|
|
|
bindings := []*types.Binding{
|
2018-09-01 12:10:03 +02:00
|
|
|
{
|
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.Quit),
|
2018-09-01 12:10:03 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleQuit,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2019-10-07 03:34:12 +02:00
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.QuitWithoutChangingDirectory),
|
2019-10-07 03:34:12 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleQuitWithoutChangingDirectory,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2018-09-01 12:10:03 +02:00
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.QuitAlt1),
|
2018-09-01 12:10:03 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleQuit,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2018-09-01 12:10:03 +02:00
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.Return),
|
2018-09-01 12:10:03 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleTopLevelReturn,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
2021-05-27 16:22:33 +02:00
|
|
|
{
|
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.OpenRecentRepos),
|
|
|
|
Handler: self.handleCreateRecentReposMenu,
|
|
|
|
Description: self.c.Tr.SwitchRepo,
|
2021-05-27 16:22:33 +02:00
|
|
|
},
|
2019-11-16 03:41:04 +02:00
|
|
|
{
|
2019-05-03 07:03:25 +02:00
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.ScrollUpMain),
|
|
|
|
Handler: self.scrollUpMain,
|
2019-05-03 07:03:25 +02:00
|
|
|
Alternative: "fn+up",
|
2022-02-06 06:54:26 +02:00
|
|
|
Description: self.c.Tr.LcScrollUpMainPanel,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2019-05-03 07:03:25 +02:00
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.ScrollDownMain),
|
|
|
|
Handler: self.scrollDownMain,
|
2019-05-03 07:03:25 +02:00
|
|
|
Alternative: "fn+down",
|
2022-02-06 06:54:26 +02:00
|
|
|
Description: self.c.Tr.LcScrollDownMainPanel,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2019-05-25 08:37:47 +02:00
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.ScrollUpMainAlt1),
|
2019-05-25 08:37:47 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollUpMain,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2019-05-25 08:37:47 +02:00
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.ScrollDownMainAlt1),
|
2019-05-25 08:37:47 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollDownMain,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2018-09-01 12:10:03 +02:00
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.ScrollUpMainAlt2),
|
2018-09-01 12:10:03 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollUpMain,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2018-09-01 12:10:03 +02:00
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.ScrollDownMainAlt2),
|
2018-09-01 12:10:03 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollDownMain,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2019-02-19 14:36:29 +02:00
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.CreateRebaseOptionsMenu),
|
|
|
|
Handler: self.helpers.MergeAndRebase.CreateRebaseOptionsMenu,
|
|
|
|
Description: self.c.Tr.ViewMergeRebaseOptions,
|
2021-02-12 05:51:57 +02:00
|
|
|
OpensMenu: true,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
2020-01-03 14:01:32 +02:00
|
|
|
{
|
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.CreatePatchOptionsMenu),
|
|
|
|
Handler: self.handleCreatePatchOptionsMenu,
|
|
|
|
Description: self.c.Tr.ViewPatchOptions,
|
2021-02-12 05:51:57 +02:00
|
|
|
OpensMenu: true,
|
2020-01-03 14:01:32 +02:00
|
|
|
},
|
2019-11-16 03:41:04 +02:00
|
|
|
{
|
2018-09-05 13:23:06 +02:00
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.Refresh),
|
|
|
|
Handler: self.handleRefresh,
|
|
|
|
Description: self.c.Tr.LcRefresh,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2020-03-12 07:29:15 +02:00
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.OptionMenu),
|
|
|
|
Handler: self.handleCreateOptionsMenu,
|
|
|
|
Description: self.c.Tr.LcOpenMenu,
|
2021-02-12 05:51:57 +02:00
|
|
|
OpensMenu: true,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2019-11-10 07:54:05 +02:00
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.OptionMenuAlt1),
|
2019-11-10 07:54:05 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleCreateOptionsMenu,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2018-09-01 12:10:03 +02:00
|
|
|
ViewName: "status",
|
2022-02-27 07:46:27 +02:00
|
|
|
Contexts: []string{string(context.STATUS_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.Edit),
|
|
|
|
Handler: self.handleEditConfig,
|
|
|
|
Description: self.c.Tr.EditConfig,
|
2020-02-24 23:32:46 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.NextScreenMode),
|
|
|
|
Handler: self.nextScreenMode,
|
|
|
|
Description: self.c.Tr.LcNextScreenMode,
|
2020-02-24 23:32:46 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.PrevScreenMode),
|
|
|
|
Handler: self.prevScreenMode,
|
|
|
|
Description: self.c.Tr.LcPrevScreenMode,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2018-09-01 12:10:03 +02:00
|
|
|
ViewName: "status",
|
2022-02-27 07:46:27 +02:00
|
|
|
Contexts: []string{string(context.STATUS_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.OpenFile),
|
|
|
|
Handler: self.handleOpenConfig,
|
|
|
|
Description: self.c.Tr.OpenConfig,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2018-09-01 12:10:03 +02:00
|
|
|
ViewName: "status",
|
2022-02-27 07:46:27 +02:00
|
|
|
Contexts: []string{string(context.STATUS_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Status.CheckForUpdate),
|
|
|
|
Handler: self.handleCheckForUpdate,
|
|
|
|
Description: self.c.Tr.LcCheckForUpdate,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2018-09-19 10:40:41 +02:00
|
|
|
ViewName: "status",
|
2022-02-27 07:46:27 +02:00
|
|
|
Contexts: []string{string(context.STATUS_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Status.RecentRepos),
|
|
|
|
Handler: self.handleCreateRecentReposMenu,
|
|
|
|
Description: self.c.Tr.SwitchRepo,
|
2018-09-19 10:40:41 +02:00
|
|
|
},
|
2020-11-27 09:07:14 +02:00
|
|
|
{
|
|
|
|
ViewName: "status",
|
2022-02-27 07:46:27 +02:00
|
|
|
Contexts: []string{string(context.STATUS_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Status.AllBranchesLogGraph),
|
|
|
|
Handler: self.handleShowAllBranchLogs,
|
|
|
|
Description: self.c.Tr.LcAllBranchesLogGraph,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2018-12-12 13:33:42 +02:00
|
|
|
ViewName: "files",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.FILES_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
|
|
|
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
|
|
|
Description: self.c.Tr.LcCopyFileNameToClipboard,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2018-12-07 09:52:31 +02:00
|
|
|
ViewName: "branches",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
|
|
|
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
|
|
|
Description: self.c.Tr.LcCopyBranchNameToClipboard,
|
2020-04-15 12:30:24 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "commits",
|
2022-02-13 08:01:53 +02:00
|
|
|
Contexts: []string{string(context.LOCAL_COMMITS_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
|
|
|
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
|
|
|
Description: self.c.Tr.LcCopyCommitShaToClipboard,
|
2020-04-15 12:30:24 +02:00
|
|
|
},
|
2020-03-18 23:45:21 +02:00
|
|
|
{
|
|
|
|
ViewName: "commits",
|
2022-02-13 08:01:53 +02:00
|
|
|
Contexts: []string{string(context.LOCAL_COMMITS_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Commits.ResetCherryPick),
|
|
|
|
Handler: self.helpers.CherryPick.Reset,
|
|
|
|
Description: self.c.Tr.LcResetCherryPick,
|
2022-01-19 09:32:27 +02:00
|
|
|
},
|
2020-08-21 01:12:45 +02:00
|
|
|
{
|
|
|
|
ViewName: "commits",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.REFLOG_COMMITS_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
|
|
|
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
|
|
|
Description: self.c.Tr.LcCopyCommitShaToClipboard,
|
2020-09-19 12:55:52 +02:00
|
|
|
},
|
2020-08-22 00:49:02 +02:00
|
|
|
{
|
2022-03-24 13:07:30 +02:00
|
|
|
ViewName: "subCommits",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.SUB_COMMITS_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
|
|
|
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
|
|
|
Description: self.c.Tr.LcCopyCommitShaToClipboard,
|
2020-08-22 04:07:03 +02:00
|
|
|
},
|
2019-11-16 03:41:04 +02:00
|
|
|
{
|
2020-03-12 07:26:11 +02:00
|
|
|
ViewName: "menu",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.Return),
|
|
|
|
Handler: self.handleMenuClose,
|
|
|
|
Description: self.c.Tr.LcCloseMenu,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
2019-03-03 05:28:16 +02:00
|
|
|
ViewName: "information",
|
2019-02-25 13:11:35 +02:00
|
|
|
Key: gocui.MouseLeft,
|
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleInfoClick,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
2021-03-31 14:20:36 +02:00
|
|
|
{
|
|
|
|
ViewName: "commitFiles",
|
2022-03-24 13:07:30 +02:00
|
|
|
Contexts: []string{string(context.COMMIT_FILES_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
|
|
|
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
|
|
|
Description: self.c.Tr.LcCopyCommitFileNameToClipboard,
|
2021-03-31 14:20:36 +02:00
|
|
|
},
|
2020-03-28 07:28:35 +02:00
|
|
|
{
|
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.FilteringMenu),
|
|
|
|
Handler: self.handleCreateFilteringMenuPanel,
|
|
|
|
Description: self.c.Tr.LcOpenFilteringMenu,
|
2021-02-12 05:51:57 +02:00
|
|
|
OpensMenu: true,
|
2020-03-28 07:28:35 +02:00
|
|
|
},
|
2020-03-29 05:34:17 +02:00
|
|
|
{
|
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.DiffingMenu),
|
|
|
|
Handler: self.handleCreateDiffingMenuPanel,
|
|
|
|
Description: self.c.Tr.LcOpenDiffingMenu,
|
2021-02-12 05:51:57 +02:00
|
|
|
OpensMenu: true,
|
2020-03-29 05:34:17 +02:00
|
|
|
},
|
2020-08-25 01:07:16 +02:00
|
|
|
{
|
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.DiffingMenuAlt),
|
|
|
|
Handler: self.handleCreateDiffingMenuPanel,
|
|
|
|
Description: self.c.Tr.LcOpenDiffingMenu,
|
2021-02-12 05:51:57 +02:00
|
|
|
OpensMenu: true,
|
2020-08-25 01:07:16 +02:00
|
|
|
},
|
2021-04-11 04:12:54 +02:00
|
|
|
{
|
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.ExtrasMenu),
|
|
|
|
Handler: self.handleCreateExtrasMenuPanel,
|
|
|
|
Description: self.c.Tr.LcOpenExtrasMenu,
|
2021-04-11 04:12:54 +02:00
|
|
|
OpensMenu: true,
|
|
|
|
},
|
2019-11-10 07:50:36 +02:00
|
|
|
{
|
|
|
|
ViewName: "secondary",
|
|
|
|
Key: gocui.MouseWheelUp,
|
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollUpSecondary,
|
2019-11-10 07:50:36 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "secondary",
|
|
|
|
Key: gocui.MouseWheelDown,
|
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollDownSecondary,
|
2019-11-10 07:50:36 +02:00
|
|
|
},
|
2019-11-16 03:41:04 +02:00
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_NORMAL_CONTEXT_KEY)},
|
2019-11-16 03:41:04 +02:00
|
|
|
Key: gocui.MouseWheelDown,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollDownMain,
|
|
|
|
Description: self.c.Tr.ScrollDown,
|
2019-11-16 03:41:04 +02:00
|
|
|
Alternative: "fn+up",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_NORMAL_CONTEXT_KEY)},
|
2019-11-16 03:41:04 +02:00
|
|
|
Key: gocui.MouseWheelUp,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollUpMain,
|
|
|
|
Description: self.c.Tr.ScrollUp,
|
2019-11-16 03:41:04 +02:00
|
|
|
Alternative: "fn+down",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "secondary",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2019-11-16 03:41:04 +02:00
|
|
|
Key: gocui.MouseLeft,
|
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleTogglePanelClick,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.Return),
|
|
|
|
Handler: self.handleStagingEscape,
|
|
|
|
Description: self.c.Tr.ReturnToFilesPanel,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.Select),
|
|
|
|
Handler: self.handleToggleStagedSelection,
|
|
|
|
Description: self.c.Tr.StageSelection,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.Remove),
|
|
|
|
Handler: self.handleResetSelection,
|
|
|
|
Description: self.c.Tr.ResetSelection,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
|
|
|
|
Handler: self.handleTogglePanel,
|
|
|
|
Description: self.c.Tr.TogglePanel,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.Return),
|
|
|
|
Handler: self.handleEscapePatchBuildingPanel,
|
|
|
|
Description: self.c.Tr.ExitLineByLineMode,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
2020-08-15 02:58:29 +02:00
|
|
|
{
|
2020-08-15 03:23:14 +02:00
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.OpenFile),
|
|
|
|
Handler: self.handleOpenFileAtLine,
|
|
|
|
Description: self.c.Tr.LcOpenFile,
|
2020-08-15 02:58:29 +02:00
|
|
|
},
|
2019-11-16 03:41:04 +02:00
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.PrevItem),
|
|
|
|
Handler: self.handleSelectPrevLine,
|
|
|
|
Description: self.c.Tr.PrevLine,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.NextItem),
|
|
|
|
Handler: self.handleSelectNextLine,
|
|
|
|
Description: self.c.Tr.NextLine,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.PrevItemAlt),
|
2019-11-16 03:41:04 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleSelectPrevLine,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.NextItemAlt),
|
2019-11-16 03:41:04 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleSelectNextLine,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2019-11-16 03:41:04 +02:00
|
|
|
Key: gocui.MouseWheelUp,
|
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollUpMain,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2019-11-16 03:41:04 +02:00
|
|
|
Key: gocui.MouseWheelDown,
|
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollDownMain,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.PrevBlock),
|
|
|
|
Handler: self.handleSelectPrevHunk,
|
|
|
|
Description: self.c.Tr.PrevHunk,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.PrevBlockAlt),
|
2019-11-16 03:41:04 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleSelectPrevHunk,
|
2020-10-01 23:56:14 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.NextBlock),
|
|
|
|
Handler: self.handleSelectNextHunk,
|
|
|
|
Description: self.c.Tr.NextHunk,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.NextBlockAlt),
|
2019-11-16 03:41:04 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleSelectNextHunk,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
2021-10-02 09:50:26 +02:00
|
|
|
{
|
2021-10-16 04:49:40 +02:00
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
2021-10-16 04:49:40 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.copySelectedToClipboard,
|
|
|
|
Description: self.c.Tr.LcCopySelectedTexToClipboard,
|
2021-10-02 09:50:26 +02:00
|
|
|
},
|
2019-11-16 03:41:04 +02:00
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.Edit),
|
|
|
|
Handler: self.handleLineByLineEdit,
|
|
|
|
Description: self.c.Tr.LcEditFile,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.OpenFile),
|
|
|
|
Handler: self.Controllers.Files.Open,
|
|
|
|
Description: self.c.Tr.LcOpenFile,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
2020-10-01 23:56:14 +02:00
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.NextPage),
|
2020-10-01 23:56:14 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleLineByLineNextPage,
|
|
|
|
Description: self.c.Tr.LcNextPage,
|
2020-10-01 23:56:14 +02:00
|
|
|
Tag: "navigation",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.PrevPage),
|
2020-10-01 23:56:14 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleLineByLinePrevPage,
|
|
|
|
Description: self.c.Tr.LcPrevPage,
|
2020-10-01 23:56:14 +02:00
|
|
|
Tag: "navigation",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.GotoTop),
|
2020-10-01 23:56:14 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleLineByLineGotoTop,
|
|
|
|
Description: self.c.Tr.LcGotoTop,
|
2020-10-01 23:56:14 +02:00
|
|
|
Tag: "navigation",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.GotoBottom),
|
2020-10-01 23:56:14 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleLineByLineGotoBottom,
|
|
|
|
Description: self.c.Tr.LcGotoBottom,
|
2020-10-01 23:56:14 +02:00
|
|
|
Tag: "navigation",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.StartSearch),
|
|
|
|
Handler: func() error { return self.handleOpenSearch("main") },
|
|
|
|
Description: self.c.Tr.LcStartSearch,
|
2020-10-01 23:56:14 +02:00
|
|
|
Tag: "navigation",
|
|
|
|
},
|
2019-11-16 03:41:04 +02:00
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.Select),
|
|
|
|
Handler: self.handleToggleSelectionForPatch,
|
|
|
|
Description: self.c.Tr.ToggleSelectionForPatch,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Main.ToggleDragSelect),
|
|
|
|
Handler: self.handleToggleSelectRange,
|
|
|
|
Description: self.c.Tr.ToggleDragSelect,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
2019-11-27 21:35:41 +02:00
|
|
|
// Alias 'V' -> 'v'
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Main.ToggleDragSelectAlt),
|
|
|
|
Handler: self.handleToggleSelectRange,
|
|
|
|
Description: self.c.Tr.ToggleDragSelect,
|
2019-11-27 21:35:41 +02:00
|
|
|
},
|
2019-11-16 03:41:04 +02:00
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Main.ToggleSelectHunk),
|
|
|
|
Handler: self.handleToggleSelectHunk,
|
|
|
|
Description: self.c.Tr.ToggleSelectHunk,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2019-11-16 03:41:04 +02:00
|
|
|
Key: gocui.MouseLeft,
|
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleLBLMouseDown,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
2021-02-09 12:49:03 +02:00
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2021-02-09 12:49:03 +02:00
|
|
|
Key: gocui.MouseLeft,
|
|
|
|
Modifier: gocui.ModMotion,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleMouseDrag,
|
2021-02-09 12:49:03 +02:00
|
|
|
},
|
2019-11-16 03:41:04 +02:00
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2019-11-16 03:41:04 +02:00
|
|
|
Key: gocui.MouseWheelUp,
|
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollUpMain,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2019-11-16 03:41:04 +02:00
|
|
|
Key: gocui.MouseWheelDown,
|
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollDownMain,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
2021-11-02 11:35:53 +02:00
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY), string(context.MAIN_MERGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.ScrollLeft),
|
|
|
|
Handler: self.scrollLeftMain,
|
|
|
|
Description: self.c.Tr.LcScrollLeft,
|
2022-02-27 07:46:27 +02:00
|
|
|
Tag: "navigation",
|
2021-11-02 11:35:53 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY), string(context.MAIN_MERGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.ScrollRight),
|
|
|
|
Handler: self.scrollRightMain,
|
|
|
|
Description: self.c.Tr.LcScrollRight,
|
2022-02-27 07:46:27 +02:00
|
|
|
Tag: "navigation",
|
2021-11-02 11:35:53 +02:00
|
|
|
},
|
2020-02-03 15:18:03 +02:00
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Files.CommitChanges),
|
|
|
|
Handler: self.Controllers.Files.HandleCommitPress,
|
|
|
|
Description: self.c.Tr.CommitChanges,
|
2020-02-03 15:18:03 +02:00
|
|
|
},
|
2020-02-04 13:43:56 +02:00
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Files.CommitChangesWithoutHook),
|
|
|
|
Handler: self.Controllers.Files.HandleWIPCommitPress,
|
|
|
|
Description: self.c.Tr.LcCommitChangesWithoutHook,
|
2020-02-04 13:43:56 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Files.CommitChangesWithEditor),
|
|
|
|
Handler: self.Controllers.Files.HandleCommitEditorPress,
|
|
|
|
Description: self.c.Tr.CommitChangesWithEditor,
|
2020-02-04 13:43:56 +02:00
|
|
|
},
|
2019-11-16 03:41:04 +02:00
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.Return),
|
|
|
|
Handler: self.handleEscapeMerge,
|
|
|
|
Description: self.c.Tr.ReturnToFilesPanel,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
2021-04-11 02:05:39 +02:00
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Files.OpenMergeTool),
|
|
|
|
Handler: self.Controllers.Files.OpenMergeTool,
|
|
|
|
Description: self.c.Tr.LcOpenMergeTool,
|
2021-04-11 02:05:39 +02:00
|
|
|
},
|
2019-11-16 03:41:04 +02:00
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.Select),
|
|
|
|
Handler: self.handlePickHunk,
|
|
|
|
Description: self.c.Tr.PickHunk,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Main.PickBothHunks),
|
|
|
|
Handler: self.handlePickAllHunks,
|
|
|
|
Description: self.c.Tr.PickAllHunks,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.PrevBlock),
|
|
|
|
Handler: self.handleSelectPrevConflict,
|
|
|
|
Description: self.c.Tr.PrevConflict,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.NextBlock),
|
|
|
|
Handler: self.handleSelectNextConflict,
|
|
|
|
Description: self.c.Tr.NextConflict,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.PrevItem),
|
|
|
|
Handler: self.handleSelectPrevConflictHunk,
|
|
|
|
Description: self.c.Tr.SelectPrevHunk,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.NextItem),
|
|
|
|
Handler: self.handleSelectNextConflictHunk,
|
|
|
|
Description: self.c.Tr.SelectNextHunk,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.PrevBlockAlt),
|
2019-11-16 03:41:04 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleSelectPrevConflict,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.NextBlockAlt),
|
2019-11-16 03:41:04 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleSelectNextConflict,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.PrevItemAlt),
|
2019-11-16 03:41:04 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleSelectPrevConflictHunk,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.NextItemAlt),
|
2019-11-16 03:41:04 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleSelectNextConflictHunk,
|
2019-11-16 03:41:04 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "main",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.MAIN_MERGING_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.Undo),
|
|
|
|
Handler: self.handleMergeConflictUndo,
|
|
|
|
Description: self.c.Tr.LcUndo,
|
2019-11-17 09:15:32 +02:00
|
|
|
},
|
2019-11-16 05:00:27 +02:00
|
|
|
{
|
|
|
|
ViewName: "status",
|
|
|
|
Key: gocui.MouseLeft,
|
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleStatusClick,
|
2019-11-16 05:00:27 +02:00
|
|
|
},
|
2020-02-23 12:53:30 +02:00
|
|
|
{
|
|
|
|
ViewName: "search",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.Confirm),
|
2020-02-23 12:53:30 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleSearch,
|
2020-02-23 12:53:30 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "search",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.Return),
|
2020-02-23 12:53:30 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleSearchEscape,
|
2020-02-23 12:53:30 +02:00
|
|
|
},
|
2020-03-26 12:39:59 +02:00
|
|
|
{
|
|
|
|
ViewName: "confirmation",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.PrevItem),
|
2020-03-26 12:39:59 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollUpConfirmationPanel,
|
2020-03-26 12:39:59 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "confirmation",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.NextItem),
|
2020-03-26 12:39:59 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollDownConfirmationPanel,
|
2020-03-26 12:39:59 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "confirmation",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.PrevItemAlt),
|
2020-03-26 12:39:59 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollUpConfirmationPanel,
|
2020-03-26 12:39:59 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "confirmation",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.NextItemAlt),
|
2020-03-26 12:39:59 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollDownConfirmationPanel,
|
2020-03-26 12:39:59 +02:00
|
|
|
},
|
2020-09-30 00:27:23 +02:00
|
|
|
{
|
|
|
|
ViewName: "files",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.SUBMODULES_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
|
|
|
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
|
|
|
Description: self.c.Tr.LcCopySubmoduleNameToClipboard,
|
2020-09-30 00:27:23 +02:00
|
|
|
},
|
2021-05-28 12:02:19 +02:00
|
|
|
{
|
2021-05-28 13:32:55 +02:00
|
|
|
ViewName: "files",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.FILES_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.ToggleWhitespaceInDiffView),
|
|
|
|
Handler: self.toggleWhitespaceInDiffView,
|
|
|
|
Description: self.c.Tr.ToggleWhitespaceInDiffView,
|
2021-05-28 12:02:19 +02:00
|
|
|
},
|
2021-09-11 20:42:23 +02:00
|
|
|
{
|
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.IncreaseContextInDiffView),
|
|
|
|
Handler: self.IncreaseContextInDiffView,
|
|
|
|
Description: self.c.Tr.IncreaseContextInDiffView,
|
2021-09-11 20:42:23 +02:00
|
|
|
},
|
2021-09-11 19:35:17 +02:00
|
|
|
{
|
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.DecreaseContextInDiffView),
|
|
|
|
Handler: self.DecreaseContextInDiffView,
|
|
|
|
Description: self.c.Tr.DecreaseContextInDiffView,
|
2021-09-11 19:35:17 +02:00
|
|
|
},
|
2021-04-11 03:43:07 +02:00
|
|
|
{
|
|
|
|
ViewName: "extras",
|
|
|
|
Key: gocui.MouseWheelUp,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollUpExtra,
|
2021-04-11 03:43:07 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "extras",
|
|
|
|
Key: gocui.MouseWheelDown,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollDownExtra,
|
2021-04-11 03:43:07 +02:00
|
|
|
},
|
2021-04-11 07:01:49 +02:00
|
|
|
{
|
|
|
|
ViewName: "extras",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.ExtrasMenu),
|
|
|
|
Handler: self.handleCreateExtrasMenuPanel,
|
|
|
|
Description: self.c.Tr.LcOpenExtrasMenu,
|
2021-04-11 07:01:49 +02:00
|
|
|
OpensMenu: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "extras",
|
|
|
|
Tag: "navigation",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.COMMAND_LOG_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.PrevItemAlt),
|
2021-04-11 07:01:49 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollUpExtra,
|
2021-04-11 07:01:49 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "extras",
|
|
|
|
Tag: "navigation",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.COMMAND_LOG_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.PrevItem),
|
2021-04-11 07:01:49 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollUpExtra,
|
2021-04-11 07:01:49 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "extras",
|
|
|
|
Tag: "navigation",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.COMMAND_LOG_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.NextItem),
|
2021-04-11 07:01:49 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollDownExtra,
|
2021-04-11 07:01:49 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "extras",
|
|
|
|
Tag: "navigation",
|
2022-01-29 10:15:46 +02:00
|
|
|
Contexts: []string{string(context.COMMAND_LOG_CONTEXT_KEY)},
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.NextItemAlt),
|
2021-04-11 07:01:49 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.scrollDownExtra,
|
2021-04-11 07:01:49 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: "extras",
|
|
|
|
Tag: "navigation",
|
|
|
|
Key: gocui.MouseLeft,
|
|
|
|
Modifier: gocui.ModNone,
|
2022-02-06 06:54:26 +02:00
|
|
|
Handler: self.handleFocusCommandLog,
|
2021-04-11 07:01:49 +02:00
|
|
|
},
|
2018-08-08 11:18:41 +02:00
|
|
|
}
|
2018-08-09 15:26:31 +02:00
|
|
|
|
2022-02-05 05:42:56 +02:00
|
|
|
mouseKeybindings := []*gocui.ViewMouseBinding{}
|
2022-02-06 06:54:26 +02:00
|
|
|
for _, c := range self.State.Contexts.Flatten() {
|
2022-02-05 05:42:56 +02:00
|
|
|
viewName := c.GetViewName()
|
|
|
|
contextKey := c.GetKey()
|
2022-02-06 06:54:26 +02:00
|
|
|
for _, binding := range c.GetKeybindings(opts) {
|
2022-02-05 05:42:56 +02:00
|
|
|
// TODO: move all mouse keybindings into the mouse keybindings approach below
|
|
|
|
if !gocui.IsMouseKey(binding.Key) && contextKey != context.GLOBAL_CONTEXT_KEY {
|
|
|
|
binding.Contexts = []string{string(contextKey)}
|
|
|
|
}
|
2022-01-16 05:46:53 +02:00
|
|
|
binding.ViewName = viewName
|
|
|
|
bindings = append(bindings, binding)
|
|
|
|
}
|
2022-01-28 11:44:36 +02:00
|
|
|
|
2022-02-27 02:42:22 +02:00
|
|
|
mouseKeybindings = append(mouseKeybindings, c.GetMouseKeybindings(opts)...)
|
2022-01-28 11:44:36 +02:00
|
|
|
}
|
|
|
|
|
2022-03-24 13:07:30 +02:00
|
|
|
for _, viewName := range []string{"status", "branches", "files", "commits", "commitFiles", "subCommits", "stash", "menu"} {
|
2022-01-28 11:44:36 +02:00
|
|
|
bindings = append(bindings, []*types.Binding{
|
2022-02-06 06:54:26 +02:00
|
|
|
{ViewName: viewName, Key: opts.GetKey(opts.Config.Universal.PrevBlock), Modifier: gocui.ModNone, Handler: self.previousSideWindow},
|
|
|
|
{ViewName: viewName, Key: opts.GetKey(opts.Config.Universal.NextBlock), Modifier: gocui.ModNone, Handler: self.nextSideWindow},
|
|
|
|
{ViewName: viewName, Key: opts.GetKey(opts.Config.Universal.PrevBlockAlt), Modifier: gocui.ModNone, Handler: self.previousSideWindow},
|
|
|
|
{ViewName: viewName, Key: opts.GetKey(opts.Config.Universal.NextBlockAlt), Modifier: gocui.ModNone, Handler: self.nextSideWindow},
|
|
|
|
{ViewName: viewName, Key: opts.GetKey(opts.Config.Universal.PrevBlockAlt2), Modifier: gocui.ModNone, Handler: self.previousSideWindow},
|
|
|
|
{ViewName: viewName, Key: opts.GetKey(opts.Config.Universal.NextBlockAlt2), Modifier: gocui.ModNone, Handler: self.nextSideWindow},
|
2018-08-09 15:26:31 +02:00
|
|
|
}...)
|
|
|
|
}
|
|
|
|
|
2019-07-27 13:16:26 +02:00
|
|
|
// Appends keybindings to jump to a particular sideView using numbers
|
2021-10-18 11:06:03 +02:00
|
|
|
windows := []string{"status", "files", "branches", "commits", "stash"}
|
|
|
|
|
|
|
|
if len(config.Universal.JumpToBlock) != len(windows) {
|
2021-10-17 19:22:59 +02:00
|
|
|
log.Fatal("Jump to block keybindings cannot be set. Exactly 5 keybindings must be supplied.")
|
|
|
|
} else {
|
2021-10-18 11:06:03 +02:00
|
|
|
for i, window := range windows {
|
2022-01-28 11:44:36 +02:00
|
|
|
bindings = append(bindings, &types.Binding{
|
2021-10-17 19:22:59 +02:00
|
|
|
ViewName: "",
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.JumpToBlock[i]),
|
2021-10-17 19:22:59 +02:00
|
|
|
Modifier: gocui.ModNone,
|
2022-03-19 00:38:49 +02:00
|
|
|
Handler: self.goToSideWindow(window),
|
|
|
|
})
|
2021-10-17 19:22:59 +02:00
|
|
|
}
|
2019-07-27 13:16:26 +02:00
|
|
|
}
|
|
|
|
|
2022-02-06 06:54:26 +02:00
|
|
|
for viewName := range self.State.Contexts.InitialViewTabContextMap() {
|
2022-01-28 11:44:36 +02:00
|
|
|
bindings = append(bindings, []*types.Binding{
|
2020-10-01 23:32:48 +02:00
|
|
|
{
|
|
|
|
ViewName: viewName,
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.NextTab),
|
|
|
|
Handler: self.handleNextTab,
|
|
|
|
Description: self.c.Tr.LcNextTab,
|
2020-10-01 23:32:48 +02:00
|
|
|
Tag: "navigation",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
ViewName: viewName,
|
2022-02-06 06:54:26 +02:00
|
|
|
Key: opts.GetKey(opts.Config.Universal.PrevTab),
|
|
|
|
Handler: self.handlePrevTab,
|
|
|
|
Description: self.c.Tr.LcPrevTab,
|
2020-10-01 23:32:48 +02:00
|
|
|
Tag: "navigation",
|
|
|
|
},
|
|
|
|
}...)
|
|
|
|
}
|
|
|
|
|
2022-02-05 05:42:56 +02:00
|
|
|
return bindings, mouseKeybindings
|
2018-08-28 20:07:13 +02:00
|
|
|
}
|
|
|
|
|
2022-01-31 13:11:34 +02:00
|
|
|
func (gui *Gui) resetKeybindings() error {
|
|
|
|
gui.g.DeleteAllKeybindings()
|
|
|
|
|
2022-02-05 05:42:56 +02:00
|
|
|
bindings, mouseBindings := gui.GetInitialKeybindings()
|
|
|
|
|
|
|
|
// prepending because we want to give our custom keybindings precedence over default keybindings
|
2022-02-24 04:29:48 +02:00
|
|
|
customBindings, err := gui.CustomCommandsClient.GetCustomCommandKeybindings()
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
bindings = append(customBindings, bindings...)
|
2018-08-28 20:07:13 +02:00
|
|
|
|
2018-08-08 11:18:41 +02:00
|
|
|
for _, binding := range bindings {
|
2022-01-29 10:09:20 +02:00
|
|
|
if err := gui.SetKeybinding(binding); err != nil {
|
2018-08-08 11:18:41 +02:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
2019-11-13 14:18:31 +02:00
|
|
|
|
2022-02-05 05:42:56 +02:00
|
|
|
for _, binding := range mouseBindings {
|
|
|
|
if err := gui.SetMouseKeybinding(binding); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-16 05:46:53 +02:00
|
|
|
for viewName := range gui.State.Contexts.InitialViewTabContextMap() {
|
2020-10-02 12:05:45 +02:00
|
|
|
viewName := viewName
|
2020-09-30 00:27:12 +02:00
|
|
|
tabClickCallback := func(tabIndex int) error { return gui.onViewTabClick(viewName, tabIndex) }
|
2020-01-09 12:34:17 +02:00
|
|
|
|
2020-09-30 00:27:12 +02:00
|
|
|
if err := gui.g.SetTabClickBinding(viewName, tabClickCallback); err != nil {
|
2020-01-09 12:34:17 +02:00
|
|
|
return err
|
|
|
|
}
|
2019-11-13 14:18:31 +02:00
|
|
|
}
|
|
|
|
|
2019-02-16 03:07:27 +02:00
|
|
|
return nil
|
|
|
|
}
|
2022-01-29 10:09:20 +02:00
|
|
|
|
|
|
|
func (gui *Gui) wrappedHandler(f func() error) func(g *gocui.Gui, v *gocui.View) error {
|
|
|
|
return func(g *gocui.Gui, v *gocui.View) error {
|
|
|
|
return f()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (gui *Gui) SetKeybinding(binding *types.Binding) error {
|
|
|
|
handler := binding.Handler
|
2022-02-05 05:42:56 +02:00
|
|
|
// TODO: move all mouse-ey stuff into new mouse approach
|
|
|
|
if gocui.IsMouseKey(binding.Key) {
|
2022-01-29 10:09:20 +02:00
|
|
|
handler = func() error {
|
|
|
|
// we ignore click events on views that aren't popup panels, when a popup panel is focused
|
|
|
|
if gui.popupPanelFocused() && gui.currentViewName() != binding.ViewName {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return binding.Handler()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return gui.g.SetKeybinding(binding.ViewName, binding.Contexts, binding.Key, binding.Modifier, gui.wrappedHandler(handler))
|
|
|
|
}
|
|
|
|
|
2022-02-05 05:42:56 +02:00
|
|
|
// warning: mutates the binding
|
|
|
|
func (gui *Gui) SetMouseKeybinding(binding *gocui.ViewMouseBinding) error {
|
|
|
|
baseHandler := binding.Handler
|
|
|
|
newHandler := func(opts gocui.ViewMouseBindingOpts) error {
|
|
|
|
// we ignore click events on views that aren't popup panels, when a popup panel is focused
|
|
|
|
if gui.popupPanelFocused() && gui.currentViewName() != binding.ViewName {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return baseHandler(opts)
|
2022-01-30 11:34:59 +02:00
|
|
|
}
|
2022-02-05 05:42:56 +02:00
|
|
|
binding.Handler = newHandler
|
|
|
|
|
|
|
|
return gui.g.SetViewClickBinding(binding)
|
2022-01-29 10:09:20 +02:00
|
|
|
}
|