提交 f62ef053 编写于 作者: H Hugo Duthil

Rename cursors styles and add new ones:

New styles:
  - line (default)
  - line-thin
  - block
  - block-outline
  - underline
  - underline-thin

Linked to Feature request: https://github.com/Microsoft/vscode/issues/1929
上级 de9ba120
......@@ -15,7 +15,26 @@
opacity: 0.6;
}
/* -- under-line-style -- */
/* -- line-style -- */
.monaco-editor .cursors-layer.cursor-line-style > .cursor { width: 2px; }
.monaco-editor .cursors-layer.cursor-line-style > .cursor.secondary { width: 1px; }
/* -- line-thin-style -- */
.monaco-editor .cursors-layer.cursor-line-thin-style > .cursor { width: 1px;}
/* -- block-style -- */
.monaco-editor .cursors-layer.cursor-block-style > .cursor { width: 1ch; }
/* -- block-outline-style -- */
.monaco-editor .cursors-layer.cursor-block-outline-style > .cursor {
width: 1ch;
box-sizing: border-box;
background: transparent;
border-style: solid;
border-width: 1px;
}
/* -- underline-style -- */
.monaco-editor .cursors-layer.cursor-underline-style > .cursor {
border-bottom-width: 2px;
border-bottom-style: solid;
......@@ -23,6 +42,15 @@
box-sizing: border-box;
}
/* -- underline-thin-style -- */
.monaco-editor .cursors-layer.cursor-underline-thin-style > .cursor {
width: 1ch;
border-bottom-width: 1px;
border-bottom-style: solid;
background: transparent !important;
box-sizing: border-box;
}
.monaco-editor.vs .cursor {
background: black;
border-color: black;
......
......@@ -233,12 +233,21 @@ export class ViewCursors extends ViewPart {
case editorCommon.TextEditorCursorStyle.Line:
result += ' cursor-line-style';
break;
case editorCommon.TextEditorCursorStyle.LineThin:
result += ' cursor-line-thin-style';
break;
case editorCommon.TextEditorCursorStyle.Block:
result += ' cursor-block-style';
break;
case editorCommon.TextEditorCursorStyle.BlockOutline:
result += ' cursor-block-outline-style';
break;
case editorCommon.TextEditorCursorStyle.Underline:
result += ' cursor-underline-style';
break;
case editorCommon.TextEditorCursorStyle.UnderlineThin:
result += ' cursor-underline-thin-style';
break;
default:
result += ' cursor-line-style';
}
......
......@@ -440,10 +440,16 @@ function wrappingIndentFromString(wrappingIndent: string): editorCommon.Wrapping
function cursorStyleFromString(cursorStyle: string): editorCommon.TextEditorCursorStyle {
if (cursorStyle === 'line') {
return editorCommon.TextEditorCursorStyle.Line;
} else if (cursorStyle === 'line-thin') {
return editorCommon.TextEditorCursorStyle.LineThin;
} else if (cursorStyle === 'block') {
return editorCommon.TextEditorCursorStyle.Block;
} else if (cursorStyle === 'block-outline') {
return editorCommon.TextEditorCursorStyle.BlockOutline;
} else if (cursorStyle === 'underline') {
return editorCommon.TextEditorCursorStyle.Underline;
} else if (cursorStyle === 'underline-thin') {
return editorCommon.TextEditorCursorStyle.UnderlineThin;
}
return editorCommon.TextEditorCursorStyle.Line;
}
......@@ -829,9 +835,9 @@ let editorConfiguration: IConfigurationNode = {
},
'editor.cursorStyle': {
'type': 'string',
'enum': ['block', 'line', 'underline'],
'enum': ['block', 'block-outline', 'line', 'line-thin', 'underline', 'underline-thin'],
'default': DefaultConfig.editor.cursorStyle,
'description': nls.localize('cursorStyle', "Controls the cursor style, accepted values are 'block', 'line' and 'underline'")
'description': nls.localize('cursorStyle', "Controls the cursor style, accepted values are 'block', 'block-outline', 'line', 'line-thin', 'underline' and 'underline-thin'")
},
'editor.fontLigatures': {
'type': 'boolean',
......
......@@ -4514,14 +4514,26 @@ export enum TextEditorCursorStyle {
* As a vertical line (sitting between two characters).
*/
Line = 1,
/**
* As a thin vertical line (sitting between two characters).
*/
LineThin = 2,
/**
* As a block (sitting on top of a character).
*/
Block = 2,
Block = 3,
/**
* As an outlined block (sitting on top of a character).
*/
BlockOutline = 4,
/**
* As a horizontal line (sitting under a character).
*/
Underline = 3
Underline = 5,
/**
* As a thin horizontal line (sitting under a character).
*/
UnderlineThin = 6
}
/**
......@@ -4560,10 +4572,16 @@ export enum TextEditorCursorBlinkingStyle {
export function cursorStyleToString(cursorStyle: TextEditorCursorStyle): string {
if (cursorStyle === TextEditorCursorStyle.Line) {
return 'line';
} else if (cursorStyle === TextEditorCursorStyle.LineThin) {
return 'line-thin';
} else if (cursorStyle === TextEditorCursorStyle.Block) {
return 'block';
} else if (cursorStyle === TextEditorCursorStyle.BlockOutline) {
return 'block-outline';
} else if (cursorStyle === TextEditorCursorStyle.Underline) {
return 'underline';
} else if (cursorStyle === TextEditorCursorStyle.UnderlineThin) {
return 'underline-thin';
} else {
throw new Error('cursorStyleToString: Unknown cursorStyle');
}
......
......@@ -3416,14 +3416,26 @@ declare module monaco.editor {
* As a vertical line (sitting between two characters).
*/
Line = 1,
/**
* As a thin vertical line (sitting between two characters).
*/
LineThin = 2,
/**
* As a block (sitting on top of a character).
*/
Block = 2,
Block = 3,
/**
* As an outlined block (sitting on top of a character).
*/
BlockOutline = 4,
/**
* As a horizontal line (sitting under a character).
*/
Underline = 3,
Underline = 5,
/**
* As a thin horizontal line (sitting under a character).
*/
UnderlineThin = 6,
}
/**
......
......@@ -577,17 +577,29 @@ declare module 'vscode' {
*/
export enum TextEditorCursorStyle {
/**
* Render the cursor as a vertical line.
* Render the cursor as a vertical thick line.
*/
Line = 1,
/**
* Render the cursor as a block.
* Render the cursor as a vertical thin line.
*/
Block = 2,
LineThin = 2,
/**
* Render the cursor as a horizontal line under the character.
* Render the cursor as a block filled.
*/
Underline = 3
Block = 3,
/**
* Render the cursor as a block outlined.
*/
BlockOutline = 4,
/**
* Render the cursor as a thick horizontal line.
*/
Underline = 5,
/**
* Render the cursor as a thin horizontal line.
*/
UnderlineThin = 6
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册