diff --git a/src/Actions/Case.ts b/src/Actions/Case.ts index 52894ee1..c17de6d2 100644 --- a/src/Actions/Case.ts +++ b/src/Actions/Case.ts @@ -50,24 +50,6 @@ export class ActionCase { .then(() => ActionReveal.primaryCursor()); } - @StaticReflect.metadata(SymbolMetadata.Action.isChange, true) - static rot13Selections(): Thenable { - const activeTextEditor = window.activeTextEditor; - - if (!activeTextEditor) { - return Promise.resolve(false); - } - - return activeTextEditor - .edit((editBuilder) => { - activeTextEditor.selections.forEach((selection) => { - const text = activeTextEditor.document.getText(selection); - editBuilder.replace(selection, UtilText.rot13(text)); - }); - }) - .then(() => ActionReveal.primaryCursor()); - } - @StaticReflect.metadata(SymbolMetadata.Action.isChange, true) static switchActives(args: { n?: number }): Thenable { args.n = args.n === undefined ? 1 : args.n; diff --git a/src/Modes/Visual.ts b/src/Modes/Visual.ts index 9528aa94..2808fc47 100644 --- a/src/Modes/Visual.ts +++ b/src/Modes/Visual.ts @@ -158,10 +158,6 @@ export class ModeVisual extends Mode { keys: 'U', actions: [ActionCase.uppercaseSelections, ActionSelection.shrinkToStarts], }, - { - keys: 'g ?', - actions: [ActionCase.rot13Selections, ActionSelection.shrinkToStarts], - }, { keys: '=', actions: [ActionFilter.Format.bySelections] }, diff --git a/src/Modes/VisualLine.ts b/src/Modes/VisualLine.ts index fbe90bac..ccd4db22 100644 --- a/src/Modes/VisualLine.ts +++ b/src/Modes/VisualLine.ts @@ -155,10 +155,6 @@ export class ModeVisualLine extends Mode { keys: 'U', actions: [ActionCase.uppercaseSelections, ActionSelection.shrinkToStarts], }, - { - keys: 'g ?', - actions: [ActionCase.rot13Selections, ActionSelection.shrinkToStarts], - }, { keys: '=', actions: [ActionFilter.Format.bySelections] }, diff --git a/src/Utils/Text.ts b/src/Utils/Text.ts index 9379712e..fb1a7d96 100644 --- a/src/Utils/Text.ts +++ b/src/Utils/Text.ts @@ -16,12 +16,6 @@ export class UtilText { return to; } - static rot13(text: string): string { - return text.replace(/[a-z]/gi, (char) => - String.fromCharCode(char.charCodeAt(0) + (char.toUpperCase() > 'M' ? -13 : 13)), - ); - } - static countStringAppearance(searchString: string, text: string): number { let count = 0; let position = -1; diff --git a/test/ModeVisual/rot13.test.ts b/test/ModeVisual/rot13.test.ts deleted file mode 100644 index c017464d..00000000 --- a/test/ModeVisual/rot13.test.ts +++ /dev/null @@ -1,35 +0,0 @@ -import * as BlackBox from '../Framework/BlackBox'; - -suite('Visual: g ?', () => { - const testCases: BlackBox.TestCase[] = [ - { - from: 'abcdefghijklm[nopqrstuvwxyz]', - inputs: 'g ?', - to: 'abcdefghijklm[]abcdefghijklm', - }, - { - from: 'AB[CDE]FG', - inputs: 'g ?', - to: 'AB[]PQRFG', - }, - { - from: 'The Quick Brown[ Fox Jumps Ov]er The Lazy Dog.', - inputs: 'g ?', - to: 'The Quick Brown[] Sbk Whzcf Bier The Lazy Dog.', - }, - { - from: 'Abc[123$%^&*()]def', - inputs: 'g ?', - to: 'Abc[]123$%^&*()def', - }, - { - from: 'Bacon\nips[um,\nDOLO]R\nsit.', - inputs: 'g ?', - to: 'Bacon\nips[]hz,\nQBYBR\nsit.', - }, - ]; - - for (let i = 0; i < testCases.length; i++) { - BlackBox.run(testCases[i]); - } -}); diff --git a/test/ModeVisualLine/rot13.test.ts b/test/ModeVisualLine/rot13.test.ts deleted file mode 100644 index a1244882..00000000 --- a/test/ModeVisualLine/rot13.test.ts +++ /dev/null @@ -1,35 +0,0 @@ -import * as BlackBox from '../Framework/BlackBox'; - -suite('VisualLine: g ?', () => { - const testCases: BlackBox.TestCase[] = [ - { - from: '[]abcdefghijklmnopqrstuvwxyz', - inputs: 'V g ?', - to: '[]nopqrstuvwxyzabcdefghijklm', - }, - { - from: '[]ABCDEFGHIJKLMNOPQRSTUVWXYZ', - inputs: 'V g ?', - to: '[]NOPQRSTUVWXYZABCDEFGHIJKLM', - }, - { - from: 'abcdefghijklm[]nopqrstuvwxyz\nNOPQRSTUVWXYZABCDEFGHIJKLM\nfoo', - inputs: 'V j g ?', - to: '[]nopqrstuvwxyzabcdefghijklm\nABCDEFGHIJKLMNOPQRSTUVWXYZ\nfoo', - }, - { - from: 'The Quick Brown[] Fox Jumps Over The Lazy Dog.', - inputs: 'V g ?', - to: '[]Gur Dhvpx Oebja Sbk Whzcf Bire Gur Ynml Qbt.', - }, - { - from: 'Abc[123$%^&*()]def', - inputs: 'V g ?', - to: '[]Nop123$%^&*()qrs', - }, - ]; - - for (let i = 0; i < testCases.length; i++) { - BlackBox.run(testCases[i]); - } -});