-
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
Support for lineHeight in DOM Renderer #1733
Conversation
@leomoty yes using the browser zoom should work. |
@leomoty it looks like browser zoom is working? I do notice that selection is not taking line height into account though (click and drag in the terminal with line height = 2). |
@Tyriar, maybe what I am seeing is font sizing/spacing related? Yeah, I didn't test selection. Will do after work. |
Hm, seems alright to me. Note that you're not aiming for exact parity with the canvas renderer, it's fine if they're a little different. |
@Tyriar, updated |
@leomoty here's the function that grabs the coordinates from the MouseEvent: xterm.js/src/SelectionManager.ts Line 485 in b650db5
|
@Tyriar I have been a bit busy with work, just noticed the status change, I also took another look, I might have found the issue. Unsure why it happens tho. Following the code you gave me it goes here: https://github.com/xtermjs/xterm.js/blob/master/src/utils/MouseHelper.ts#L51-L72 When I tried to inspect https://github.com/xtermjs/xterm.js/pull/1733/files#diff-0a9d734ca7737653ca5c980f3c663f7aR96 I.e. |
As a follow-up: I wonder if this might break the canvas renderer tho. I'll wait for your feedback. |
I don't think you'll need to change anything in the selection or coord code that would impact the canvas renderer as it's working for the canvas renderer. You could use the canvas renderer and see how exactly the line height is being taken into account for the selection stuff. That way you can apply whatever the canvas renderer does to the DOM renderer.
No rush of course, that was just me organizing a little. |
@Tyriar Yeah, I didn't mean to change canvas renderer nor selection at all, when I noticed the What I noticed is:
Inside I have not been able to track down why it happens. |
src/Terminal.ts
Outdated
@@ -473,6 +473,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II | |||
if (this._theme) { | |||
this.renderer.setTheme(this._theme); | |||
} | |||
this.mouseHelper = new MouseHelper(this.renderer); |
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.
@Tyriar when lineHeight
is updated, it falls through to rendererType
, and thus destroying the renderer, in which mouseHelper is never updated.
I am not sure we want to destroy the current renderer when those props are updated.
Either way, selection works properly with this change.
Just in case something hangs onto MouseHelper
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 for figuring that out 😄
Looks good, I made a couple of tweaks
Related to #1700. I've attempted to port the calculations from Canvas renderer, it seems to be a few pixels off.
Also, does xterm.js support zooming the browser officially? That is not working properly.
@Tyriar, can you please take a look.