From 45e2f9a5c6a8ac29ce9fa1bf2e18343098c4a050 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 14 Jul 2015 03:29:29 +0200 Subject: curses UI: support terminal palette restoration on PDCurses/win32 and xterm * palette changes are persistent on PDCurses/win32, too. Fortunately, on this port we can reliably query the console palette. This is done ONLY on PDcurses/win32 since on other ports (notably ncurses), this can cause more harm than it helps. * support palette restoration on xterm by hardcoding the appropriate escape sequence. $TERM cannot be used to identify xterm, but looking at $XTERM_VERSION is sufficient hopefully. --- src/parser.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/parser.cpp') diff --git a/src/parser.cpp b/src/parser.cpp index 1da6905..1942281 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -2060,19 +2060,16 @@ StateECommand::custom(gchar chr) * Note that on 8 color terminals, only the first 8 colors * can be redefined (if you are lucky). * Note that due to restrictions of most terminal emulators - * and some curses implementations, this command will not - * and cannot restore the original palette entry or request + * and some curses implementations, this command simply will not + * restore the original palette entry or request * when rubbed out and should generally only be used in * \fIbatch-mode\fP \(em typically when loading a color scheme. - * For the same reasons, palette changes may persist - * after \*(ST terminates on most terminal emulators. - * The only emulator which restores the palette on exit the - * author is aware of is the Linux console driver. - * Few other emulators like \fBxterm\fP(1) might support - * palette resets but this cannot be done automatically - * by \*(ST for technical and historical reasons. - * Users might try to work around this by tweaking their - * \fBterminfo\fP(5) database. + * For the same reasons \(em even though \*(ST tries hard to + * restore the original palette on exit \(em palette changes may + * persist after \*(ST terminates on most terminal emulators on Unix. + * The only emulator which will restore their default palette + * on exit the author is aware of is \fBxterm\fP(1) and + * the Linux console driver. * You have been warned. Good luck. */ case 'J': { -- cgit v1.2.3