-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for dimmed characters (faint) #1043
Conversation
src/InputHandler.ts
Outdated
@@ -1220,6 +1221,9 @@ export class InputHandler implements IInputHandler { | |||
} else if (p === 8) { | |||
// invisible | |||
flags |= 16; | |||
} else if (p === 2) { | |||
// dimmed text | |||
flags |= 32; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's import FLAGS from Types.ts here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I have also replaced the other numeric references with the according flag.
src/renderer/BaseRenderLayer.ts
Outdated
@@ -241,11 +241,15 @@ export abstract class BaseRenderLayer implements IRenderLayer { | |||
// ImageBitmap's draw about twice as fast as from a canvas | |||
const charAtlasCellWidth = this._scaledCharWidth + CHAR_ATLAS_CELL_SPACING; | |||
const charAtlasCellHeight = this._scaledCharHeight + CHAR_ATLAS_CELL_SPACING; | |||
// Apply alpha to dim the character | |||
if (dim) { | |||
this._ctx.globalAlpha = 0.5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make the 0.5 a constant up the top. How does 0.5 compare to other terminals that implement this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.5 was the value that matched the dimmed characters from Terminal.app
best. I have made this a constant now
I see inclusion for (p === 22) to cancel both bold + dim, perfect, thank you. |
@theflyingape Thanks for your feedback! I've added SGR 21 to clear bold. |
@theflyingape normally we use http://invisible-island.net/xterm/ctlseqs/ctlseqs.html as the "spec" as it's maintained by a developer of xterm. Do several popular terminal emulators implement this clear bold? |
echo -e '\x1B[33m yellow \x1B[1m bo\x1B[21mld \x1B[2m dim \x1B[m off' Not sure about other Terminal apps though... @Tyriar Shall I remove the support for it (at least in this PR, so we can have a separate discussion about this feature in a separate issue)? |
@Tyriar, Linux-based X terminals including its physical VGA console indeed consume a clear bold sequence (21m) and turn only that character attribute off; and Windows commercial terminal emulators, sigh, like what we still use at our hospital for many classic apps that transmit bold on / bold off in this manner. |
Right, it's not widely implemented and it's mostly ignored. Thanks for the work on dim and please do split cancel bold into a separate non-blocking issue; I do not see any downside for adding it in. For reference, hterm also lists it as ignored but TBD. |
I have reverted the SGR 21 support, let's track it in a separate issue. PR should be good to merge now. |
Fixes #1042
This PR adds support to render dimmed characters.