mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Micro-optimization
This commit is contained in:
@@ -218,8 +218,7 @@ func pixel_to_cell(px, length, cell_length int) int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func decode_sgr_mouse(text string, screen_size ScreenSize) *MouseEvent {
|
func decode_sgr_mouse(text string, screen_size ScreenSize, last_letter byte) *MouseEvent {
|
||||||
last_letter := text[len(text)-1]
|
|
||||||
text = text[:len(text)-1]
|
text = text[:len(text)-1]
|
||||||
parts := strings.Split(text, ";")
|
parts := strings.Split(text, ";")
|
||||||
if len(parts) != 3 {
|
if len(parts) != 3 {
|
||||||
@@ -276,8 +275,10 @@ func MouseEventFromCSI(csi string, screen_size ScreenSize) *MouseEvent {
|
|||||||
if last_char != 'm' && last_char != 'M' {
|
if last_char != 'm' && last_char != 'M' {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if !strings.HasPrefix(csi, "<") {
|
switch csi[0] {
|
||||||
|
case '<':
|
||||||
|
return decode_sgr_mouse(csi[1:], screen_size, last_char)
|
||||||
|
default:
|
||||||
return nil
|
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 self.OnFocusChange(csi == "I")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
ke := KeyEventFromCSI(csi)
|
ke := KeyEventFromCSI(csi)
|
||||||
if ke != nil {
|
if ke != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user