Skip to content

Commit f9c4dff

Browse files
committed
Don't allow pasting into non-editable views
My assumption is that pressing command-V on a non-editable view is always a mistake; it would execute arbitrary commands depending on what's in the clipboard, so prevent it.
1 parent 2fa292e commit f9c4dff

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: gui.go

+4
Original file line numberDiff line numberDiff line change
@@ -1489,6 +1489,10 @@ func (g *Gui) execKeybindings(v *View, ev *GocuiEvent) error {
14891489
var globalKb *keybinding
14901490
var matchingParentViewKb *keybinding
14911491

1492+
if g.IsPasting && v != nil && !v.Editable {
1493+
return nil
1494+
}
1495+
14921496
// if we're searching, and we've hit n/N/Esc, we ignore the default keybinding
14931497
if v != nil && v.IsSearching() && ev.Mod == ModNone {
14941498
if eventMatchesKey(ev, g.NextSearchMatchKey) {

0 commit comments

Comments
 (0)