bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: overwrite possible ?


From: Mike Gran
Subject: Re: overwrite possible ?
Date: Mon, 17 Nov 2014 14:26:49 +0000 (UTC)

> On Saturday, November 15, 2014 6:07 AM, Patrick <address@hidden> wrote:

> > Hi Everyone
> 
> Strange question....
> 
> I have never seen this done, is it possible to overwrite a cell in a 
> terminal while preserving what was there?
> 
> So for instance if I had the word "FOO" with a red background and 
> green 
> text is there anyway to add a blue underline and still have green and red ?


Patrick,

While it is not possible to overwrite a cell like that, you can
write 'overstruck' characters.

The ncurses functions that operate on the cchar_t type, like
add_wch, can write up to four characters on top of one another.
But not one at a time.  They all have to be written in one
operation.


If you look at the setcchar function used to construct the cchar_t
type, the *wch parameter will actually take a string of four
codepoints.

The man page cautions that only the first codepoint should be
a spacing codepoint and the others should be non-spacing
codepoints.  See Unicode documentation for more information about
spacing vs non-spacing codepoints.

So, to answer your question, on a UTF-8 enabled terminal, you
could add_wch with the character U+0046         LATIN CAPITAL LETTER F.
And then later you could overwrite that cell with the combination
U+0046 LATIN CAPITAL LETTER F, U+0332   COMBINING LOW LINE. which
would be the hard way of underlining a character.


But not all terminals support overstruck characters.  Xterm
does, I'm fairly sure.

-Mike Gran


reply via email to

[Prev in Thread] Current Thread [Next in Thread]