CC: Tweaked

CC: Tweaked

42M Downloads

Background color "spills" into border of terminals

LuckyTeran opened this issue ยท 3 comments

commented

Minecraft version: 1.16.5
CC: Tweaked version: 1.95.2

While rendering text the background color "spills" into the border of the terminal window (i guess it happens on every line but the next line overwrites the "spilled" color?). During normal usage this does not matter but i'm drawing pixels using the characters in the range of 0x80 - 0x9F. To fully use those characters to draw pixels i need to invert background and text colors to use all possible combinations. Here is a small code snippet to reproduce the bug:

term.setCursorPos(1,1)
term.clear()
term.blit("\x9f\x87\x8C\x8C\x93","ff00f","00ff0")

copy-cat has the same behavior

commented

The Wojbie linked gives some more context about this issue, as well as several solutions. However, as the most-popular solution has been rejected by Dan, I'm afraid this is unlikely to be fixed in CC:T either.

commented
commented

Dan wrote here:

I thought up a nice solution to this:

Allow the background colours of the border positions to be independently set by writing to positions 0 or width+1/height+1. term.clear() would still set all of these, and term.clearLine() would set the left and right border chars of that line, so the behaviour of many current programs will be unaffected. But the control is available to those who need it

It will take a while to implement this (especially making the window API play nice with it), so might not make it into the next beta, but we'll see.

And i like the idea. If the problem is backwards compatibility and the window API i have an idea how this could still work.

Just prevent the Window API to write to "0", "width+1" or "height+1" to the parent object. This should not break anything and someone that has the specific need to change the border color should be able to work without the window API ;).

Now with the real terminals a explicit write to "0", "width+1" or "height+1" ignores the actual char write and writes a border char with the color and sets a bit/flag that the border char was changed. During rendering (or whenever) check the flag, if it is set use the saved color in the border char, if not take the background color of the neighbor and use that.

There is the problem if an old program writes outside of the terminal and expects the old behavior (i would say that is bad programming ... ) that a write outside of the screen gets completely ignored and the border color behaves like always. The only thing i can think of would be some extra function or something to switch the advanced border system on and a way to check if the function exists. But maybe i can come up with a better idea.