From 70cbd2f806240bcbb97844ae04a8eca672fa6752 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 22 Apr 2025 20:25:37 +0200 Subject: [PATCH 1/3] Fix F9 binding of textarea --- src/chap/commands/tui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chap/commands/tui.py b/src/chap/commands/tui.py index a1ba4d5..eadeb60 100644 --- a/src/chap/commands/tui.py +++ b/src/chap/commands/tui.py @@ -38,7 +38,7 @@ def pyperclip_copy(data: str) -> None: class SubmittableTextArea(TextArea): BINDINGS = [ - Binding("f9", "submit", "Submit", show=True), + Binding("f9", "app.submit", "Submit", show=True), Binding("tab", "focus_next", show=False, priority=True), # no inserting tabs ] From 633c43502adfa8c0dc3bdbab3d6183efb3c25f35 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 22 Apr 2025 20:36:36 +0200 Subject: [PATCH 2/3] fix weird sizing of SubmittableTextArea .. by removing the top & bottom borders. For some reason these appeared not to be accounted when sizing the widget to its content? not sure. anyway this improves it. --- src/chap/commands/tui.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chap/commands/tui.css b/src/chap/commands/tui.css index 32011f4..151cb96 100644 --- a/src/chap/commands/tui.css +++ b/src/chap/commands/tui.css @@ -58,4 +58,4 @@ Markdown { margin: 0 1 0 0; } -SubmittableTextArea { height: 3 } +SubmittableTextArea { height: auto; min-height: 5; margin: 0; border: none; border-left: heavy $primary } From 5d609273959799e492f67f57a4516d03d818829a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 23 Apr 2025 20:19:37 +0200 Subject: [PATCH 3/3] Fix app bindings more ctrl-c can now be copy instead of yank (yay!) --- src/chap/commands/tui.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/chap/commands/tui.py b/src/chap/commands/tui.py index eadeb60..c094667 100644 --- a/src/chap/commands/tui.py +++ b/src/chap/commands/tui.py @@ -51,10 +51,10 @@ def parser_factory() -> MarkdownIt: class ChapMarkdown(Markdown, can_focus=True, can_focus_children=False): BINDINGS = [ - Binding("ctrl+y", "yank", "Yank text", show=True), - Binding("ctrl+r", "resubmit", "resubmit", show=True), - Binding("ctrl+x", "redraft", "redraft", show=True), - Binding("ctrl+q", "toggle_history", "history toggle", show=True), + Binding("ctrl+c", "app.yank", "Copy text", show=True), + Binding("ctrl+r", "app.resubmit", "resubmit", show=True), + Binding("ctrl+x", "app.redraft", "redraft", show=True), + Binding("ctrl+q", "app.toggle_history", "history toggle", show=True), ] @@ -75,7 +75,7 @@ class CancelButton(Button): class Tui(App[None]): CSS_PATH = "tui.css" BINDINGS = [ - Binding("ctrl+c", "quit", "Quit", show=True, priority=True), + Binding("ctrl+q", "quit", "Quit", show=True, priority=True), ] def __init__(