Skip to content
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

Render the cursor in the webgl canvas #4082

Closed
Tyriar opened this issue Aug 28, 2022 · 5 comments
Closed

Render the cursor in the webgl canvas #4082

Tyriar opened this issue Aug 28, 2022 · 5 comments
Assignees
Labels
area/addon/webgl area/performance type/debt Technical debt that could slow us down in the long run type/enhancement Features or improvements to existing features
Milestone

Comments

@Tyriar
Copy link
Member

Tyriar commented Aug 28, 2022

This was always a todo with the webgl renderer. Currently it's rendered using a cursor render layer like the canvas renderer, this means more code, an extra canvas/texture and potentially inconsistent rendering. The below is showing the selection (right) next to the cursor (left):

image

@Tyriar Tyriar added type/enhancement Features or improvements to existing features type/debt Technical debt that could slow us down in the long run area/performance area/addon/webgl labels Aug 28, 2022
@Tyriar
Copy link
Member Author

Tyriar commented Aug 28, 2022

This could be bad for battery when cursor blinking is enabled?

@jerch
Copy link
Member

jerch commented Sep 3, 2022

Would applying {powerPreference: 'low-power'} to getContext help to reduce power drainage? Though I am not sure, how support state for that flag among browsers is.

@Tyriar
Copy link
Member Author

Tyriar commented Dec 15, 2022

Huh, I didn't know that existed. The extra cost would mainly be when the cursor is blinking, if that could move into the shader so it didn't need buffer updates that would be best.

@xzfc
Copy link
Contributor

xzfc commented Jun 18, 2023

The extra cost would mainly be when the cursor is blinking, if that could move into the shader so it didn't need buffer updates that would be best.

To use a shader, we still need to perform a render (i.e. call WebglRenderer.render() and GlyphRenderer.render()) on cursor change. If we are doing render anyways, we could just introduce WebglRenderer.renderCursor() (like in PR #4568) instead of using a shader.

@Tyriar Tyriar added this to the 5.3.0 milestone Jul 28, 2023
@Tyriar
Copy link
Member Author

Tyriar commented Aug 1, 2023

To solve the power problem, maybe we should just detect when the terminal is focused and idle as that's the main case I'm concerned about. Something like a setTimeout(2 * 60 * 1000) which clears on focus out and resets on any input. Let's tackle that separately to #4568 though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/addon/webgl area/performance type/debt Technical debt that could slow us down in the long run type/enhancement Features or improvements to existing features
Projects
None yet
Development

No branches or pull requests

3 participants