protect long notes from quick edit
This commit is contained in:
parent
525f29aa7a
commit
4110d93b1e
@ -15,6 +15,8 @@ from ..utils import (
|
|||||||
)
|
)
|
||||||
from .keymodal import KeyModal
|
from .keymodal import KeyModal
|
||||||
|
|
||||||
|
ELLIPSIS = "…"
|
||||||
|
|
||||||
|
|
||||||
class NotifyValidationError(Exception):
|
class NotifyValidationError(Exception):
|
||||||
"""will notify and continue if raised"""
|
"""will notify and continue if raised"""
|
||||||
@ -213,7 +215,7 @@ class TableEditor(App):
|
|||||||
|
|
||||||
new_item = self.add_item_callback(**prepopulated)
|
new_item = self.add_item_callback(**prepopulated)
|
||||||
self.refresh_data(restore_cursor=False)
|
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()
|
self.action_start_change()
|
||||||
|
|
||||||
def _active_column_config(self):
|
def _active_column_config(self):
|
||||||
@ -307,6 +309,10 @@ class TableEditor(App):
|
|||||||
current_value = self.table.get_cell_at(
|
current_value = self.table.get_cell_at(
|
||||||
(self.table.cursor_row, self.table.cursor_column)
|
(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)
|
current_value = remove_rich_tag(current_value)
|
||||||
self._show_input("edit", current_value)
|
self._show_input("edit", current_value)
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ from .editor import (
|
|||||||
TableEditor,
|
TableEditor,
|
||||||
TableColumnConfig,
|
TableColumnConfig,
|
||||||
NotifyValidationError,
|
NotifyValidationError,
|
||||||
|
ELLIPSIS,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -112,9 +113,14 @@ class TT(TableEditor):
|
|||||||
status = get_colored_status(item.status)
|
status = get_colored_status(item.status)
|
||||||
due = get_colored_date(item.due)
|
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(
|
self.table.add_row(
|
||||||
str(item.id),
|
str(item.id),
|
||||||
item.text.split("\n")[0], # first line
|
text,
|
||||||
status,
|
status,
|
||||||
item.type,
|
item.type,
|
||||||
due,
|
due,
|
||||||
|
Loading…
Reference in New Issue
Block a user