diff --git a/gulpfile.js b/gulpfile.js index a3282560203..7deaa14acd2 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,6 +4,10 @@ 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 = { @@ -11,10 +15,22 @@ var paths = { 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() { @@ -42,3 +58,4 @@ gulp.task('compile', shell.task([ gulp.task('init', ['typings']); gulp.task('default', ['tslint', 'compile']); +gulp.task('release', ['default', 'patch']); \ No newline at end of file diff --git a/package.json b/package.json index fbdbf9d0f0c..c6a847dca49 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/mode/modeNormal.ts b/src/mode/modeNormal.ts index 7a1a66a7c6d..60a02df0ef5 100644 --- a/src/mode/modeNormal.ts +++ b/src/mode/modeNormal.ts @@ -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) => { @@ -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) => { diff --git a/src/operator/delete.ts b/src/operator/delete.ts index 183c83b756d..2e09b56950c 100644 --- a/src/operator/delete.ts +++ b/src/operator/delete.ts @@ -20,7 +20,6 @@ export class DeleteOperator { * Run this operator on a range. */ public async run(start: Position, end: Position): Promise { - // 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): @@ -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); } } \ No newline at end of file