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

Make ReplaceWithRegister work in visual mode #4016

Merged
merged 4 commits into from Aug 30, 2019

Conversation

stevenguh
Copy link
Contributor

What this PR does / why we need it:
This fixes the issue where ReplaceWithRegister doesn't work in visual mode

Which issue(s) this PR fixes
#4015

@TravisBuddy
Copy link

Travis tests have failed

Hey @stevenguh,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

Node.js: 8

View build log

if [[ $(git diff-index HEAD -- *.js *.ts *.md) ]]; then git diff; echo "Prettier Failed. Run `gulp forceprettier` and commit changes to resolve."; exit 1; fi
diff --git a/README.md b/README.md
index ae796ca..d438eb4 100644
--- a/README.md
+++ b/README.md
@@ -598,11 +598,11 @@ Based on [ReplaceWithRegister](https://github.com/vim-scripts/ReplaceWithRegiste
 
 Once active, type `gr` (say "go replace") followed by a motion to describe the text you want replaced by the contents of the register.
 
-| Motion Command | Description                                                                        |
-| -------------- | ---------------------------------------------------------------------------------- |
-| `[count]["a]gr<motion>`| Replace the text described by the motion with the contents of the default register or the specified register `a` in the example    |
-| `[count]["a]grr`       | Replace the \[count\] lines or current line with the contents of the default register or the specified register `a` in the example |
-| `{Visual}["a]gr`       | Replace the selection with the contents of default register or the specified register `a` in the example                           |
+| Motion Command          | Description                                                                                                                        |
+| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
+| `[count]["a]gr<motion>` | Replace the text described by the motion with the contents of the default register or the specified register `a` in the example    |
+| `[count]["a]grr`        | Replace the \[count\] lines or current line with the contents of the default register or the specified register `a` in the example |
+| `{Visual}["a]gr`        | Replace the selection with the contents of default register or the specified register `a` in the example                           |
 
 ## 🎩 VSCodeVim tricks!
 
diff --git a/src/cmd_line/commands/sort.ts b/src/cmd_line/commands/sort.ts
index bdb1f3a..b6fa786 100644
--- a/src/cmd_line/commands/sort.ts
+++ b/src/cmd_line/commands/sort.ts
@@ -58,9 +58,9 @@ export class SortCommand extends node.CommandBase {
 
     let lastLineLength = originalLines[originalLines.length - 1].length;
 
-    const compareFn = this._arguments.ignoreCase ?
-      (a: string, b: string) => a.toLowerCase().localeCompare(b.toLowerCase()) :
-      (a: string, b: string) => a.localeCompare(b);
+    const compareFn = this._arguments.ignoreCase
+      ? (a: string, b: string) => a.toLowerCase().localeCompare(b.toLowerCase())
+      : (a: string, b: string) => a.localeCompare(b);
 
     let sortedLines = originalLines.sort(compareFn);
 
diff --git a/src/configuration/notation.ts b/src/configuration/notation.ts
index 7e7d8a6..a2f2e81 100644
--- a/src/configuration/notation.ts
+++ b/src/configuration/notation.ts
@@ -17,7 +17,7 @@ export class Notation {
 
   // Converts keystroke like <tab> to a single control character like \t
   public static ToControlCharacter(key: string) {
-    if (key === "<tab>") {
+    if (key === '<tab>') {
       return '\t';
     }
 
Prettier Failed. Run [07:43:28] Using gulpfile ~/build/VSCodeVim/Vim/gulpfile.js
[07:43:28] Starting 'forceprettier'...
[07:43:41] Finished 'forceprettier' after 13 s and commit changes to resolve.
TravisBuddy Request Identifier: b8f22a30-ca30-11e9-a673-e3b5aa05dde7

@TravisBuddy
Copy link

Travis tests have failed

Hey @stevenguh,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

Node.js: 8

View build log

if [[ $(git diff-index HEAD -- *.js *.ts *.md) ]]; then git diff; echo "Prettier Failed. Run `gulp forceprettier` and commit changes to resolve."; exit 1; fi
diff --git a/README.md b/README.md
index ae796ca..d438eb4 100644
--- a/README.md
+++ b/README.md
@@ -598,11 +598,11 @@ Based on [ReplaceWithRegister](https://github.com/vim-scripts/ReplaceWithRegiste
 
 Once active, type `gr` (say "go replace") followed by a motion to describe the text you want replaced by the contents of the register.
 
-| Motion Command | Description                                                                        |
-| -------------- | ---------------------------------------------------------------------------------- |
-| `[count]["a]gr<motion>`| Replace the text described by the motion with the contents of the default register or the specified register `a` in the example    |
-| `[count]["a]grr`       | Replace the \[count\] lines or current line with the contents of the default register or the specified register `a` in the example |
-| `{Visual}["a]gr`       | Replace the selection with the contents of default register or the specified register `a` in the example                           |
+| Motion Command          | Description                                                                                                                        |
+| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
+| `[count]["a]gr<motion>` | Replace the text described by the motion with the contents of the default register or the specified register `a` in the example    |
+| `[count]["a]grr`        | Replace the \[count\] lines or current line with the contents of the default register or the specified register `a` in the example |
+| `{Visual}["a]gr`        | Replace the selection with the contents of default register or the specified register `a` in the example                           |
 
 ## 🎩 VSCodeVim tricks!
 
diff --git a/src/cmd_line/commands/sort.ts b/src/cmd_line/commands/sort.ts
index bdb1f3a..b6fa786 100644
--- a/src/cmd_line/commands/sort.ts
+++ b/src/cmd_line/commands/sort.ts
@@ -58,9 +58,9 @@ export class SortCommand extends node.CommandBase {
 
     let lastLineLength = originalLines[originalLines.length - 1].length;
 
-    const compareFn = this._arguments.ignoreCase ?
-      (a: string, b: string) => a.toLowerCase().localeCompare(b.toLowerCase()) :
-      (a: string, b: string) => a.localeCompare(b);
+    const compareFn = this._arguments.ignoreCase
+      ? (a: string, b: string) => a.toLowerCase().localeCompare(b.toLowerCase())
+      : (a: string, b: string) => a.localeCompare(b);
 
     let sortedLines = originalLines.sort(compareFn);
 
diff --git a/src/configuration/notation.ts b/src/configuration/notation.ts
index 7e7d8a6..a2f2e81 100644
--- a/src/configuration/notation.ts
+++ b/src/configuration/notation.ts
@@ -17,7 +17,7 @@ export class Notation {
 
   // Converts keystroke like <tab> to a single control character like \t
   public static ToControlCharacter(key: string) {
-    if (key === "<tab>") {
+    if (key === '<tab>') {
       return '\t';
     }
 
Prettier Failed. Run [07:45:04] Using gulpfile ~/build/VSCodeVim/Vim/gulpfile.js
[07:45:04] Starting 'forceprettier'...
[07:45:19] Finished 'forceprettier' after 15 s and commit changes to resolve.
TravisBuddy Request Identifier: f34ecee0-ca30-11e9-a673-e3b5aa05dde7

README.md Outdated Show resolved Hide resolved
Copy link
Member

@J-Fields J-Fields left a comment

Choose a reason for hiding this comment

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

LGTM, other than the nit regarding the README

@J-Fields J-Fields merged commit b7a6794 into VSCodeVim:master Aug 30, 2019
@stevenguh stevenguh deleted the feature/visual-gr branch August 30, 2019 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants