Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1146 from UziTech/patch-1
Browse files Browse the repository at this point in the history
shift replace previous
  • Loading branch information
sadick254 authored Aug 4, 2021
2 parents c02daa0 + 8904d15 commit 9da0512
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/find-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class FindView {
'find-and-replace:use-selection-as-replace-pattern': this.setSelectionAsReplacePattern.bind(this)
}));

this.refs.replaceNextButton.addEventListener('click', this.replaceNext.bind(this));
this.refs.replaceNextButton.addEventListener('click', e => e.shiftKey ? this.replacePrevious() : this.replaceNext()));
this.refs.replaceAllButton.addEventListener('click', this.replaceAll.bind(this));
this.subscriptions.add(atom.commands.add('atom-workspace', {
'find-and-replace:replace-previous': this.replacePrevious.bind(this),
Expand Down

1 comment on commit 9da0512

@icecream17
Copy link

@icecream17 icecream17 commented on 9da0512 Sep 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sadick254 Shouldn't it be

e => e.shiftKey ? this.replacePrevious.bind(this) : this.replaceNext.bind(this)

Even if you don't need the bind, it should be

e => e.shiftKey ? this.replacePrevious : this.replaceNext

instead of

e => e.shiftKey ? this.replacePrevious() : this.replaceNext()

Edit: See #1155
Edit 2: See atom-community#1 and atom-community#3

Please sign in to comment.