You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: this loads into forward search, whereas on Linux this loads to reverse search
Press Ctrl + R again to load into reverse search
Note that "hello" is selected.
Type something not in the search history (for example, 'p'), and press enter
Note that "hello" is run. On Linux, this results in a "failed reverse search" and nothing is run.
Press Ctrl + R again to re-enter reverse search, and type another character not in the search history (for example, 'f'). I receive a stack trace similar to the following on that key press, and any subsequent key presses:
Traceback (most recent call last):
File "C:\path_to_proj\.venv\Lib\site-packages\pyreadline3\console\console.py", line 804, in hook_wrapper_23
res = ensure_str(readline_hook(prompt))
^^^^^^^^^^^^^^^^^^^^^
File "C:\path_to_proj\.venv\Lib\site-packages\pyreadline3\rlmain.py", line 589, in readline
self._readline_from_keyboard()
File "C:\path_to_proj\.venv\Lib\site-packages\pyreadline3\rlmain.py", line 553, in _readline_from_keyboard
if self._readline_from_keyboard_poll():
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\path_to_proj\.venv\Lib\site-packages\pyreadline3\rlmain.py", line 574, in _readline_from_keyboard_poll
result = self.mode.process_keyevent(event.keyinfo)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\path_to_proj\.venv\Lib\site-packages\pyreadline3\modes\emacs.py", line 243, in process_keyevent
r = self.process_keyevent_queue[-1](keyinfo)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\path_to_proj\.venv\Lib\site-packages\pyreadline3\modes\emacs.py", line 74, in _process_incremental_search_keyevent
self.line = self.subsearch_fun(self.subsearch_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\path_to_proj\.venv\Lib\site-packages\pyreadline3\lineeditor\history.py", line 170, in reverse_search_history
result = self.history[startpos].get_line_text()
~~~~~~~~~~~~^^^^^^^^^^
IndexError: list index out of range
Notes
There appear to be a fairly substantial number of bugs in the history implementation in pyreadline3. For starters, I believe the bounds of slicing are wrong here; the upper bound is exclusive so the first item is cut off.
However, even aside from that, based on what I'm seeing with this example, there appear to be a number of other bugs that more pertain to the state machine they use to track history; I haven't been able to track those down, thus far.
FWIW, pyreadline3 seems somewhat unmaintained, and at least as I've experienced it, has a number of shortcomings beyond this issue (see #1313, for example). Not sure if an alternative is available or if you have the capacity to fork and fix some of these issue (I'm willing to help there, as I'm able, though not super familiar with their code base), but it definitely is impactful to the cmd2 experience on Windows, unless I'm way off about what's going on in this case. I'm actually going to have to either fork pyreadline3 or monkey patch their code to get around this one, I think, for my use case (or just disable the history features, which is less than ideal).
The text was updated successfully, but these errors were encountered:
Steps to Reproduce
Type "hello" at the console and press enter
Press Ctrl + R.
Press Ctrl + R again to load into reverse search
Type something not in the search history (for example, 'p'), and press enter
Press Ctrl + R again to re-enter reverse search, and type another character not in the search history (for example, 'f'). I receive a stack trace similar to the following on that key press, and any subsequent key presses:
Notes
There appear to be a fairly substantial number of bugs in the history implementation in
pyreadline3
. For starters, I believe the bounds of slicing are wrong here; the upper bound is exclusive so the first item is cut off.However, even aside from that, based on what I'm seeing with this example, there appear to be a number of other bugs that more pertain to the state machine they use to track history; I haven't been able to track those down, thus far.
FWIW, pyreadline3 seems somewhat unmaintained, and at least as I've experienced it, has a number of shortcomings beyond this issue (see #1313, for example). Not sure if an alternative is available or if you have the capacity to fork and fix some of these issue (I'm willing to help there, as I'm able, though not super familiar with their code base), but it definitely is impactful to the cmd2 experience on Windows, unless I'm way off about what's going on in this case. I'm actually going to have to either fork pyreadline3 or monkey patch their code to get around this one, I think, for my use case (or just disable the history features, which is less than ideal).
The text was updated successfully, but these errors were encountered: