fix: Disable key debounce for text input entry and typing
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
25
tui.py
25
tui.py
@@ -44,6 +44,9 @@ class Screen:
|
||||
except:
|
||||
return None
|
||||
|
||||
def is_entry_key(self, c):
|
||||
return False
|
||||
|
||||
def try_highlight(self, c):
|
||||
if c and time.time() - self.state.highlight_debounce > 0.6:
|
||||
self.state.highlight_debounce = time.time()
|
||||
@@ -394,6 +397,10 @@ class SignScreen(Screen):
|
||||
self.sign_to_send = '_'
|
||||
else: self.try_highlight(c)
|
||||
|
||||
def is_entry_key(self, c):
|
||||
button = self.get_button(c)
|
||||
return not self.is_typing and button == 'e'
|
||||
|
||||
class ProtovacSignScreen(Screen):
|
||||
def draw(self):
|
||||
self.stdscr.addstr(0, 1, 'PROTOVAC UNIVERSAL COMPUTER')
|
||||
@@ -541,6 +548,10 @@ class NametagScreen(Screen):
|
||||
elif button == 'g': self.nametag_guest = '_'
|
||||
else: self.try_highlight(c)
|
||||
|
||||
def is_entry_key(self, c):
|
||||
button = self.get_button(c)
|
||||
return not (self.nametag_member or self.nametag_guest) and button in ['m', 'g']
|
||||
|
||||
class LabelScreen(Screen):
|
||||
# This screen is complex, breaking it down into sub-states
|
||||
def __init__(self, state, stdscr):
|
||||
@@ -688,6 +699,12 @@ class LabelScreen(Screen):
|
||||
else: self.try_highlight(c)
|
||||
else: self.try_highlight(c)
|
||||
|
||||
def is_entry_key(self, c):
|
||||
if self.sub_screen == 'menu':
|
||||
button = self.get_button(c)
|
||||
return button in ['t', 's', 'g', 'c', 'f']
|
||||
return False
|
||||
|
||||
|
||||
class GamesScreen(Screen):
|
||||
def draw(self):
|
||||
@@ -785,6 +802,10 @@ I will be terse in my responses.''')]
|
||||
elif button == 'e': self.is_typing = True; self.message_to_send = '_'
|
||||
else: self.try_highlight(c)
|
||||
|
||||
def is_entry_key(self, c):
|
||||
button = self.get_button(c)
|
||||
return not self.is_typing and button == 'e'
|
||||
|
||||
|
||||
class ThinkScreen(Screen):
|
||||
def __init__(self, state, stdscr):
|
||||
@@ -855,6 +876,10 @@ class ThinkScreen(Screen):
|
||||
elif button == 'e': self.is_typing = True; self.think_to_send = '_'
|
||||
else: self.try_highlight(c)
|
||||
|
||||
def is_entry_key(self, c):
|
||||
button = self.get_button(c)
|
||||
return not self.is_typing and button == 'e'
|
||||
|
||||
class AboutScreen(Screen):
|
||||
def draw(self):
|
||||
self.stdscr.addstr(0, 1, 'PROTOVAC UNIVERSAL COMPUTER')
|
||||
|
||||
Reference in New Issue
Block a user