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
Invert selected text instead of highlighting #1628
Conversation
Highlighting text in the terminal often makes it hard to read, which can be problematic for users who want to adjust or review selections before copying them. For example, the default theme makes white and green text hard to read on its light gray selection background, and there are plenty of other themes where the choice of text and cursor colors would hinder selection readability. To fix this issue and make selected text more legible in nearly all combinations of colors, invert selected text instead of highlighting it. This is more common among terminal emulators anyway: Invert: xterm, fbcon, kitty, Konsole, Alacritty, Tilix, gnome-terminal (7) Highlight: Termux, Terminal.app, iTerm2, Windows Terminal (4)
drawTextRun(canvas, line, palette, heightOffset, lastRunStartColumn, columnWidthSinceLastRun, | ||
lastRunStartIndex, charsSinceLastRun, measuredWidthForRun, | ||
cursorColor, cursorStyle, lastRunStyle, reverseVideo); | ||
cursorColor, cursorShape, lastRunStyle, reverseVideo || lastRunInsideSelection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't you effectively reverting your last PR (#1627) here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reverts the cursor style part but it still depends on the insideSelection
logic from #1627. I chose to submit this separately since I wanted to fix the existing behavior first before changing anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, okay, and since you're drawing the selection by reversing video instead of by using the cursor it isn't necessary anymore.
Kitty uses a constant background color, not inverting. However it also uses a constant foreground color for selections, which removes the problem you're describing. Personally I prefer this because it's more clean (or maybe it's just because it's what I'm used to at this point). |
My bad; the kitty color scheme I'm using has the selection colors set to inverted white text, so I classified it as "invert." I'm personally not a fan of constant colors because while it looks cleaner in some cases, sometimes I find it jarring for colors to disappear when I select text in kitty. It's particularly annoying when viewing something that relies on color differentiation to be clear, e.g. diff-so-pretty output or folder/file classification in (sorry for the closing and reopening spam, I accidentally clicked "close" while scrolling) |
@xeffyr There is still a problem with inverting color in force dark mode on Android 10, |
@lzhiyong Because this improvememt was released in v0.96 which is still not available for installation. I have dark mode on and also Android 10 - everything works, however I use custom Termux build with all latest features available. |
@xeffyr thank you for your reply, I think you can add a dark theme, or use the daynight theme, on Android 9, even if dark mode is turned on, the background color of DrawerLayout and dialog is still white, force dark mode requires Android 10 or higher. |
@lzhiyong Termux already has dark theme. Enable it manually as shown in #1681 (comment). |
Highlighting text in the terminal often makes it hard to read, which can be problematic for users who want to adjust or review selections before copying them. For example, the default theme makes white and green text hard to read on its light gray selection background, and there are plenty of other themes where the choice of text and cursor colors would hinder selection readability.
To fix this issue and make selected text more legible in nearly all combinations of colors, invert selected text instead of highlighting it. This is more common among terminal emulators anyway: