diff --git a/README.md b/README.md index b2a51d9..4327813 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ Options: | / | Search for a sequence | | Alt+g/Alt+Shift+g | Select all todos above/below | | Alt+k/j | Move todo up and down | +| Backspace | Combine with previous todo | | Ctrl+a | Select all todos | | Ctrl+r | Redo change | | Ctrl+x, k | Toggle `toggle` and `entry` modes | @@ -80,6 +81,7 @@ Options: | Shift+k/j | Select/deselect multiple todos | | Shift+o | Add a todo on current line | | Tab/Shift+Tab | Indent/unindent selected todo | +| a | Display selected todo as an alert | | b | Make selected todo bigger (magnify) | | c | Change selected todo color | | d | Remove selected todo | diff --git a/src/get_args.py b/src/get_args.py index 765dad4..634487a 100644 --- a/src/get_args.py +++ b/src/get_args.py @@ -8,7 +8,7 @@ from src.working_initscr import wrapper CONTROLS_BEGIN_INDEX: int = 68 -CONTROLS_END_INDEX: int = 96 +CONTROLS_END_INDEX: int = 98 _DEFAULT_BULLETS: bool = False _DEFAULT_ENUMERATE: bool = False diff --git a/src/keys.py b/src/keys.py index 17bb533..bf8e10b 100644 --- a/src/keys.py +++ b/src/keys.py @@ -50,6 +50,7 @@ class Key: K = 75 O = 79 indent_dedent = 90 + a = 97 b = 98 c = 99 d = 100 diff --git a/src/menus.py b/src/menus.py index 4360347..a1ba14c 100644 --- a/src/menus.py +++ b/src/menus.py @@ -326,7 +326,7 @@ def alert(stdscr: curses.window, message: str) -> int: Press any key to close (pressed key is returned). """ - set_header(stdscr, "Alert!") + set_header(stdscr, "Alert! Press any key to close") stdscr.refresh() border_width = 2 max_y, max_x = stdscr.getmaxyx() diff --git a/todo.py b/todo.py index 4efb16b..7e04190 100755 --- a/todo.py +++ b/todo.py @@ -27,6 +27,7 @@ from src.io import file_string_to_todos, read_file, update_file from src.keys import Key from src.menus import ( + alert, color_menu, get_newwin, help_menu, @@ -405,6 +406,12 @@ def _handle_enter( return selected.todo_set_to(new_todo_next(stdscr, todos, int(selected), mode=mode)) +def _handle_alert(stdscr: curses.window, todos: Todos, selected: int) -> None: + """Display the selected todo in an alert window""" + + alert(stdscr, todos[selected].get_display_text()) + + def _print_history(history: UndoRedo) -> None: """Print passed in `history` to `HISTORY_FILE` if `PRINT_HISTORY` is enabled""" if PRINT_HISTORY: @@ -431,8 +438,8 @@ def _get_main_input( stdscr: curses.window, todos: Todos, keys_esckeys: tuple[ - dict[int, tuple[Callable[..., Any], str]], - dict[int, tuple[Callable[..., Any], str]], + dict[int, tuple[Callable[..., Todos | None], str]], + dict[int, tuple[Callable[..., Todos | None], str]], ], possible_args: dict[str, Any], ) -> int | Todos: @@ -585,6 +592,7 @@ def main(stdscr: curses.window) -> int: Key.J: (selected.multiselect_down, "len(todos)"), Key.K: (selected.multiselect_up, "None"), Key.O: (new_todo_current, "stdscr, todos, int(selected)"), + Key.a: (_handle_alert, "stdscr, todos, int(selected)"), Key.b: (magnify_menu, "stdscr, todos, selected"), Key.c: (color_todo, "stdscr, todos, selected"), Key.d: (_handle_delete_todo, "stdscr, todos, selected, copied_todo"), diff --git a/todo.txt b/todo.txt index 85e53c7..1b791a2 100644 --- a/todo.txt +++ b/todo.txt @@ -8,7 +8,7 @@ -m depends on how the program is run, not a huge issue -y feat: add unit tests? -g refactor: only return objects (mostly `TodoList`s) when necessary --c feat: use menus.alert as an alternative to magnify - -c update readme to include new commands (backspace, this, etc) ++c feat: use menus.alert as an alternative to magnify + +c update readme to include new commands (backspace, this, etc) -b fix: overflow when appending to center of todo -b fix: keep color on overflow when appending to todo \ No newline at end of file