mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-14 12:34:44 +02:00
Work on supporting mouse interactions via simple hyperlinks
This commit is contained in:
@@ -70,6 +70,7 @@ func main() (rc int, err error) {
|
||||
lp.SetCursorVisible(true)
|
||||
return ``
|
||||
}
|
||||
lp.OnMouseEvent = h.on_mouse_event
|
||||
lp.OnResize = func(_, _ loop.ScreenSize) error {
|
||||
return h.draw_screen()
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"kitty/tools/tui"
|
||||
"kitty/tools/tui/loop"
|
||||
"kitty/tools/tui/readline"
|
||||
"kitty/tools/utils"
|
||||
@@ -30,6 +31,7 @@ type handler struct {
|
||||
state State
|
||||
err_mutex sync.Mutex
|
||||
err_in_worker_thread error
|
||||
mouse_state tui.MouseState
|
||||
|
||||
// Listing
|
||||
rl *readline.Readline
|
||||
@@ -278,6 +280,10 @@ func (h *handler) on_wakeup() (err error) {
|
||||
return h.draw_screen()
|
||||
}
|
||||
|
||||
func (h *handler) on_mouse_event(event *loop.MouseEvent) (err error) {
|
||||
return h.mouse_state.UpdateState(event)
|
||||
}
|
||||
|
||||
func (h *handler) on_key_event(event *loop.KeyEvent) (err error) {
|
||||
if event.MatchesPressOrRepeat("ctrl+c") {
|
||||
event.Handled = true
|
||||
|
||||
Reference in New Issue
Block a user