Use tcell's EventPaste to capture paste from the OS
This commit uses the recent commit to zyedidia/tcell to capture paste events from the OS. Fixes #60 Fixes #61
This commit is contained in:
parent
4ca6e65197
commit
07d8a08422
1 changed files with 9 additions and 0 deletions
|
@ -268,6 +268,15 @@ func (v *View) HandleEvent(event tcell.Event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case *tcell.EventPaste:
|
||||||
|
if v.cursor.HasSelection() {
|
||||||
|
v.cursor.DeleteSelection()
|
||||||
|
v.cursor.ResetSelection()
|
||||||
|
}
|
||||||
|
clip := e.Text()
|
||||||
|
v.eh.Insert(v.cursor.Loc(), clip)
|
||||||
|
v.cursor.SetLoc(v.cursor.Loc() + Count(clip))
|
||||||
|
v.freshClip = false
|
||||||
case *tcell.EventMouse:
|
case *tcell.EventMouse:
|
||||||
x, y := e.Position()
|
x, y := e.Position()
|
||||||
x -= v.lineNumOffset - v.leftCol
|
x -= v.lineNumOffset - v.leftCol
|
||||||
|
|
Loading…
Reference in a new issue