diff --git a/src/tt/tui/editor.py b/src/tt/tui/editor.py index 32a10c2..64759fa 100644 --- a/src/tt/tui/editor.py +++ b/src/tt/tui/editor.py @@ -15,6 +15,8 @@ from ..utils import ( ) from .keymodal import KeyModal +ELLIPSIS = "…" + class NotifyValidationError(Exception): """will notify and continue if raised""" @@ -213,7 +215,7 @@ class TableEditor(App): new_item = self.add_item_callback(**prepopulated) self.refresh_data(restore_cursor=False) - self.move_cursor_to_item(new_item.id) + self.move_cursor_to_item(new_item.id) # TODO: check success here self.action_start_change() def _active_column_config(self): @@ -307,6 +309,10 @@ class TableEditor(App): current_value = self.table.get_cell_at( (self.table.cursor_row, self.table.cursor_column) ) + if current_value.endswith(ELLIPSIS): + # TODO: flash message? + # need to edit with e + return current_value = remove_rich_tag(current_value) self._show_input("edit", current_value) diff --git a/src/tt/tui/tasks.py b/src/tt/tui/tasks.py index 5e4ac41..309fdc8 100644 --- a/src/tt/tui/tasks.py +++ b/src/tt/tui/tasks.py @@ -20,6 +20,7 @@ from .editor import ( TableEditor, TableColumnConfig, NotifyValidationError, + ELLIPSIS, ) @@ -112,9 +113,14 @@ class TT(TableEditor): status = get_colored_status(item.status) due = get_colored_date(item.due) + if "\n" in item.text: + text = item.text.split("\n")[0] + ELLIPSIS + else: + text = item.text + self.table.add_row( str(item.id), - item.text.split("\n")[0], # first line + text, status, item.type, due,