Skip to content
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

fix retheming while in a menu #272

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions babi/hl/lint_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ def focus(self, screen: Screen) -> None:
ch = screen.get_char()
if ch.keyname == b'KEY_RESIZE':
screen.resize()
elif ch.keyname == b'RETHEME':
screen.retheme()
screen.draw()
elif ch.keyname in {b'^C', b'^X'}:
self.set_errors(())
screen.resize()
Expand Down
5 changes: 5 additions & 0 deletions babi/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ def _cut_to_end(self) -> None:
def _resize(self) -> None:
self._screen.resize()

def _retheme(self) -> None:
self._screen.retheme()
self._screen.draw()

def _check_failed(self, idx: int, s: str) -> tuple[bool, int]:
failed = False
for search_idx in range(idx, -1, -1):
Expand Down Expand Up @@ -165,6 +169,7 @@ def _submit(self) -> str:
b'KEY_DC': _delete,
b'^K': _cut_to_end,
# misc
b'RETHEME': _retheme,
b'KEY_RESIZE': _resize,
b'^R': _reverse_search,
b'^M': _submit,
Expand Down
3 changes: 3 additions & 0 deletions babi/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ def _write(s: str, *, attr: int = curses.A_REVERSE) -> None:
key = self.get_char()
if key.keyname == b'KEY_RESIZE':
self.resize()
elif key.keyname == b'RETHEME':
self.retheme()
self.draw()
elif key.keyname == b'^C':
return self.status.cancelled()
elif isinstance(key.wch, str) and key.wch.lower() in opts:
Expand Down