[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ncurses-bug
Subject:    Re: is there any way to print out unsanitized output?
From:       Thomas Dickey <dickey () his ! com>
Date:       2016-10-02 1:56:05
Message-ID: 20161002015605.GA130643 () vmw-debian7-64 ! jexium-island ! net
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Thu, Sep 29, 2016 at 10:01:59AM -0700, elronnd wrote:
> Not a bug, per se, but a question about how to use ncurses.  I
> understand that ncurses doesn't natively have capabilities to print
> out using 24-bit colour, but I want to use ncurses in my program,
> and I want said program to support 24-bit colour.  There seems to be
> a problem, however, in which ncurses will sanitize its output.
> Consider the following snippet:
> 
> #include <ncurses.h>
> int main() {
> 	initscr();
> 	printw("\033[33mhello\033[0m\n");
> 	refresh();
> 	endwin();
> 	return 0;
> }
> 
> This simply prints out "^[[33mhello^[[0m", uncoloured.  Is there a
> way to make ncurses not sanitize this output?

sure - but you wouldn't find it useful once you did it.

You can write "anything" to the terminal by

	a) doing a refresh to get the screen up to date
	b) changing the terminal modes back to shell-mode temporarily
	c) write your "anything", and do an fflush afterwards
	d) restore the shell modes
	e) call mvcur to set the cursor to the location where curses
	   thought it was (and use -1's for the ordinates of the previous
	   location).

Of course, "anything" which you print on the screen that's visible is
likely to be overwritten by ncurses as it updates the screen.

-- 
Thomas E. Dickey <dickey@invisible-island.net>
http://invisible-island.net
ftp://invisible-island.net

["signature.asc" (application/pgp-signature)]

_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-ncurses


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic