Merge from vscode f5d3ffa6a0d655c87e1eb0e1e90773df58f7ff25 (#7929)

* Merge from vscode f5d3ffa6a0d655c87e1eb0e1e90773df58f7ff25

* fix launch script

* add missing files
This commit is contained in:
Anthony Dresser
2019-10-22 21:49:55 -07:00
committed by GitHub
parent 4a68ab4659
commit a94cbb528e
189 changed files with 1976 additions and 1541 deletions

View File

@@ -726,6 +726,45 @@ suite('Editor Controller - Cursor', () => {
});
});
test('combining marks', () => {
withTestCodeEditor([
'abcabc',
'ãããããã',
'辻󠄀辻󠄀辻󠄀',
'பு',
], {}, (editor, cursor) => {
cursor.setSelections('test', [new Selection(2, 1, 2, 1)]);
moveRight(cursor);
assertCursor(cursor, new Position(2, 3));
moveLeft(cursor);
assertCursor(cursor, new Position(2, 1));
cursor.setSelections('test', [new Selection(3, 1, 3, 1)]);
moveRight(cursor);
assertCursor(cursor, new Position(3, 4));
moveLeft(cursor);
assertCursor(cursor, new Position(3, 1));
cursor.setSelections('test', [new Selection(4, 1, 4, 1)]);
moveRight(cursor);
assertCursor(cursor, new Position(4, 3));
moveLeft(cursor);
assertCursor(cursor, new Position(4, 1));
cursor.setSelections('test', [new Selection(1, 3, 1, 3)]);
moveDown(cursor);
assertCursor(cursor, new Position(2, 5));
moveDown(cursor);
assertCursor(cursor, new Position(3, 4));
moveUp(cursor);
assertCursor(cursor, new Position(2, 5));
moveUp(cursor);
assertCursor(cursor, new Position(1, 3));
});
});
test('issue #4905 - column select is biased to the right', () => {
const model = createTextModel([
'var gulp = require("gulp");',
@@ -4990,6 +5029,26 @@ suite('autoClosingPairs', () => {
mode.dispose();
});
test('issue #82701: auto close does not execute when IME is canceled via backspace', () => {
let mode = new AutoClosingMode();
usingCursor({
text: [
'{}'
],
languageIdentifier: mode.getLanguageIdentifier()
}, (model, cursor) => {
cursor.setSelections('test', [new Selection(1, 2, 1, 2)]);
// Typing a + backspace
cursorCommand(cursor, H.CompositionStart, null, 'keyboard');
cursorCommand(cursor, H.Type, { text: 'a' }, 'keyboard');
cursorCommand(cursor, H.ReplacePreviousChar, { replaceCharCnt: 1, text: '' }, 'keyboard');
cursorCommand(cursor, H.CompositionEnd, null, 'keyboard');
assert.equal(model.getValue(), '{}');
});
mode.dispose();
});
test('issue #20891: All cursors should do the same thing', () => {
let mode = new AutoClosingMode();
usingCursor({

View File

@@ -168,7 +168,7 @@ suite('CursorMove', () => {
testColumnFromVisibleColumn('baz', 4, 3, 4);
testColumnFromVisibleColumn('📚az', 4, 0, 1);
testColumnFromVisibleColumn('📚az', 4, 1, 2);
testColumnFromVisibleColumn('📚az', 4, 1, 1);
testColumnFromVisibleColumn('📚az', 4, 2, 3);
testColumnFromVisibleColumn('📚az', 4, 3, 4);
testColumnFromVisibleColumn('📚az', 4, 4, 5);

View File

@@ -743,6 +743,87 @@ suite('Editor Model - TextModel', () => {
assert.deepEqual(m.validatePosition(new Position(2, 1.5)), new Position(2, 1), 'h');
});
function assertValidatePosition(m: TextModel, lineNumber: number, column: number, expectedColumn: number): void {
const input = new Position(lineNumber, column);
const actual = m.validatePosition(input);
const expected = new Position(lineNumber, expectedColumn);
assert.deepEqual(actual, expected, `validatePosition for ${input}, got ${actual}, expected ${expected}`);
}
function assertValidateRange(m: TextModel, input: Range, expected: Range): void {
const actual = m.validateRange(input);
assert.deepEqual(actual, expected, `validateRange for ${input}, got ${actual}, expected ${expected}`);
}
test('combining marks', () => {
const m = TextModel.createFromString([
'abcabc',
'ãããããã',
'辻󠄀辻󠄀辻󠄀',
'புபுபு',
].join('\n'));
assertValidatePosition(m, 2, 1, 1);
assertValidatePosition(m, 2, 2, 1);
assertValidatePosition(m, 2, 3, 3);
assertValidatePosition(m, 2, 4, 3);
assertValidatePosition(m, 2, 5, 5);
assertValidatePosition(m, 2, 6, 5);
assertValidatePosition(m, 2, 7, 7);
assertValidatePosition(m, 2, 8, 7);
assertValidatePosition(m, 2, 9, 9);
assertValidatePosition(m, 2, 10, 9);
assertValidatePosition(m, 2, 11, 11);
assertValidatePosition(m, 2, 12, 11);
assertValidatePosition(m, 2, 13, 13);
assertValidatePosition(m, 2, 14, 13);
assertValidatePosition(m, 3, 1, 1);
assertValidatePosition(m, 3, 2, 1);
assertValidatePosition(m, 3, 3, 1);
assertValidatePosition(m, 3, 4, 4);
assertValidatePosition(m, 3, 5, 4);
assertValidatePosition(m, 3, 6, 4);
assertValidatePosition(m, 3, 7, 7);
assertValidatePosition(m, 3, 8, 7);
assertValidatePosition(m, 3, 9, 7);
assertValidatePosition(m, 3, 10, 10);
assertValidatePosition(m, 4, 1, 1);
assertValidatePosition(m, 4, 2, 1);
assertValidatePosition(m, 4, 3, 3);
assertValidatePosition(m, 4, 4, 3);
assertValidatePosition(m, 4, 5, 5);
assertValidatePosition(m, 4, 6, 5);
assertValidatePosition(m, 4, 7, 7);
assertValidateRange(m, new Range(2, 1, 2, 1), new Range(2, 1, 2, 1));
assertValidateRange(m, new Range(2, 1, 2, 2), new Range(2, 1, 2, 3));
assertValidateRange(m, new Range(2, 1, 2, 3), new Range(2, 1, 2, 3));
assertValidateRange(m, new Range(2, 1, 2, 4), new Range(2, 1, 2, 5));
assertValidateRange(m, new Range(2, 1, 2, 5), new Range(2, 1, 2, 5));
assertValidateRange(m, new Range(2, 2, 2, 2), new Range(2, 1, 2, 1));
assertValidateRange(m, new Range(2, 2, 2, 3), new Range(2, 1, 2, 3));
assertValidateRange(m, new Range(2, 2, 2, 4), new Range(2, 1, 2, 5));
assertValidateRange(m, new Range(2, 2, 2, 5), new Range(2, 1, 2, 5));
assertValidateRange(m, new Range(3, 1, 3, 1), new Range(3, 1, 3, 1));
assertValidateRange(m, new Range(3, 1, 3, 2), new Range(3, 1, 3, 4));
assertValidateRange(m, new Range(3, 1, 3, 3), new Range(3, 1, 3, 4));
assertValidateRange(m, new Range(3, 1, 3, 4), new Range(3, 1, 3, 4));
assertValidateRange(m, new Range(3, 1, 3, 5), new Range(3, 1, 3, 7));
assertValidateRange(m, new Range(3, 1, 3, 6), new Range(3, 1, 3, 7));
assertValidateRange(m, new Range(3, 1, 3, 7), new Range(3, 1, 3, 7));
assertValidateRange(m, new Range(3, 2, 3, 2), new Range(3, 1, 3, 1));
assertValidateRange(m, new Range(3, 2, 3, 3), new Range(3, 1, 3, 4));
assertValidateRange(m, new Range(3, 2, 3, 4), new Range(3, 1, 3, 4));
assertValidateRange(m, new Range(3, 2, 3, 5), new Range(3, 1, 3, 7));
assertValidateRange(m, new Range(3, 2, 3, 6), new Range(3, 1, 3, 7));
assertValidateRange(m, new Range(3, 2, 3, 7), new Range(3, 1, 3, 7));
m.dispose();
});
test('issue #71480: validateRange handle floats', () => {
let m = TextModel.createFromString('line one\nline two');