mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-22 00:08:04 +02:00
Do not blink cursor while keys are being pressed
This commit is contained in:
@@ -67,6 +67,7 @@ class Boss(Thread):
|
|||||||
def __init__(self, glfw_window, opts, args):
|
def __init__(self, glfw_window, opts, args):
|
||||||
Thread.__init__(self, name='ChildMonitor')
|
Thread.__init__(self, name='ChildMonitor')
|
||||||
startup_session = create_session(opts, args)
|
startup_session = create_session(opts, args)
|
||||||
|
self.cursor_blink_zero_time = monotonic()
|
||||||
self.cursor_blinking = True
|
self.cursor_blinking = True
|
||||||
self.glfw_window_title = None
|
self.glfw_window_title = None
|
||||||
self.action_queue = Queue()
|
self.action_queue = Queue()
|
||||||
@@ -255,6 +256,7 @@ class Boss(Thread):
|
|||||||
def on_key(self, window, key, scancode, action, mods):
|
def on_key(self, window, key, scancode, action, mods):
|
||||||
is_key_pressed[key] = action == GLFW_PRESS
|
is_key_pressed[key] = action == GLFW_PRESS
|
||||||
self.start_cursor_blink()
|
self.start_cursor_blink()
|
||||||
|
self.cursor_blink_zero_time = monotonic()
|
||||||
if action == GLFW_PRESS or action == GLFW_REPEAT:
|
if action == GLFW_PRESS or action == GLFW_REPEAT:
|
||||||
func = get_shortcut(self.opts.keymap, mods, key)
|
func = get_shortcut(self.opts.keymap, mods, key)
|
||||||
if func is not None:
|
if func is not None:
|
||||||
@@ -389,7 +391,7 @@ class Boss(Thread):
|
|||||||
if rd is not None:
|
if rd is not None:
|
||||||
draw_cursor = True
|
draw_cursor = True
|
||||||
if self.cursor_blinking and self.opts.cursor_blink_interval > 0:
|
if self.cursor_blinking and self.opts.cursor_blink_interval > 0:
|
||||||
now = monotonic()
|
now = monotonic() - self.cursor_blink_zero_time
|
||||||
t = int(now * 1000)
|
t = int(now * 1000)
|
||||||
d = int(self.opts.cursor_blink_interval * 1000)
|
d = int(self.opts.cursor_blink_interval * 1000)
|
||||||
n = t // d
|
n = t // d
|
||||||
|
|||||||
Reference in New Issue
Block a user