-
Notifications
You must be signed in to change notification settings - Fork 818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TextArea CTRL-k behavior request #4277
Labels
Comments
While I agree this would make sense, meanwhile, you could possibly go with something like this in your app: from textual.app import App, ComposeResult
from textual.widgets import TextArea
class TextAreaEx(TextArea):
"""Extended TextArea."""
def action_delete_to_end_of_line(self) -> None:
if self.selection.end != self.get_cursor_line_end_location():
super().action_delete_to_end_of_line()
else:
self.action_delete_line()
class CtrlKApp(App[None]):
def compose(self) -> ComposeResult:
yield TextAreaEx()
if __name__ == "__main__":
CtrlKApp().run() |
Thanks! I'll give that a try. |
That works perfectly. Thanks again! |
This feels like it should be the default behaviour. |
This is how it works in Emacs |
|
davep
added a commit
to davep/textual
that referenced
this issue
Mar 12, 2024
Following the expected behaviour for ctrl+k from Emacs (and so by extension a text area on macOS -- see notes.app, or textedit.app, for example), this adds an alternative action to TextArea that will delete to end of line or, if the line is empty, will delete the line. Also, to further enhance compatibility with expected ctrl+k behaviour, if the cursor is on the end of the line and ctrl+k is pressed a delete-right is performed. Fixes Textualize#4277.
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requesting CTRL-k (C-k) behavior be modified as follows.
C-k currently does not kill new lines, and on a line with printable content, this is correct. On a line with only a newline, C-k should kill the new line. This will allow the TextArea user to kill multiple lines simply with repeated application of C-k. The current behavior of never killing a newline requires more effort that in it should. Thanks!
The text was updated successfully, but these errors were encountered: