diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/options.go | 2 | ||||
| -rw-r--r-- | src/terminal.go | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/options.go b/src/options.go index fc614c5b..8f1a5d6c 100644 --- a/src/options.go +++ b/src/options.go @@ -654,6 +654,8 @@ func parseKeyChordsImpl(str string, message string, exit func(string)) map[tui.E add(tui.Focus) case "result": add(tui.Result) + case "resize": + add(tui.Resize) case "one": add(tui.One) case "zero": diff --git a/src/terminal.go b/src/terminal.go index b5763aba..730e5a51 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -253,6 +253,7 @@ type Terminal struct { hasResultActions bool hasFocusActions bool hasLoadActions bool + hasResizeActions bool triggerLoad bool reading bool running bool @@ -533,7 +534,6 @@ func defaultKeymap() map[tui.Event][]*action { } add(tui.Invalid, actInvalid) - add(tui.Resize, actClearScreen) add(tui.CtrlA, actBeginningOfLine) add(tui.CtrlB, actBackwardChar) add(tui.CtrlC, actAbort) @@ -773,7 +773,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal { killChan: make(chan int), serverInputChan: make(chan []*action, 10), serverOutputChan: make(chan string), - eventChan: make(chan tui.Event, 5), // (load + result + zero|one) | (focus) | (GetChar) + eventChan: make(chan tui.Event, 6), // (load + result + zero|one) | (focus) | (resize) | (GetChar) tui: renderer, initFunc: func() { renderer.Init() }, executing: util.NewAtomicBool(false), @@ -817,6 +817,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal { } } + _, t.hasResizeActions = t.keymap[tui.Resize.AsEvent()] _, t.hasResultActions = t.keymap[tui.Result.AsEvent()] _, t.hasFocusActions = t.keymap[tui.Focus.AsEvent()] _, t.hasLoadActions = t.keymap[tui.Load.AsEvent()] @@ -3129,6 +3130,9 @@ func (t *Terminal) Loop() { if wasHidden && t.hasPreviewWindow() { refreshPreview(t.previewOpts.command) } + if req == reqResize && t.hasResizeActions { + t.eventChan <- tui.Resize.AsEvent() + } case reqClose: exit(func() int { if t.output() { @@ -3211,7 +3215,7 @@ func (t *Terminal) Loop() { } select { case event = <-t.eventChan: - needBarrier = !event.Is(tui.Load, tui.Result, tui.Focus, tui.One, tui.Zero) + needBarrier = !event.Is(tui.Load, tui.Result, tui.Focus, tui.One, tui.Zero, tui.Resize) case serverActions := <-t.serverInputChan: event = tui.Invalid.AsEvent() if t.listenAddr == nil || t.listenAddr.IsLocal() || t.listenUnsafe { |
