-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Use variants for underline dotted. #4703
Conversation
hi @Tyriar , The effect should be better this time. |
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.
Thanks! I'll try get to a proper review in a week or 2
I need to clean up the code. |
Thanks. |
this._cellColorResolver.result.ext &= ~ExtFlags.VARIANT_OFFSET; | ||
this._cellColorResolver.result.ext |= (variantOffset << 29) & ExtFlags.VARIANT_OFFSET; |
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.
This should live inside CellColorResolver.result. It would be ideal if calculating variantOffset
was inside that function as well.
const fontSize = this._optionsService.rawOptions.fontSize; | ||
const drp = this._coreBrowserService.dpr; | ||
const lineWidth = Math.max(1, Math.floor(fontSize * drp / 15)); | ||
const deviceCellWidth = this._charAtlas?.getDeviceCellWidth(); | ||
let variantOffset: number = -1; |
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.
Can all this logic live inside CellColorResolver?
|
||
const fontSize = this._optionsService.rawOptions.fontSize; | ||
const drp = this._coreBrowserService.dpr; | ||
const lineWidth = Math.max(1, Math.floor(fontSize * drp / 15)); | ||
const deviceCellWidth = this._charAtlas?.getDeviceCellWidth(); |
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.
Same; can this be shared inside CellColorResolver?
const lineWidth = Math.max(1, Math.floor(fontSize * drp / 15)); | ||
const deviceCellWidth = this._charAtlas?.getDeviceCellWidth(); | ||
|
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.
You should be able to pull device cell width off `this.dimensions``
ok.I have discovered an issue now. I will solve it first |
… into underline-dotted
let chWidth: number; | ||
if (typeof code === 'number') { | ||
chWidth = this._unicodeService.wcwidth(code); | ||
} else { | ||
chWidth = this._unicodeService.getStringCellWidth(code); | ||
} | ||
$variantOffset = computeVarinatOffset(deviceCellWidth * chWidth, lineWidth, $variantOffset); |
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.
I was expecting the variant to be based on the left-most pixel of the glyph, so chWidth
wouldn't be needed?
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.
I need to take a look at the process 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.
I see. 😄
} else { | ||
chWidth = this._unicodeService.getStringCellWidth(code); | ||
} |
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.
code
should always be a number so this isn't necessary. Did you mean to pass in chars
?
if (code !== NULL_CELL_CODE) { | ||
const fontSize = this._terminal.options.fontSize; | ||
const drp = this._coreBrowserService.dpr; | ||
const lineWidth = Math.max(1, Math.floor(fontSize! * drp / 15)); |
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.
If you pass in IOptionsService
you can use rawOptions.fontSize
and avoid the unsafe !
if (offsetWidth === 0) { | ||
this._tmpCtx.setLineDash([Math.round(lineWidth), Math.round(lineWidth)]); | ||
this._tmpCtx.moveTo(xChLeft, yTop); | ||
this._tmpCtx.lineTo(xChRight, yTop); | ||
} else { |
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.
I don't think you need a special case for this as the main effect is + offsetWidth
= + 0
?
Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com>
Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com>
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.
Next. Curve. |
@tisilent that would be great, I found it a bit tricky to get the curve to look good at various zoom levels. |
fix #4349