Skip to content

Commit

Permalink
EditBox now uses urwid_readline library. Fixes ihabunek#353
Browse files Browse the repository at this point in the history
The urwid_readline library allows readline style key
commands. Equivalent to readline with set -o emacs.
ctrl-a, ctrl-e, ctrl-k, etc.
  • Loading branch information
danschwarz committed Mar 3, 2024
1 parent e1be3a6 commit 304452e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"beautifulsoup4>=4.5.0,<5.0",
"wcwidth>=0.1.7",
"urwid>=2.0.0,<3.0",
"tomlkit>=0.10.0,<1.0"
"tomlkit>=0.10.0,<1.0",
"urwid_readline>=0.14,<0.2"
],
extras_require={
# Required to display rich text in the TUI
Expand Down
3 changes: 2 additions & 1 deletion toot/tui/widgets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import urwid
import urwid_readline
from wcwidth import wcswidth


Expand Down Expand Up @@ -33,7 +34,7 @@ class SelectableColumns(Clickable, urwid.Columns):
class EditBox(urwid.AttrWrap):
"""Styled edit box."""
def __init__(self, *args, **kwargs):
self.edit = urwid.Edit(*args, **kwargs)
self.edit = urwid_readline.ReadlineEdit(*args, **kwargs)
return super().__init__(self.edit, "editbox", "editbox_focused")


Expand Down

0 comments on commit 304452e

Please sign in to comment.