bugGNU Screen - Bugs: bug #54989, incorrect use of tparm

 
 

bug #54989: incorrect use of tparm

Submitter:  Thomas Dickey <dickey>
Submitted:  Fri 09 Nov 2018 01:08:59 AM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  * 5 - Normal Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Release:  None
Fixed Release:  None Planned Release:  None
Work Required:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 18 Nov 2018 03:43:50 PM UTC, comment #6: 

For now I applied workaround.

To properly detect screen would need to be migrated to terminfo, which probably isn't a bad idea, but requires some effort.

Amadeusz Sławiński <amade>
Group administrator
Sat 10 Nov 2018 09:42:52 PM UTC, comment #5: 

Regarding "xterm-direct", you might find its mention in this page helpful, since it explains why I chose to implement it as is:

https://invisible-island.net/ncurses/ncurses-slang.html

Thomas Dickey <dickey>
Sat 10 Nov 2018 09:38:36 PM UTC, comment #4: 

ncurses 6.1 (like ncurses 6.0) can be compiled to match the feature-set of older releases.  Packagers tend to match the older releases...

You have to use the "-x" option of infocmp to see extended capabilities, e.g.,

infocmp -x xterm-direct |grep RGB

"RGB" is documented in the manual page:

https://invisible-island.net/ncurses/man/user_caps.5.html

If compiled to suppress the 32-bit terminfo feature, tic/infocmp will use the signed 16-bit limit.  I could digress a little about the slow rate of adoption, but proposed correcting the tparm call because that works for you now.

The 256-color escapes have been available for quite a while.  If you're using Debian (or Ubuntu), you probably omitted the ncurses-term package.

As far as assuming that various features are supported: if the terminal developers don't document what their program does, you can't assume anything about it :-)

Thomas Dickey <dickey>
Sat 10 Nov 2018 08:43:50 PM UTC, comment #3: 

I guess this will simplify things a bit, but will probably require some more work than just that:

-       if (f != of && (f & 0x04000000) && hastruecolor) {
-               uint8_t _r, _g, _b;
-
-               _r = (f & 0x00ff0000) >> 16;
-               _g = (f & 0x0000ff00) >> 8;
-               _b = (f & 0x000000ff);
-
-               /* TODO - properly get escape code */
-               tputs(tparm("\033[38;2;%d;%d;%dm", _r, _g, _b), 1, DoAddChar);
+       if (f != of && (f & 0x04000000) && D_CCO == 32767) {
+               AddCStr2(D_CAF, f & 0x00ffffff);


Still 'infocmp xterm-direct|grep -i rgb' returns nothing, should I be checking colors# (D_CCO == 32767 check in code above) and pairs#, or am I misunderstaning something?
$ infocmp -V
ncurses 6.1.20180127
$ infocmp xterm-direct|grep -i rgb
$


Also are there any considerations I should take in regards to 256 color escapes? They are absent in terminfo, but still work. Should I just keep supporting them and assume that all direct color terminals support them?

Amadeusz Sławiński <amade>
Group administrator
Sat 10 Nov 2018 06:13:19 PM UTC, comment #2: 

ncurses 6.1 supports direct color by allowing 32-bit numbers in terminal descriptions, and adds an extended capability RGB which tells if/how the color number maps to red/green/blue components.  The RGB capability is only provided via the terminfo interface, of course.

I made terminal descriptions for xterm, iTerm2, konsole, st and VTE (named "xterm-direct", etc), but did not make a screen.xterm-direct, etc., (I suppose that's doable).

(the proper name for what we're talking about is "direct color" -- TrueColor never applied, except with some imagination).

Thomas Dickey <dickey>
Sat 10 Nov 2018 12:49:56 PM UTC, comment #1: 

Yes, I'm aware of the problem.  Proposed fix seems to work ok in my tests. But as mentioned it would be better if we could just get escape code from parent terminal terminfo.  There seemed to be some work in this area to expose this information, but I'm not sure how it ended.  Is it possible nowadays to get true color escape code from terminfo?

Amadeusz Sławiński <amade>
Group administrator
Fri 09 Nov 2018 01:08:59 AM UTC, original submission:  
Thomas Dickey <dickey>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by amade (Posted a comment)
  • -email is unavailable- added by dickey (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-269c.
    Corresponding source code