mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-18 06:25:13 +02:00
Improve performance when pasting large amounts of text into readline by not redrawing on every char
This commit is contained in:
@@ -61,6 +61,7 @@ type Loop struct {
|
||||
OnKeyEvent func(event *KeyEvent) error
|
||||
|
||||
// Called when text is received either from a key event or directly from the terminal
|
||||
// Called with an empty string when bracketed paste ends
|
||||
OnText func(text string, from_key_event bool, in_bracketed_paste bool) error
|
||||
|
||||
// Called when the terminal is resized
|
||||
|
||||
@@ -31,6 +31,7 @@ func new_loop() *Loop {
|
||||
l.escape_code_parser.HandleSOS = l.handle_sos
|
||||
l.escape_code_parser.HandlePM = l.handle_pm
|
||||
l.escape_code_parser.HandleRune = l.handle_rune
|
||||
l.escape_code_parser.HandleEndOfBracketedPaste = l.handle_end_of_bracketed_paste
|
||||
return &l
|
||||
}
|
||||
|
||||
@@ -128,6 +129,12 @@ func (self *Loop) handle_rune(raw rune) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *Loop) handle_end_of_bracketed_paste() {
|
||||
if self.OnText != nil {
|
||||
self.OnText("", false, false)
|
||||
}
|
||||
}
|
||||
|
||||
func (self *Loop) on_signal(s unix.Signal) error {
|
||||
switch s {
|
||||
case unix.SIGINT:
|
||||
|
||||
Reference in New Issue
Block a user