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
For some context, I originally discovered this with the Rich progress bars in Twine, that whenever one would display, the cursor style would be clobbered to a block cursor, and reported as pypa/twine#902 . However, I subsequently reproduced it in pip as and was directed to report it to Rich, and indeed, I can reproduce it with a minimal Rich snippit.
On Windows (tested both 8.1 and 10 on multiple machines) running rich.console.Console.show_cursor() clobbers the current cursor style (underbar in the stock Windows terminals, bar in ConEmu) and forces the cursor to display as a block, even if the cursor is already visible, with no way I've found to get it back other than completely closing and restarting the terminal. This also happens whenever I run pip and Twine and Rich progress bars are displayed, unless I specifically disable them through their respective CLIs, which I have to always remember to do, or I have to restart my terminal tab to get my normal cursor back, potentially losing tens of thousands of lines of scrollback and command history.
I've reproduced the same behavior in all environments on my machine I was able to test, as well as the other clean-installed Windows machines I tested (with no obvious common configuration):
cmd.exe shell running in the default Command Prompt terminal
Powershell running in the default Powershell terminal
cmd.exe running in ConEmu
Git Bash running in ConEmu
(In Git Bash running in its bundled MinTTY, I could not confirm if the behavior can be reproduced since Rich treats it as a not a terminal and the function terminates without doing anything, given is_terminal is False there and show_cursor(False) does nothing.)
Furthermore, I've reproduced the above running the latest version of Rich, 12.4.4, in fresh clean environments with only Rich, pip, Twine and their deps installed, both from PyPI with pip, and from conda-forge with conda.
I've tried numerous methods to restore it once this happens, including modifying my terminal emulator settings, various ANSI escape sequences, the reset command in my shell, starting a new bash session within an existing one and sshing into another machine, including a Linux box, but nothing works save closing and restarting the terminal.
However, if I ssh into a Linux host (prior to triggering the bug) from either ConEmu + Git Bash or MinTTY + Git Bash and run show_cursor() there, the cursor both hides and shows correctly, retaining whatever shape I configured in my terminal emulator (and I tested with lines, blocks and underbars). (To note, this works even from MinTTY running Git Bash, despite it not being considered a terminal when running bash on Windows.) The cursor hiding/showing persists (correctly, I assume) even when I exist the remote session, but if I do trigger the bug on Windows, so does the block cursor within and without the ssh session (and show_cursor() does not restore the previous one, since the block cursor is set as the current cursor). Therefore, it would seem there is something specific to Windows that is triggering this issue, given I'm running the same shell and same terminal emulator and everything works fine.
Minimal reproducer:
python -c "import rich.console; rich.console.Console().show_cursor()"# Cursor now a block
Platform
What platform (Win/Linux/Mac) are you running on? What terminal software are you using?
Reproduced issue
All running Python 3.9.13 x64
{1*) Windows 8.1 Pro x64 + ConEmu 210912 stable + Git Bash 4.4.23(1)-release (x86_64-pc-msys)
Windows 8.1 Pro x64 + ConEmu 210912 stable + cmd.exe
Windows 8.1 Pro x64 + Command Prompt + cmd.exe
Windows 8.1 Pro x64 + Windows Powershell + powershell
Windows 10 Enterprise x64 + Command Prompt + cmd.exe
Windows + ConEmu + Git Bash platform details
python -m rich and python -m rich.diagnose display colors and other characters correctly, as far as I can tell.
Could not confirm either way (not considered a terminal)
(2*) Windows 8.1 Pro x64 + MinTTY 3.1.0 (x86_64-pc-msys) + Git Bash 4.4.23(1)-release (x86_64-pc-msys) + Python 3.9.13
Windows + MinTTY + Git Bash platform details
python -m rich and python -m rich.diagnose do not display any colors, many of the characters are mojibake/missing, and only work at all without an error when running in UTF-8 mode
Describe the bug
For some context, I originally discovered this with the Rich progress bars in Twine, that whenever one would display, the cursor style would be clobbered to a block cursor, and reported as pypa/twine#902 . However, I subsequently reproduced it in
pip
as and was directed to report it to Rich, and indeed, I can reproduce it with a minimal Rich snippit.On Windows (tested both 8.1 and 10 on multiple machines) running
rich.console.Console.show_cursor()
clobbers the current cursor style (underbar in the stock Windows terminals, bar in ConEmu) and forces the cursor to display as a block, even if the cursor is already visible, with no way I've found to get it back other than completely closing and restarting the terminal. This also happens whenever I run pip and Twine and Rich progress bars are displayed, unless I specifically disable them through their respective CLIs, which I have to always remember to do, or I have to restart my terminal tab to get my normal cursor back, potentially losing tens of thousands of lines of scrollback and command history.I've reproduced the same behavior in all environments on my machine I was able to test, as well as the other clean-installed Windows machines I tested (with no obvious common configuration):
(In Git Bash running in its bundled MinTTY, I could not confirm if the behavior can be reproduced since Rich treats it as a not a terminal and the function terminates without doing anything, given
is_terminal
isFalse
there andshow_cursor(False)
does nothing.)Furthermore, I've reproduced the above running the latest version of Rich, 12.4.4, in fresh clean environments with only Rich, pip, Twine and their deps installed, both from PyPI with pip, and from conda-forge with conda.
I've tried numerous methods to restore it once this happens, including modifying my terminal emulator settings, various ANSI escape sequences, the
reset
command in my shell, starting a newbash
session within an existing one and sshing into another machine, including a Linux box, but nothing works save closing and restarting the terminal.However, if I
ssh
into a Linux host (prior to triggering the bug) from either ConEmu + Git Bash or MinTTY + Git Bash and runshow_cursor()
there, the cursor both hides and shows correctly, retaining whatever shape I configured in my terminal emulator (and I tested with lines, blocks and underbars). (To note, this works even from MinTTY running Git Bash, despite it not being considered a terminal when running bash on Windows.) The cursor hiding/showing persists (correctly, I assume) even when I exist the remote session, but if I do trigger the bug on Windows, so does the block cursor within and without the ssh session (andshow_cursor()
does not restore the previous one, since the block cursor is set as the current cursor). Therefore, it would seem there is something specific to Windows that is triggering this issue, given I'm running the same shell and same terminal emulator and everything works fine.Minimal reproducer:
Platform
What platform (Win/Linux/Mac) are you running on? What terminal software are you using?
Reproduced issue
All running Python 3.9.13 x64
Windows + ConEmu + Git Bash platform details
python -m rich
andpython -m rich.diagnose
display colors and other characters correctly, as far as I can tell.Could not confirm either way (not considered a terminal)
Windows + MinTTY + Git Bash platform details
python -m rich
andpython -m rich.diagnose
do not display any colors, many of the characters are mojibake/missing, and only work at all without an error when running in UTF-8 modeConfirmed working correctly:
Ubuntu via (1*) platform details
python -m rich
andpython -m rich.diagnose
display colors and other characters correctly, as far as I can tell.Ubuntu via (2*) platform details
python -m rich
andpython -m rich.diagnose
display colors and other characters correctly, as far as I can tell.The text was updated successfully, but these errors were encountered: