litecli crashes when trying to replace a char in vi mode
FreddieOliveira opened this issue · 4 comments
After setting key_bindings = vi
in the config.file, everytime I hit r, instead of entering in single char replace mode, a loop of exceptions messages are thrown on my screen and I need to kill litecli. This doesn't happen when replacing multiple characters with R
Error (they might be out of order, since they are shown in an endless loop, so I don't know where it starts nor where it ends):
Unhandled exception in event loop:
File "/data/data/com.termux/files/usr/lib/python3.8/asyncio/events.py", line 81, in _run
self._context.run(self._callback, *self._args)
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/eventloop/utils.py", line 72, in schedule
func()
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 469, in redraw
self._redraw()
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 536, in _redraw
self.context.run(run_in_context)
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 522, in run_in_context
self.renderer.render(self, self.layout)
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/renderer.py", line 631, in render
layout.container.preferred_height(size.columns, size.rows).preferred,
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 325, in preferred_height
dimensions = [
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 326, in <listcomp>
c.preferred_height(width, max_available_height) for c in self._all_children
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 2598, in preferred_height
return self.content.preferred_height(width, max_available_height)
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 1623, in preferred_height
return self._merge_dimensions(
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 1651, in _merge_dimensions
preferred = get_preferred()
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 1616, in preferred_content_height
return self.content.preferred_height(
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 379, in preferred_height
content = self.create_content(width, None)
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 384, in create_content
fragments_with_mouse_handlers = self._get_formatted_text_cached()
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 358, in _get_formatted_text_cached
return self._fragment_cache.get(
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/cache.py", line 41, in get
value = getter_func()
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 359, in <lambda>
get_app().render_counter, lambda: to_formatted_text(self.text, self.style)
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/formatted_text/base.py", line 78, in to_formatted_text
return to_formatted_text(value(), style=style)
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/prompt_toolkit/formatted_text/base.py", line 78, in to_formatted_text
return to_formatted_text(value(), style=style)
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/litecli/clitoolbar.py", line 28, in get_toolbar_tokens
("class:botton-toolbar.on", "Vi-mode ({})".format(_get_vi_mode()))
File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/litecli/clitoolbar.py", line 46, in _get_vi_mode
return {
Exception <InputMode.REPLACE_SINGLE: 'vi-replace-single'>
Can confirm same behaviour for me - using litecli 1.7.0 (python 3.10 on linux)
Same here with litecli 1.8.0 (python 3.9.12 on macOs 12.2.1)
Sorry about this bug. It is now fixed in the main
branch. I'll try and get a release out this weekend. In the meantime you can install directly from the main
branch using the following command:
pip install -U https://github.com/dbcli/litecli/archive/refs/heads/main.zip
This is now fixed in the latest version. Please upgrade.
pip install -U litecli