fix: Clear line artifacts in Nametag, Label, Message, and Think screens

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-03-04 16:47:49 -07:00
parent d8886e80db
commit c58a356c02

58
tui.py
View File

@@ -492,13 +492,21 @@ class NametagScreen(Screen):
if self.nametag_member:
self.stdscr.addstr(8, 4, 'Enter your name: ' + self.nametag_member)
self.stdscr.clrtoeol()
self.stdscr.move(10, 4)
self.stdscr.clrtoeol()
self.stdscr.addstr(23, 1, '[RETURN] Print [ESC] Cancel')
elif self.nametag_guest:
self.stdscr.move(8, 4)
self.stdscr.clrtoeol()
self.stdscr.addstr(10, 4, 'Enter your name: ' + self.nametag_guest)
self.stdscr.clrtoeol()
self.stdscr.addstr(23, 1, '[RETURN] Print [ESC] Cancel')
else:
self.stdscr.addstr(8, 4, '[M] Member nametag', curses.A_REVERSE if self.state.highlight_keys else 0)
self.stdscr.clrtoeol()
self.stdscr.addstr(10, 4, '[G] Guest nametag', curses.A_REVERSE if self.state.highlight_keys else 0)
self.stdscr.clrtoeol()
self.stdscr.addstr(23, 1, '[B] Back', curses.A_REVERSE if self.state.highlight_keys else 0)
self.stdscr.clrtoeol()
@@ -568,29 +576,35 @@ class LabelScreen(Screen):
# Drawing logic for different sub-screens
if self.sub_screen == 'menu':
self.stdscr.addstr(8, 4, '[T] Tool label', curses.A_REVERSE if self.state.highlight_keys else 0)
self.stdscr.addstr(10, 4, '[S] Sheet material', curses.A_REVERSE if self.state.highlight_keys else 0)
self.stdscr.addstr(12, 4, '[G] Generic label', curses.A_REVERSE if self.state.highlight_keys else 0)
self.stdscr.addstr(14, 4, '[F] Forum thread', curses.A_REVERSE if self.state.highlight_keys else 0)
self.stdscr.addstr(8, 4, '[T] Tool label', curses.A_REVERSE if self.state.highlight_keys else 0); self.stdscr.clrtoeol()
self.stdscr.addstr(10, 4, '[S] Sheet material', curses.A_REVERSE if self.state.highlight_keys else 0); self.stdscr.clrtoeol()
self.stdscr.addstr(12, 4, '[G] Generic label', curses.A_REVERSE if self.state.highlight_keys else 0); self.stdscr.clrtoeol()
self.stdscr.addstr(14, 4, '[F] Forum thread', curses.A_REVERSE if self.state.highlight_keys else 0); self.stdscr.clrtoeol()
self.stdscr.addstr(23, 1, '[B] Back', curses.A_REVERSE if self.state.highlight_keys else 0)
elif self.sub_screen == 'tool':
self.stdscr.addstr(8, 4, 'Enter Wiki-ID tool number: ' + self.label_tool)
self.stdscr.addstr(8, 4, 'Enter Wiki-ID tool number: ' + self.label_tool); self.stdscr.clrtoeol()
for i in [10, 12, 14]: self.stdscr.move(i, 4); self.stdscr.clrtoeol()
self.stdscr.addstr(23, 1, '[RETURN] Print [ESC] Cancel')
elif self.sub_screen == 'material_name':
self.stdscr.addstr(10, 4, 'Enter your name: ' + self.label_material_name)
self.stdscr.addstr(10, 4, 'Enter your name: ' + self.label_material_name); self.stdscr.clrtoeol()
for i in [8, 12, 14]: self.stdscr.move(i, 4); self.stdscr.clrtoeol()
self.stdscr.addstr(23, 1, '[RETURN] Next [ESC] Cancel')
elif self.sub_screen == 'material_contact':
self.stdscr.addstr(10, 4, 'Enter your name: ' + self.label_material_name[:-1])
self.stdscr.addstr(12, 4, 'Enter your contact info: ' + self.label_material_contact)
self.stdscr.addstr(10, 4, 'Enter your name: ' + self.label_material_name[:-1]); self.stdscr.clrtoeol()
self.stdscr.addstr(12, 4, 'Enter your contact info: ' + self.label_material_contact); self.stdscr.clrtoeol()
for i in [8, 14]: self.stdscr.move(i, 4); self.stdscr.clrtoeol()
self.stdscr.addstr(23, 1, '[RETURN] Print [ESC] Cancel')
elif self.sub_screen == 'generic':
self.stdscr.addstr(12, 4, 'Enter your message: ' + self.label_generic)
self.stdscr.addstr(12, 4, 'Enter your message: ' + self.label_generic); self.stdscr.clrtoeol()
for i in [8, 10, 14]: self.stdscr.move(i, 4); self.stdscr.clrtoeol()
self.stdscr.addstr(23, 1, '[RETURN] Print [ESC] Cancel')
elif self.sub_screen == 'consumable':
self.stdscr.addstr(12, 4, 'Enter the item: ' + self.label_consumable)
self.stdscr.addstr(12, 4, 'Enter the item: ' + self.label_consumable); self.stdscr.clrtoeol()
for i in [8, 10, 14]: self.stdscr.move(i, 4); self.stdscr.clrtoeol()
self.stdscr.addstr(23, 1, '[RETURN] Print [ESC] Cancel')
elif self.sub_screen == 'forum_search':
self.stdscr.addstr(14, 4, 'Search for a thread: ' + self.label_forum_search)
self.stdscr.addstr(14, 4, 'Search for a thread: ' + self.label_forum_search); self.stdscr.clrtoeol()
for i in [8, 10, 12]: self.stdscr.move(i, 4); self.stdscr.clrtoeol()
self.stdscr.addstr(23, 1, '[RETURN] Search [ESC] Cancel')
elif self.sub_screen == 'forum_results':
if self.search_results is not None:
@@ -741,9 +755,11 @@ I will be terse in my responses.''')]
self.stdscr.addstr(num + 5, 1, line)
if self.is_typing:
self.stdscr.addstr(21, 21, self.message_to_send)
self.stdscr.clrtoeol()
self.stdscr.addstr(23, 1, '[RETURN] Send [ESC] Cancel')
else:
self.stdscr.addstr(21, 21, '[E] Edit message', curses.A_REVERSE if self.state.highlight_keys else 0)
self.stdscr.clrtoeol()
self.stdscr.addstr(23, 1, '[B] Back', curses.A_REVERSE if self.state.highlight_keys else 0)
self.stdscr.clrtoeol()
@@ -788,14 +804,30 @@ class ThinkScreen(Screen):
self.stdscr.addstr(5, 1, 'Give Protovac something to think about.')
if self.is_typing:
self.stdscr.addstr(7, 4, self.think_to_send)
self.stdscr.clrtoeol()
for i in range(9, 19):
self.stdscr.move(i, 1)
self.stdscr.clrtoeol()
self.stdscr.addstr(23, 1, '[RETURN] Send [ESC] Cancel')
elif self.think_result:
self.stdscr.move(7, 4)
self.stdscr.clrtoeol()
for i in range(11, 19):
self.stdscr.move(i, 1)
self.stdscr.clrtoeol()
for _ in range(100):
try: self.stdscr.addstr(9, 4, self.think_result); break
except: self.think_result = self.think_result[:-5]
try:
self.stdscr.addstr(9, 4, self.think_result)
break
except:
self.think_result = self.think_result[:-5]
self.stdscr.clrtoeol()
self.stdscr.addstr(23, 1, '[B] Back', curses.A_REVERSE if self.state.highlight_keys else 0)
else:
self.stdscr.addstr(7, 4, '[E] Edit prompt', curses.A_REVERSE if self.state.highlight_keys else 0)
self.stdscr.clrtoeol()
self.stdscr.move(9, 1)
self.stdscr.clrtoeol()
self.stdscr.addstr(23, 1, '[B] Back', curses.A_REVERSE if self.state.highlight_keys else 0)
self.stdscr.addstr(9, 1, 'Examples:')
self.stdscr.addstr(11, 4, '42 + 69'); self.stdscr.addstr(12, 4, '55 kg to lbs')