Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
pikulev authored Jan 19, 2019
2 parents 685211f + fce5a2b commit eb33f7c
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 32 deletions.
37 changes: 36 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# Change Log

## [v1.0.2](https://github.com/vscodevim/vim/tree/v1.0.2) (2019-01-16)

[Full Changelog](https://github.com/vscodevim/vim/compare/v1.0.1...v1.0.2)

**Enhancements:**

- Show Number of Lines Yanked/Pasted [\#3266](https://github.com/VSCodeVim/Vim/issues/3266)

**Fixed Bugs:**

- Error handling key \<C-d\>: Illegal value for line [\#3345](https://github.com/VSCodeVim/Vim/issues/3345)
- :set hlsearch? makes plugin freeze out [\#3344](https://github.com/VSCodeVim/Vim/issues/3344)
- ge doesn't go to the previous line [\#3285](https://github.com/VSCodeVim/Vim/issues/3285)

**Closed issues:**

- Movements with 0 fail! [\#3349](https://github.com/VSCodeVim/Vim/issues/3349)
- \<C-r\> does not redo \(opens recent menu\). [\#3346](https://github.com/VSCodeVim/Vim/issues/3346)
- can't support the command that can Indent multiple lines of code [\#3340](https://github.com/VSCodeVim/Vim/issues/3340)
- ModeHandler: error handling key=\<C-a\>, err=TypeError: Cannot read property 'match' of undefined [\#3332](https://github.com/VSCodeVim/Vim/issues/3332)
- command mode :.t\[line_number\] [\#3269](https://github.com/VSCodeVim/Vim/issues/3269)

**Merged pull requests:**

- Update dependency tslint to v5.12.1 [\#3356](https://github.com/VSCodeVim/Vim/pull/3356) ([renovate-bot](https://github.com/renovate-bot))
- Update dependency gulp-git to v2.8.1 [\#3353](https://github.com/VSCodeVim/Vim/pull/3353) ([renovate-bot](https://github.com/renovate-bot))
- Update dependency gulp-bump to v3.1.3 [\#3352](https://github.com/VSCodeVim/Vim/pull/3352) ([renovate-bot](https://github.com/renovate-bot))
- Move setoptions querying to status bar [\#3348](https://github.com/VSCodeVim/Vim/pull/3348) ([xconverge](https://github.com/xconverge))
- fixes \#3345 [\#3347](https://github.com/VSCodeVim/Vim/pull/3347) ([xconverge](https://github.com/xconverge))
- fixes \#3332 [\#3342](https://github.com/VSCodeVim/Vim/pull/3342) ([xconverge](https://github.com/xconverge))
- Fixes \#3266 Report lines changed [\#3341](https://github.com/VSCodeVim/Vim/pull/3341) ([xconverge](https://github.com/xconverge))
- v1.0.1 [\#3339](https://github.com/VSCodeVim/Vim/pull/3339) ([jpoon](https://github.com/jpoon))
- Fix the issue of "ge" command [\#3322](https://github.com/VSCodeVim/Vim/pull/3322) ([zhuzisheng](https://github.com/zhuzisheng))

## [v1.0.1](https://github.com/vscodevim/vim/tree/v1.0.1) (2019-01-06)

[Full Changelog](https://github.com/vscodevim/vim/compare/v1.0.0...v1.0.1)
Expand Down Expand Up @@ -37,7 +71,8 @@ The first commit to this project was a little over 3 years ago, and what a journ
**Breaking Change:**

- `vim.debug.loggingLevel` has been removed. In it's place we now have `vim.debug.loggingLevelForConsole`. For full details, see the [settings section of our README](https://github.com/VSCodeVim/Vim#vscodevim-settings).
**Enhancements:**

**Enhancements:**

- feat: change debug configurations to loggingLevelForConsole, loggingLevelForAlert [\#3325](https://github.com/VSCodeVim/Vim/pull/3325) ([jpoon](https://github.com/jpoon))

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![http://aka.ms/vscodevim](https://vsmarketplacebadge.apphb.com/version/vscodevim.vim.svg)](http://aka.ms/vscodevim)
[![](https://vsmarketplacebadge.apphb.com/installs-short/vscodevim.vim.svg)](https://marketplace.visualstudio.com/items?itemName=vscodevim.vim)
[![https://travis-ci.org/VSCodeVim/Vim](https://travis-ci.org/VSCodeVim/Vim.svg?branch=master)](https://travis-ci.org/VSCodeVim/Vim)
[![https://vscodevim-slackin.azurewebsites.net](https://img.shields.io/badge/vscodevim-slack-blue.svg?logo=slack)](https://vscodevim-slackin.azurewebsites.net)
[![http://vscodevim.herokuapp.com/](https://img.shields.io/badge/vscodevim-slack-blue.svg?logo=slack)](http://vscodevim.herokuapp.com/)

VSCodeVim is a Vim emulator for [Visual Studio Code](https://code.visualstudio.com/).

Expand Down
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Vim",
"description": "Vim emulation for Visual Studio Code",
"icon": "images/icon.png",
"version": "1.0.1",
"version": "1.0.2",
"publisher": "vscodevim",
"galleryBanner": {
"color": "#e3f4ff",
Expand Down Expand Up @@ -699,10 +699,10 @@
"devDependencies": {
"@types/diff": "3.5.2",
"@types/diff-match-patch": "1.0.32",
"@types/lodash": "4.14.119",
"@types/lodash": "4.14.120",
"@types/mocha": "5.2.5",
"@types/node": "9.6.41",
"@types/sinon": "7.0.3",
"@types/sinon": "7.0.4",
"gulp": "4.0.0",
"gulp-bump": "3.1.3",
"gulp-git": "2.8.1",
Expand All @@ -716,7 +716,7 @@
"prettier": "1.15.3",
"sinon": "7.2.2",
"tslint": "5.12.1",
"typescript": "3.2.2",
"typescript": "3.2.4",
"vscode": "1.1.26"
}
}
49 changes: 37 additions & 12 deletions src/actions/commands/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -684,11 +684,15 @@ class CommandMoveHalfPageDown extends CommandEditorScroll {
});

const newFirstLine = editor.visibleRanges[0].start.line;
let newPosition = new Position(newFirstLine + lineOffset, startColumn);
const newPositionLine = newFirstLine + lineOffset;
let newPosition;

const maxLineValue = TextEditor.getLineCount() - 1;
if (newPosition.line > maxLineValue) {
if (newPositionLine > maxLineValue) {
newPosition = new Position(0, 0).getDocumentEnd();
} else {
const newPositionColumn = Math.min(startColumn, TextEditor.getLineMaxColumn(newPositionLine));
newPosition = new Position(newPositionLine, newPositionColumn);
}

if (newPosition.isValid()) {
Expand Down Expand Up @@ -1411,14 +1415,18 @@ export class PutCommand extends BaseCommand {
.join('\n');
}

if (after) {
if (register.registerMode === RegisterMode.LineWise) {
// P insert before current line
textToAdd = text + '\n';
whereToAddText = dest.getLineBegin();
if (after) {
textToAdd = text + '\n';
whereToAddText = dest.getLineBegin();
} else {
textToAdd = '\n' + text;
whereToAddText = dest.getLineEnd();
}
} else {
// p paste after current line
textToAdd = '\n' + text;
whereToAddText = dest.getLineEnd();
textToAdd = text;
whereToAddText = after ? position : position.getRight();
}
}

Expand Down Expand Up @@ -1470,10 +1478,20 @@ export class PutCommand extends BaseCommand {
} else {
if (text.indexOf('\n') === -1) {
if (!position.isLineEnd()) {
if (after) {
diff = new PositionDiff(0, -1);
if (
register.registerMode === RegisterMode.BlockWise
) {
if (after) {
diff = new PositionDiff(0, -1 * text.length);
} else {
diff = new PositionDiff(0, 1);
}
} else {
diff = new PositionDiff(0, textToAdd.length);
if (after) {
diff = new PositionDiff(0, -1);
} else {
diff = new PositionDiff(0, textToAdd.length);
}
}
}
} else {
Expand Down Expand Up @@ -3604,14 +3622,21 @@ class ActionXVisualBlock extends BaseCommand {
}

public async exec(position: Position, vimState: VimState): Promise<VimState> {
for (const { start, end } of Position.IterateLine(vimState)) {
const lines: string[] = [];

for (const { line, start, end } of Position.IterateLine(vimState)) {
lines.push(line);
vimState.recordedState.transformations.push({
type: 'deleteRange',
range: new Range(start, end),
manuallySetCursorPositions: true,
});
}

const text = lines.length === 1 ? lines[0] : lines.join('\n');
vimState.currentRegisterMode = RegisterMode.BlockWise;
Register.put(text, vimState, this.multicursorIndex);

const topLeft = VisualBlockMode.getTopLeftPosition(
vimState.cursorPosition,
vimState.cursorStartPosition
Expand Down
10 changes: 9 additions & 1 deletion src/actions/operator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,18 @@ export class YankVisualBlockMode extends BaseOperator {
public async run(vimState: VimState, start: Position, end: Position): Promise<VimState> {
let toCopy: string = '';

const isMultiline = start.line !== end.line;

for (const { line } of Position.IterateLine(vimState)) {
toCopy += line + '\n';
if (isMultiline) {
toCopy += line + '\n';
} else {
toCopy = line;
}
}

vimState.currentRegisterMode = RegisterMode.BlockWise;

Register.put(toCopy, vimState, this.multicursorIndex);

const numLinesYanked = toCopy.split('\n').length;
Expand Down
2 changes: 2 additions & 0 deletions src/jumps/jumpTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Position } from './../common/motion/position';
import { VimState } from '../state/vimState';

import { Jump } from './jump';
import { getCursorsAfterSync } from '../util/util';

/**
* JumpTracker is a handrolled version of vscode's TextEditorState
Expand Down Expand Up @@ -183,6 +184,7 @@ export class JumpTracker {

if (jumpedFiles) {
await this.performFileJump(jump, vimState);
vimState.allCursors = await getCursorsAfterSync();
} else {
vimState.cursorPosition = jump.position;
}
Expand Down
14 changes: 11 additions & 3 deletions src/statusBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ class StatusBarImpl implements vscode.Disposable {
}

private UpdateColor(mode: ModeName) {
let foreground;
let background;
let foreground: string | undefined = undefined;
let background: string | undefined = undefined;

let colorToSet = configuration.statusBarColors[ModeName[mode].toLowerCase()];

const colorToSet = configuration.statusBarColors[ModeName[mode].toLowerCase()];
if (colorToSet !== undefined) {
if (typeof colorToSet === 'string') {
background = colorToSet;
Expand All @@ -82,6 +83,13 @@ class StatusBarImpl implements vscode.Disposable {
'statusBar.foreground': `${foreground}`,
});

// if colors are undefined, return to vscode defaults
if (background === undefined) {
delete colorCustomizations['statusBar.background'];
delete colorCustomizations['statusBar.noFolderBackground'];
delete colorCustomizations['statusBar.debuggingBackground'];
}

if (foreground === undefined) {
delete colorCustomizations['statusBar.foreground'];
}
Expand Down
28 changes: 28 additions & 0 deletions test/operator/put.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,32 @@ suite('put operator', () => {
keysPressed: '2yyjjpk',
end: ['one', 'two', '|three', 'one', 'two', 'four'],
});

newTest({
title: 'test visual block single line yank p',
start: ['12|345'],
keysPressed: '<C-v>llyhp',
end: ['12|345345'],
});

newTest({
title: 'test visual block single line yank P',
start: ['12|345'],
keysPressed: '<C-v>llyhP',
end: ['1|3452345'],
});

newTest({
title: 'test visual block single line delete p',
start: ['12|345'],
keysPressed: '<C-v>lldhp',
end: ['1|3452'],
});

newTest({
title: 'test visual block single line delete P',
start: ['12|345'],
keysPressed: '<C-v>lldhP',
end: ['|34512'],
});
});

0 comments on commit eb33f7c

Please sign in to comment.