mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-05-13 16:37:27 +00:00
Micro-optimization
This commit is contained in:
parent
06afce07ac
commit
d22244d135
2 changed files with 5 additions and 5 deletions
|
|
@ -218,8 +218,7 @@ func pixel_to_cell(px, length, cell_length int) int {
|
|||
return 0
|
||||
}
|
||||
|
||||
func decode_sgr_mouse(text string, screen_size ScreenSize) *MouseEvent {
|
||||
last_letter := text[len(text)-1]
|
||||
func decode_sgr_mouse(text string, screen_size ScreenSize, last_letter byte) *MouseEvent {
|
||||
text = text[:len(text)-1]
|
||||
parts := strings.Split(text, ";")
|
||||
if len(parts) != 3 {
|
||||
|
|
@ -276,8 +275,10 @@ func MouseEventFromCSI(csi string, screen_size ScreenSize) *MouseEvent {
|
|||
if last_char != 'm' && last_char != 'M' {
|
||||
return nil
|
||||
}
|
||||
if !strings.HasPrefix(csi, "<") {
|
||||
switch csi[0] {
|
||||
case '<':
|
||||
return decode_sgr_mouse(csi[1:], screen_size, last_char)
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
return decode_sgr_mouse(csi[1:], screen_size)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,6 @@ func (self *Loop) handle_csi(raw []byte) (err error) {
|
|||
return self.OnFocusChange(csi == "I")
|
||||
}
|
||||
return nil
|
||||
|
||||
}
|
||||
ke := KeyEventFromCSI(csi)
|
||||
if ke != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue