Comments (4)
The latest commits in the develop branch should patch up the color differences for normal exit and on SIGINT
fa13145
I can't get the stderr to reproduce on st, I did remove an environment variable that was being set by the library to force ncurses to use xterm-256color control sequences, that might have had something to do with it. Removing this seems to not allow ncurses to change color definitions on st, so you'd have to set the TERM variable yourself before running the program if this occurs. TERM="xterm-256color"
from termox.
I think that the assumption you've made is right (about st, but it reflects on other terminals as well).
According to this: for example urxvt
and xterm
control sequences differ. If I'm correct, these inconsistencies between terminal emulator's different esc codes
should be resolved by Terminfo
library/database which is used by emulator (by setting $TERM) and usually comes with ncurses
.
After your patch, I've tested demos from devel branch, and now everything seems to work just fine with URxvt
(color differences on normal exit/SIGINT).
However st
behaves as you've described (in terms of displaying colors), but installing the newer version of st from AUR
. (aur/st-git 1:0.7.9.g8c99915-1
)
Additional terminfo files got generated by package: located in /home/$USER/.terminfo/s/ besides the usual ones which were located at (/usr/share/terminfo/s/) -> provided by ncurses::terminfo.. With this new terminfo, coloring problems disappeared. Removing new (package generated) st terminfo files, the home directory ones, it switches to using old (/usr/share) ones and the color problem appears again (I assume that badly written terminfo file declare that color changes are not supported by st).
st
logs messages about codes ESC[22;0;0t
and ESC[23;0;0t
to stderr
only if is not using appropriate terminfo file associated with the terminal emulator.
For example if $TERM
set to xterm-256color
then it will use terminfo
for xterm
and therefore ESC codes are not compatible with st
so it will log those messages.
from termox.
Accidentally closed issue, sorry for that.
After fix: fa13145
I have noticed probably unwanted behavior (because of relying on initscr() which relays on $TERM properly set). Next example results in error and program termination:
TERM="foo" # Change $TERM to foo
./demo # executing cppurses demo
# Instead of executing (error prints -> from ncurses::initscr())
Error opening terminal: foo. # With exit code (1)
Pointing that there is maybe a problem, it might be solved some other (better) way.
Tried to fix it with this patch: #22
1) If could initialize with `$TERM` -> okay
2) if not then -> Try to initialize with xterm-256color
3) if both failed then -> Handle error (TODO)
This solution prevents potentially undesired exit(), but on the other hand hint that there is a problem with $TERM (shown at exit) might be useful for the end user to know.
INFO: Unfortunately some terminfo files are not written correctly, and that may cause coloring problems as one occurred with st
after your patch. Not sure if there is a better solution than relying on terminfo files, it might be possible to avoid potential ''Coloring'' issues. And I agree that expecting xterm esc codes
compatibility from random terminal emulator might not be the best solution, but it actually looks like it is more likely to work that way (in various terminal emulators) .. Previously archived with:
setenv("TERM", "xterm-256color", 1);
// or manually setting TERM variable in shell
But as we already discussed, this sometimes causes those esc code
errors like in st
.
Note: In ubuntu, ncurses-dev package does not provide terminfo files, but there is package: ncurses-term
to get them.
Also I run on some color issues using Konsole (on KDE-Neon), both before and after fa13145 (similar to st colors issue).. With $TERM
set to xterm-256color
(which is default) and with ncurses-term
provided konsole-256color
terminfo.
Unrelated
- A colleague of mine and I have had used (and misused with hacks probably :D ) this library for the school project last year, and we found it very cool and enjoyable. Pluton
from termox.
Thanks for the patch to handle screen initialization gracefully. It seems like this is a good solution for now, fixing all of the color issues on all terminals is a larger issue than this project tries to solve.
Looks like konsole does not implement changing color definitions seen here.
Though it does appear that things like htop and vim display colors correctly in konsole and st, htop uses ncurses and vim does not(as far as I know), so there must be a solution out there.
Also, thank you for the link to your project! It's exciting seeing this library being used outside of my own projects :)
from termox.
Related Issues (20)
- Errors building using make HOT 2
- Aur package does not compile HOT 2
- Wide characters show garbled code HOT 4
- Widget List incomplete implementation HOT 1
- Usage with other loop based library HOT 1
- Multiple windows support HOT 1
- [regression in 0.4] Project doesn't install anything HOT 4
- Please add a cmake variable for tests to build HOT 3
- Does this support the Windows platform? HOT 2
- CMake Release Build Segmentation Fault HOT 4
- `Line_edit.veil_text()` crashes application
- Registering `SIGINT` internally in library HOT 1
- How to show wide charaters HOT 1
- integrate with live data stream generated by data source
- Many problems in Mac Terminal.app
- Failed to compile, gcc 7.5.0
- Termox
- Loader failure to build demos on Raspberry Pi 4 (Debian bookworm 12.2.0-14, GCC 12.2)
- Compiler error trying to build unit tests on Raspberry Pi 4 (Debian bookworm 12.2.0-14, GCC 12.2)
- Runtime error trying to execute UI tests (and possibly all other programs?) on Raspberry Pi 4 (Debian bookworm 12.2.0-14, GCC 12.2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from termox.