mirror of
https://github.com/VSCodeVim/Vim.git
synced 2024-08-17 00:00:26 +03:00
Makes all tests pass on Windows (#1939)
* appveyor config v1 * typo * choco failing - getting more info * force install? * ignore dependencies * Dot at the end makes it more obvious what the whole value is * reducing verbosity * fixed read shell command test #1914 special case for win32 + neovim * forgot to remove .only * taking care of the '\r' dangling on lines on win32 #1914 * \\n doesn't translate to new-line on Windows. \\r\\n does fixing failed test 4 of #1914 * prettified the code
This commit is contained in:
parent
9925a7edfc
commit
6b702872e7
16
appveyor.yml
Normal file
16
appveyor.yml
Normal file
@ -0,0 +1,16 @@
|
||||
environment:
|
||||
node_version: "6.11.1"
|
||||
PATH: c:\tools\neovim\Neovim\bin;$(PATH)
|
||||
|
||||
install:
|
||||
- ps: Install-Product node $env:node_version
|
||||
- choco install neovim --pre -fy --ignoredependencies
|
||||
- npm install -g gulp
|
||||
- npm install
|
||||
|
||||
build_script:
|
||||
- gulp
|
||||
|
||||
test_script:
|
||||
- nvim --version
|
||||
- npm test --silent
|
@ -76,6 +76,12 @@ export class Neovim {
|
||||
static async syncVimToVs(vimState: VimState) {
|
||||
const nvim = vimState.nvim;
|
||||
const buf = await nvim.getCurrentBuf();
|
||||
const lines = await buf.getLines(0, -1, false);
|
||||
|
||||
// one Windows, lines that went to nvim and back have a '\r' at the end,
|
||||
// which causes the issues exhibited in #1914
|
||||
const fixedLines =
|
||||
process.platform === 'win32' ? lines.map((line, index) => line.replace(/\r$/, '')) : lines;
|
||||
|
||||
await TextEditor.replace(
|
||||
new vscode.Range(
|
||||
@ -84,9 +90,11 @@ export class Neovim {
|
||||
TextEditor.getLineCount() - 1,
|
||||
TextEditor.getLineMaxColumn(TextEditor.getLineCount() - 1)
|
||||
),
|
||||
(await buf.getLines(0, -1, false)).join('\n')
|
||||
fixedLines.join('\n')
|
||||
);
|
||||
|
||||
console.log(`${lines.length} lines in nvime but ${TextEditor.getLineCount()} in editor.`);
|
||||
|
||||
let [row, character] = ((await nvim.callFunction('getpos', ['.'])) as Array<number>).slice(
|
||||
1,
|
||||
3
|
||||
|
@ -3,6 +3,7 @@ import {
|
||||
setTextEditorOptions,
|
||||
cleanUpWorkspace,
|
||||
assertEqual,
|
||||
crossPlatformIt,
|
||||
} from './../testUtils';
|
||||
import { ModeName } from '../../src/mode/mode';
|
||||
import { ModeHandler } from '../../src/mode/modeHandler';
|
||||
@ -1485,14 +1486,14 @@ suite('Mode Normal', () => {
|
||||
newTest({
|
||||
title: '/ can search with newline',
|
||||
start: ['|asdf', '__asdf', 'asdf'],
|
||||
keysPressed: '/\\nasdf\n',
|
||||
keysPressed: crossPlatformIt('/\\nasdf\n'),
|
||||
end: ['asdf', '__asd|f', 'asdf'],
|
||||
});
|
||||
|
||||
newTest({
|
||||
title: '/ can search through multiple newlines',
|
||||
start: ['|asdf', '__asdf', 'asdf', 'abc', ' abc'],
|
||||
keysPressed: '/asdf\\nasdf\\nabc\n',
|
||||
keysPressed: crossPlatformIt('/asdf\\nasdf\\nabc\n'),
|
||||
end: ['asdf', '__|asdf', 'asdf', 'abc', ' abc'],
|
||||
});
|
||||
|
||||
|
@ -96,3 +96,10 @@ export function setTextEditorOptions(tabSize: number, insertSpaces: boolean): vo
|
||||
options.insertSpaces = insertSpaces;
|
||||
vscode.window.activeTextEditor!.options = options;
|
||||
}
|
||||
|
||||
export function crossPlatformIt(text: string): string {
|
||||
if (process.platform === 'win32') {
|
||||
return text.replace(/\\n/g, '\\r\\n');
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user