dirr icon indicating copy to clipboard operation
dirr copied to clipboard

Improve color handling and DIRR_COLORS

Open peterfab9845 opened this issue 3 years ago • 5 comments

  1. Default fifo type character color was invisible since 2d93da9078, because its color is high-intensity black (8) and Gputch only checked that foreground != background. a) Check bold and blink attributes as well as color.
  2. DIRR_COLORS variable created duplicates in type(), info(), etc., causing inconsistent results. a) Replace color settings specified in DIRR_COLORS instead of just adding.
  3. Setting anything in DIRR_COLORS removed default byext coloring, even with no new byext specified. a) Only delete byext when a byext pattern is included in DIRR_COLORS (byext() for none).
  4. Also modified GetName to ignore nonprinted (colored 0) type characters in spacing calculations.

peterfab9845 avatar Mar 27 '21 04:03 peterfab9845

  • Deleted 8b34cef (item 4); I hadn't considered different terminal fg/bg colors.
  • Removed blink exemption from Gputch invisible characters check; blinking with same bg/fg is also invisible.

peterfab9845 avatar Mar 29 '21 03:03 peterfab9845

Some terminals may treat blink as a high-intensity option for the background color. The blink exemption is valid.

bisqwit avatar Mar 29 '21 10:03 bisqwit

Alright, it's back in.

peterfab9845 avatar Mar 29 '21 14:03 peterfab9845

I've made a couple of improvements to the byext handling; does this PR look good to go?

peterfab9845 avatar Jul 11 '21 20:07 peterfab9845

There's also another color-related bug I'm not sure how to resolve - background colors can sometimes bleed backwards through spaces. Here's what I've figured out so far:

  • 5+ spaces: AnsiOpt takes effect, moves cursor with escape code (does not fill with bg color)
    • Issue: unable to have colored blank space
    • this is the TODO at cons.cc:356
    • workaround of non-space chars with same fg/bg doesn't work, it gets optimized out
  • <5 spaces or -P: No AnsiOpt, prints spaces instead (fills with bg color)
    • Issue: background color bleeds backwards through spaces as shown below with file test?

Image of color bleeding issue

peterfab9845 avatar May 13 '22 08:05 peterfab9845