Ignore pasted input while in Normal mode (#2059)
This commit is contained in:
1 parent
5b2d5ad99d
commit
5e24fd93d2
2 files changed
+12
No files matched your search
@@ -664,6 +664,7 @@ type ui struct {
|
||||
styles styleMap
|
||||
icons iconMap
|
||||
currentFile string
|
||||
pasteEvent bool
|
||||
}
|
||||
|
||||
func newUI(screen tcell.Screen) *ui {
|
||||
@@ -1398,6 +1399,10 @@ func (ui *ui) readNormalEvent(ev tcell.Event, nav *nav) expr {
|
||||
|
||||
switch tev := ev.(type) {
|
||||
case *tcell.EventKey:
|
||||
if ui.pasteEvent {
|
||||
return nil
|
||||
}
|
||||
|
||||
// KeyRune is a regular character
|
||||
if tev.Key() == tcell.KeyRune {
|
||||
switch {
|
||||
@@ -1577,6 +1582,12 @@ func (ui *ui) readNormalEvent(ev tcell.Event, nav *nav) expr {
|
||||
} else {
|
||||
return &callExpr{"on-focus-lost", nil, 1}
|
||||
}
|
||||
case *tcell.EventPaste:
|
||||
if tev.Start() {
|
||||
ui.pasteEvent = true
|
||||
} else if tev.End() {
|
||||
ui.pasteEvent = false
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user