mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-26 10:12:17 +02:00
...
This commit is contained in:
@@ -65,12 +65,19 @@ func shell_loop(rl *readline.Readline, kill_if_signaled bool) (int, error) {
|
||||
return err
|
||||
}
|
||||
if event.Handled {
|
||||
rl.Redraw()
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
lp.OnText = rl.OnText
|
||||
lp.OnText = func(text string, from_key_event, in_bracketed_paste bool) error {
|
||||
err := rl.OnText(text, from_key_event, in_bracketed_paste)
|
||||
if err == nil {
|
||||
rl.Redraw()
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
err = lp.Run()
|
||||
if err != nil {
|
||||
|
||||
@@ -49,7 +49,7 @@ func (self *Loop) print_stack() {
|
||||
}
|
||||
|
||||
func (self *Loop) update_screen_size() error {
|
||||
if self.controlling_term != nil {
|
||||
if self.controlling_term == nil {
|
||||
return fmt.Errorf("No controlling terminal cannot update screen size")
|
||||
}
|
||||
ws, err := self.controlling_term.GetSize()
|
||||
@@ -237,6 +237,9 @@ func (self *Loop) run() (err error) {
|
||||
r_w.Close()
|
||||
close(tty_reading_done_channel)
|
||||
|
||||
if self.OnFinalize != nil {
|
||||
finalizer += self.OnFinalize()
|
||||
}
|
||||
if finalizer != "" {
|
||||
self.QueueWriteString(finalizer)
|
||||
}
|
||||
|
||||
@@ -53,6 +53,10 @@ func (self *Readline) redraw() {
|
||||
}
|
||||
self.loop.MoveCursorVertically(-y + line_with_cursor)
|
||||
line := self.lines[self.cursor.Y]
|
||||
line_with_cursor += self.move_cursor_to_text_position(wcswidth.Stringwidth(line[:self.cursor.X]), int(screen_size.WidthCells))
|
||||
plen := self.prompt_len
|
||||
if self.cursor.Y > 0 {
|
||||
plen = self.continuation_prompt_len
|
||||
}
|
||||
line_with_cursor += self.move_cursor_to_text_position(plen+wcswidth.Stringwidth(line[:self.cursor.X]), int(screen_size.WidthCells))
|
||||
self.cursor_y = line_with_cursor
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user