Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes #191

Merged
merged 2 commits into from
Mar 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,33 @@ var gulp = require('gulp'),
shell = require('gulp-shell'),
mocha = require('gulp-mocha'),
soften = require('gulp-soften'),
git = require('gulp-git'),
bump = require('gulp-bump'),
filter = require('gulp-filter'),
tag_version = require('gulp-tag-version'),
trimlines = require('gulp-trimlines');

var paths = {
scripts_ts: "src/**/*.ts",
tests_ts: "test/**/*.ts"
};

function versionBump(importance) {
return gulp.src(['./package.json'])
.pipe(bump({type: importance}))
.pipe(gulp.dest('./'))
.pipe(git.commit('bump package version'))
.pipe(filter('package.json'))
.pipe(tag_version());
}

gulp.task('patch', function() { return versionBump('patch'); })
gulp.task('feature', function() { return versionBump('minor'); })
gulp.task('release', function() { return versionBump('major'); })

gulp.task('typings', function () {
// reinstall typescript definitions
return gulp.src('./typings.json')
.pipe(typings());
.pipe(typings());
});

gulp.task('fix-whitespace', function() {
Expand Down Expand Up @@ -42,3 +58,4 @@ gulp.task('compile', shell.task([

gulp.task('init', ['typings']);
gulp.task('default', ['tslint', 'compile']);
gulp.task('release', ['default', 'patch']);
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,13 @@
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-bump": "^2.0.1",
"gulp-filter": "^4.0.0",
"gulp-git": "^1.7.0",
"gulp-mocha": "^2.2.0",
"gulp-shell": "^0.5.2",
"gulp-soften": "^0.0.1",
"gulp-tag-version": "^1.3.0",
"gulp-trimlines": "^1.0.0",
"gulp-tslint": "^4.3.2",
"gulp-typescript": "^2.12.0",
Expand Down
8 changes: 5 additions & 3 deletions src/mode/modeNormal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,16 @@ export class NormalMode extends Mode {
"dw" : async (m) => {
m.changeMode(MotionMode.Cursor);
await new DeleteOperator(this._modeHandler).run(m.position, m.position.getWordRight());
this.motion.left().move();

if (m.lineEnd().position === m.position) {
m.left().move();
}

return {};
},
"dW" : async (m) => {
m.changeMode(MotionMode.Cursor);
await new DeleteOperator(this._modeHandler).run(m.position, m.position.getBigWordRight());
this.motion.left().move();
return {};
},
"db" : async (m) => {
Expand All @@ -113,7 +116,6 @@ export class NormalMode extends Mode {
"de" : async (m) => {
m.changeMode(MotionMode.Cursor);
await new DeleteOperator(this._modeHandler).run(m.position, m.position.getCurrentWordEnd());
this.motion.left().move();
return {};
},
"dE" : async (m) => {
Expand Down
4 changes: 1 addition & 3 deletions src/operator/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export class DeleteOperator {
* Run this operator on a range.
*/
public async run(start: Position, end: Position): Promise<void> {

// Imagine we have selected everything with an X in
// the following text (there is no character on the
// second line at all, just a block cursor):
Expand All @@ -32,12 +31,11 @@ export class DeleteOperator {
// second lines. Therefore we have to advance the cursor to the next
// line.

if (TextEditor.getLineAt(end).text === "") {
if (start.line !== end.line && TextEditor.getLineAt(end).text === "") {
end = end.getDown(0);
}

await TextEditor.delete(new vscode.Range(start, end));

this._modeHandler.setCurrentModeByName(ModeName.Normal);
}
}