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

Add option to control width of the line cursor #41169

Merged
merged 3 commits into from
Jan 10, 2018
Merged

Conversation

ramya-rao-a
Copy link
Contributor

@ramya-rao-a ramya-rao-a commented Jan 5, 2018

@ramya-rao-a ramya-rao-a self-assigned this Jan 5, 2018
@@ -105,6 +107,7 @@ export class ViewCursor {
}
if (e.viewInfo) {
this._cursorStyle = this._context.configuration.editor.viewInfo.cursorStyle;
this._lineCursorWidth = Math.min(this._context.configuration.editor.viewInfo.lineCursorWidth, this._typicalHalfwidthCharacterWidth);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this._typicalHalfwidthCharacterWidth might change in next block, which makes this._lineCursorWidth out of date.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -119,6 +122,8 @@ export class ViewCursor {
}

private _prepareRender(ctx: RenderingContext): ViewCursorRenderData {
let textContent = '';
const lineContent = this._context.model.getLineContent(this._position.lineNumber);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to put this expression still in if blocks to avoid unnecessary line content read

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@rebornix
Copy link
Member

rebornix commented Jan 9, 2018

The code looks good to me in general 👍 . IMHO it would be better if we have this option for cursor style block instead of line:

  • Right now by definition CursorStyle.Line and LineThin are displaying cursor as a vertical line between characters, while CursorStyle.Block is on top of a character. Adding this options makes the cursor now displays on top of characters (if the width is large), ppl may call it half-width-block cursor or partial-block-cursor
  • Or maybe we simply call it cursorWidth and apply this to all cursor styles.

update
I started to think about what's the real feature request for wide caret. Doesn't our Block cursor meet their need, or they want half-block-cursor? Or maybe they want to have wide caret for cursor styles other than Line @ramya-rao-a

@ramya-rao-a
Copy link
Contributor Author

I started to think about what's the real feature request for wide caret. Doesn't our Block cursor meet their need, or they want half-block-cursor? Or maybe they want to have wide caret for cursor styles other than Line

The request is to have a vertical cursor thicker than the current line style but not as wide as the block style.

@ramya-rao-a ramya-rao-a merged commit 2bab83a into master Jan 10, 2018
@alexdima
Copy link
Member

alexdima commented Jan 10, 2018

Sorry for the late feedback, should we call the option cursorWidth with a default of 0. Then, it would align with the other cursor rendering options cursorBlinking and cursorStyle.

If the default of 0 is untouched, the cursor width is computed as it is before the PR. If a different value is provided, the cursor will be the width (in px) of the provided value.

@ramya-rao-a
Copy link
Contributor Author

@alexandrudima Done with 17b1aaf

@ramya-rao-a ramya-rao-a deleted the cursorStyle branch July 23, 2018 00:51
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants