Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Revert "Merge pull request #853 from yacut/restore-cursor-position-af…
Browse files Browse the repository at this point in the history
…ter-fix"

This reverts commit 27d5570.
  • Loading branch information
Arcanemagus committed Apr 6, 2017
1 parent b6bdeb1 commit e71c8b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
14 changes: 1 addition & 13 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,12 @@ module.exports = {
rules = ignoredRulesWhenFixing;
}

// The fix replaces the file content and the cursor jumps automatically
// to the beginning of the file, so save current cursor position
const cursorPosition = editor.getCursorBufferPosition();
this.worker.request('job', {
type: 'fix',
config: atom.config.get('linter-eslint'),
rules,
filePath,
projectPath
}).then(() => {
// set cursor to the position before fix job
editor.setCursorBufferPosition(cursorPosition);
}).catch(err => {
atom.notifications.addWarning(err.message);
});
Expand Down Expand Up @@ -120,19 +114,13 @@ module.exports = {
rules = ignoredRulesWhenFixing;
}

// The fix replaces the file content and the cursor jumps automatically
// to the beginning of the file, so save current cursor position
const cursorPosition = textEditor.getCursorBufferPosition();
this.worker.request('job', {
type: 'fix',
config: atom.config.get('linter-eslint'),
rules,
filePath,
projectPath
}).then(response => atom.notifications.addSuccess(response)).then(() => {
// set cursor to the position before fix job
textEditor.setCursorBufferPosition(cursorPosition);
}).catch(err => {
}).then(response => atom.notifications.addSuccess(response)).catch(err => {
atom.notifications.addWarning(err.message);
});
}
Expand Down
14 changes: 1 addition & 13 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,12 @@ module.exports = {
rules = ignoredRulesWhenFixing
}

// The fix replaces the file content and the cursor jumps automatically
// to the beginning of the file, so save current cursor position
const cursorPosition = editor.getCursorBufferPosition()
this.worker.request('job', {
type: 'fix',
config: atom.config.get('linter-eslint'),
rules,
filePath,
projectPath
}).then(() => {
// set cursor to the position before fix job
editor.setCursorBufferPosition(cursorPosition)
}).catch((err) => {
atom.notifications.addWarning(err.message)
})
Expand Down Expand Up @@ -110,9 +104,6 @@ module.exports = {
rules = ignoredRulesWhenFixing
}

// The fix replaces the file content and the cursor jumps automatically
// to the beginning of the file, so save current cursor position
const cursorPosition = textEditor.getCursorBufferPosition()
this.worker.request('job', {
type: 'fix',
config: atom.config.get('linter-eslint'),
Expand All @@ -121,10 +112,7 @@ module.exports = {
projectPath
}).then(response =>
atom.notifications.addSuccess(response)
).then(() => {
// set cursor to the position before fix job
textEditor.setCursorBufferPosition(cursorPosition)
}).catch((err) => {
).catch((err) => {
atom.notifications.addWarning(err.message)
})
}
Expand Down

0 comments on commit e71c8b7

Please sign in to comment.