提交 8992f2eb 编写于 作者: A Alex Dima

Rename wordWrap settings (#21262)

上级 fe9c6332
......@@ -213,12 +213,12 @@ class InternalEditorOptionsHelper {
isViewportWrapping: true,
wrappingColumn: Math.max(1, layoutInfo.viewportColumn)
};
} else if (wordWrap === 'clamped') {
} else if (wordWrap === 'bounded') {
bareWrappingInfo = {
isViewportWrapping: true,
wrappingColumn: Math.min(Math.max(1, layoutInfo.viewportColumn), wordWrapColumn)
};
} else if (wordWrap === 'fixed') {
} else if (wordWrap === 'wordWrapColumn') {
bareWrappingInfo = {
isViewportWrapping: false,
wrappingColumn: wordWrapColumn
......@@ -690,15 +690,15 @@ const editorConfiguration: IConfigurationNode = {
},
'editor.wordWrap': {
'type': 'string',
'enum': ['off', 'on', 'fixed', 'clamped'],
'enum': ['off', 'on', 'wordWrapColumn', 'bounded'],
'default': DefaultConfig.editor.wordWrap,
'description': nls.localize('wordWrap', "Controls how lines should wrap. Can be: 'off' (disable wrapping), 'on' (viewport wrapping), 'fixed' (wrap at `editor.wordWrapColumn`) or 'clamped' (wrap at minimum of viewport and `editor.wordWrapColumn`).")
'description': nls.localize('wordWrap', "Controls how lines should wrap. Can be: 'off' (disable wrapping), 'on' (viewport wrapping), 'wordWrapColumn' (wrap at `editor.wordWrapColumn`) or 'bounded' (wrap at minimum of viewport and `editor.wordWrapColumn`).")
},
'editor.wordWrapColumn': {
'type': 'integer',
'default': DefaultConfig.editor.wordWrapColumn,
'minimum': 1,
'description': nls.localize('wordWrapColumn', "Controls the wrapping column of the editor when `editor.wordWrap` is 'fixed' or 'clamped'.")
'description': nls.localize('wordWrapColumn', "Controls the wrapping column of the editor when `editor.wordWrap` is 'wordWrapColumn' or 'bounded'.")
},
'editor.wrappingIndent': {
'type': 'string',
......
......@@ -343,17 +343,17 @@ export interface IEditorOptions {
* Control the wrapping of the editor.
* When `wordWrap` = "off", the lines will never wrap.
* When `wordWrap` = "on", the lines will wrap at the viewport width.
* When `wordWrap` = "fixed", the lines will wrap at `wordWrapColumn`.
* When `wordWrap` = "clamped", the lines will wrap at min(viewport width, wordWrapColumn).
* When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.
* When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).
* Defaults to "off".
*/
wordWrap?: 'off' | 'on' | 'fixed' | 'clamped';
wordWrap?: 'off' | 'on' | 'wordWrapColumn' | 'bounded';
/**
* Control the wrapping of the editor.
* When `wordWrap` = "off", the lines will never wrap.
* When `wordWrap` = "on", the lines will wrap at the viewport width.
* When `wordWrap` = "fixed", the lines will wrap at `wordWrapColumn`.
* When `wordWrap` = "clamped", the lines will wrap at min(viewport width, wordWrapColumn).
* When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.
* When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).
* Defaults to 80.
*/
wordWrapColumn?: number;
......
......@@ -111,47 +111,47 @@ suite('Common Editor Config', () => {
assertWrapping(config, false, -1);
});
test('wordWrap fixed uses default wordWrapColumn', () => {
test('wordWrap wordWrapColumn uses default wordWrapColumn', () => {
let config = new TestWrappingConfiguration({
wordWrap: 'fixed'
wordWrap: 'wordWrapColumn'
});
assertWrapping(config, false, 80);
});
test('wordWrap fixed uses wordWrapColumn', () => {
test('wordWrap wordWrapColumn uses wordWrapColumn', () => {
let config = new TestWrappingConfiguration({
wordWrap: 'fixed',
wordWrap: 'wordWrapColumn',
wordWrapColumn: 100
});
assertWrapping(config, false, 100);
});
test('wordWrap fixed validates wordWrapColumn', () => {
test('wordWrap wordWrapColumn validates wordWrapColumn', () => {
let config = new TestWrappingConfiguration({
wordWrap: 'fixed',
wordWrap: 'wordWrapColumn',
wordWrapColumn: -1
});
assertWrapping(config, false, 1);
});
test('wordWrap clamped uses default wordWrapColumn', () => {
test('wordWrap bounded uses default wordWrapColumn', () => {
let config = new TestWrappingConfiguration({
wordWrap: 'clamped'
wordWrap: 'bounded'
});
assertWrapping(config, true, 80);
});
test('wordWrap clamped uses wordWrapColumn', () => {
test('wordWrap bounded uses wordWrapColumn', () => {
let config = new TestWrappingConfiguration({
wordWrap: 'clamped',
wordWrap: 'bounded',
wordWrapColumn: 40
});
assertWrapping(config, true, 40);
});
test('wordWrap clamped validates wordWrapColumn', () => {
test('wordWrap bounded validates wordWrapColumn', () => {
let config = new TestWrappingConfiguration({
wordWrap: 'clamped',
wordWrap: 'bounded',
wordWrapColumn: -1
});
assertWrapping(config, true, 1);
......
......@@ -559,7 +559,7 @@ suite('SplitLinesCollection', () => {
});
test('getViewLinesData - with wrapping', () => {
withSplitLinesCollection(model, 'fixed', 30, (splitLinesCollection) => {
withSplitLinesCollection(model, 'wordWrapColumn', 30, (splitLinesCollection) => {
assert.equal(splitLinesCollection.getViewLineCount(), 12);
assert.equal(splitLinesCollection.modelPositionIsVisible(1, 1), true);
assert.equal(splitLinesCollection.modelPositionIsVisible(2, 1), true);
......@@ -731,7 +731,7 @@ suite('SplitLinesCollection', () => {
});
});
function withSplitLinesCollection(model: Model, wordWrap: 'on' | 'off' | 'fixed' | 'clamped', wordWrapColumn: number, callback: (splitLinesCollection: SplitLinesCollection) => void): void {
function withSplitLinesCollection(model: Model, wordWrap: 'on' | 'off' | 'wordWrapColumn' | 'bounded', wordWrapColumn: number, callback: (splitLinesCollection: SplitLinesCollection) => void): void {
let configuration = new TestConfiguration({
wordWrap: wordWrap,
wordWrapColumn: wordWrapColumn,
......
......@@ -15,7 +15,7 @@ suite('ViewModelDecorations', () => {
'hello world, this is a buffer that will be wrapped'
];
const opts: editorCommon.ICodeEditorWidgetCreationOptions = {
wordWrap: 'fixed',
wordWrap: 'wordWrapColumn',
wordWrapColumn: 13
};
testViewModel(text, opts, (viewModel, model) => {
......@@ -270,7 +270,7 @@ suite('ViewModelDecorations', () => {
'hello world, this is a buffer that will be wrapped'
];
const opts: editorCommon.ICodeEditorWidgetCreationOptions = {
wordWrap: 'fixed',
wordWrap: 'wordWrapColumn',
wordWrapColumn: 13
};
testViewModel(text, opts, (viewModel, model) => {
......
......@@ -1265,17 +1265,17 @@ declare module monaco.editor {
* Control the wrapping of the editor.
* When `wordWrap` = "off", the lines will never wrap.
* When `wordWrap` = "on", the lines will wrap at the viewport width.
* When `wordWrap` = "fixed", the lines will wrap at `wordWrapColumn`.
* When `wordWrap` = "clamped", the lines will wrap at min(viewport width, wordWrapColumn).
* When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.
* When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).
* Defaults to "off".
*/
wordWrap?: 'off' | 'on' | 'fixed' | 'clamped';
wordWrap?: 'off' | 'on' | 'wordWrapColumn' | 'bounded';
/**
* Control the wrapping of the editor.
* When `wordWrap` = "off", the lines will never wrap.
* When `wordWrap` = "on", the lines will wrap at the viewport width.
* When `wordWrap` = "fixed", the lines will wrap at `wordWrapColumn`.
* When `wordWrap` = "clamped", the lines will wrap at min(viewport width, wordWrapColumn).
* When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.
* When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).
* Defaults to 80.
*/
wordWrapColumn?: number;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册