mirror of
https://github.com/aditya-K2/gspt.git
synced 2026-01-09 13:58:05 -05:00
Visual Mode can now be disabled
This commit is contained in:
@@ -22,10 +22,11 @@ type _range struct {
|
||||
}
|
||||
|
||||
type interactiveView struct {
|
||||
visual bool
|
||||
vrange *_range
|
||||
baseSel int
|
||||
Table *tview.Table
|
||||
visual bool
|
||||
disableVisual bool
|
||||
vrange *_range
|
||||
baseSel int
|
||||
Table *tview.Table
|
||||
}
|
||||
|
||||
func NewInteractiveView() *interactiveView {
|
||||
@@ -48,6 +49,10 @@ func NewInteractiveView() *interactiveView {
|
||||
return i
|
||||
}
|
||||
|
||||
func (i *interactiveView) DisableVisualMode(disable bool) {
|
||||
i.disableVisual = disable
|
||||
}
|
||||
|
||||
func (i *interactiveView) SelectionHandler(selrow int) {
|
||||
if i.visual {
|
||||
i.toggleVisualMode()
|
||||
@@ -181,7 +186,9 @@ func (i *interactiveView) capture(e *tcell.EventKey) *tcell.EventKey {
|
||||
}
|
||||
case 'v':
|
||||
{
|
||||
i.toggleVisualMode()
|
||||
if !i.disableVisual {
|
||||
i.toggleVisualMode()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
case 'g':
|
||||
@@ -199,7 +206,9 @@ func (i *interactiveView) capture(e *tcell.EventKey) *tcell.EventKey {
|
||||
default:
|
||||
{
|
||||
if e.Key() == tcell.KeyEscape {
|
||||
return i.getHandler("exitvisual")(e)
|
||||
if !i.disableVisual {
|
||||
return i.getHandler("exitvisual")(e)
|
||||
}
|
||||
} else if GetCurrentView().ExternalInputCapture() != nil {
|
||||
return GetCurrentView().ExternalInputCapture()(e)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user