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

History reversed with older prompt_toolkit #13634

Open
MegaBluejay opened this issue Apr 11, 2022 · 8 comments
Open

History reversed with older prompt_toolkit #13634

MegaBluejay opened this issue Apr 11, 2022 · 8 comments

Comments

@MegaBluejay
Copy link

MegaBluejay commented Apr 11, 2022

When using an older version of prompt-toolkit (3.0.7), history does not work correctly.
Upon opening ipython, both when scrolling with the arrow keys and searching, a second copy of it appears, in reversed order. This does not affect the actual history file, only how it looks in this environment.

Example:
real history

a = 1
b = 2
c = 3

apparent history

a = 1
b = 2
c = 3
c = 3
b = 2
a = 1

Then upon entering another command the first half vanishes, leaving only the reversed, with no new entries being added

> d = 4

apparent history

c = 3
b = 2
a = 1

The new history is added to the file as usual, but not displayed.

Environment:

> python -c "import IPython; print(IPython.sys_info())"
{'commit_hash': 'e643224',
 'commit_source': 'repository',
 'default_encoding': 'utf-8',
 'ipython_path': '/home/archer/test/ipython/IPython',
 'ipython_version': '8.3.0.dev',
 'os_name': 'posix',
 'platform': 'Linux-5.15.32-1-MANJARO-x86_64-with-glibc2.35',
 'sys_executable': '/home/archer/.virtualenvs/test/bin/python',
 'sys_platform': 'linux',
 'sys_version': '3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0]'}

prompt-toolkit version: 3.0.7
The issue is not present with the latest prompt-toolkit: version 3.0.29, or with versions of ipython before 8.2.0
If bumping the dependency version is viable, it seems like the easiest fix.

@segasai
Copy link

segasai commented Apr 12, 2022

I think this is related to #13631 (or it is the same issue). I don't think the prompt-toolkit versions mattered there though.

@uamoti
Copy link

uamoti commented Apr 26, 2022

I've had a similar issue where the command history would appear in reverse order, from oldest to newest. Likewise, it started with the latest update to IPython 8.2.0, and upgrading prompt_toolkit seems to have solved the issue.

@mcmahanp

This comment was marked as duplicate.

@sbuchbinder

This comment was marked as duplicate.

@Tim-K-DFW
Copy link

Tim-K-DFW commented Jun 17, 2022

Same here with 8.4.0. Upgrading prompt-toolkit to 3.0.29 has not changed anything. Downgrading ipython to 8.0.0 has fixed it.

@sleepyhollo
Copy link

sleepyhollo commented Jun 23, 2022

Also have a similar issue. Using python 3.8.6, ipython 8.4.0 in windows 10. I have prompt_toolkit version '3.0.29'.

I see two problems

  • The history from the last line is not present and the history appears in a non-intuitive order (FIFO); expect LIFO
  • the most recent item (i.e. last line inputted) does not show up in history at all

Downgrading to v8.0.0 also resolves it for me

@ekieflabc
Copy link

Same problem and no solution :\

▶ python -c "import IPython; print(IPython.sys_info())"
{'commit_hash': '4396dd620',
 'commit_source': 'installation',
 'default_encoding': 'utf-8',
 'ipython_path': '(...)/.conda/lib/python3.8/site-packages/IPython',
 'ipython_version': '8.4.0',
 'os_name': 'posix',
 'platform': 'macOS-10.16-x86_64-i386-64bit',
 'sys_executable': '(...)/.conda/bin/python',
 'sys_platform': 'darwin',
 'sys_version': '3.8.13 | packaged by conda-forge | (default, Mar 25 2022, '
                '06:06:49) \n'
                '[Clang 12.0.1 ]'}

@Umut-Deniz1
Copy link

I've had a similar issue and it was fixed after I updated prompt-toolkit: version 3.0.30 and version of ipython 8.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants