From 39145782eab3ccdb62738fe2c9ac10fcfc83e50d Mon Sep 17 00:00:00 2001 From: Andrew Dupont Date: Fri, 28 Jun 2024 16:33:15 -0700 Subject: [PATCH 1/4] =?UTF-8?q?Remove=20ambiguity=20in=20all=20text=20move?= =?UTF-8?q?ment=20method=20names=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …of the form `(select|delete|cut|move)To(Beginning|End)OfLine`. Also add most permutations of the form `(select|delete|cut|move)To(Beginning|End)Of(Screen|Buffer)Line`. The ambiguous names are the ones that do not specify whether they operate on buffer coordinates or screen coordinates, and their behavior is inconsistent as a result. The behavior of each existing ambiguous method is preserved; the old method names are now aliases for the new ones. This is a work in progress; the same work should be done in aliasing the respective command names that map to the old methods, plus creating new command names for the new methods. --- src/cursor.js | 22 ++++++-- src/selection.js | 113 +++++++++++++++++++++++++++++++++------ src/text-editor.js | 129 ++++++++++++++++++++++++++++++++++++++------- 3 files changed, 224 insertions(+), 40 deletions(-) diff --git a/src/cursor.js b/src/cursor.js index 334c5b0d81..d8a4ee88d6 100644 --- a/src/cursor.js +++ b/src/cursor.js @@ -356,18 +356,25 @@ module.exports = class Cursor extends Model { this.goalColumn = column; } - // Public: Moves the cursor to the beginning of the line. + // Public: Moves the cursor to the beginning of the screen line. moveToBeginningOfScreenLine() { this.setScreenPosition([this.getScreenRow(), 0]); } // Public: Moves the cursor to the beginning of the buffer line. + // + // Deprecated; prefer {::moveToBeginningOfBufferLine}. moveToBeginningOfLine() { + this.moveToBeginningOfBufferLine(); + } + + // Public: Moves the cursor to the beginning of the buffer line. + moveToBeginningOfBufferLine() { this.setBufferPosition([this.getBufferRow(), 0]); } - // Public: Moves the cursor to the beginning of the first character in the - // line. + // Public: Moves the cursor to the beginning of the first non-whitespace + // character in the screen line. moveToFirstCharacterOfLine() { let targetBufferColumn; const screenRow = this.getScreenRow(); @@ -405,13 +412,20 @@ module.exports = class Cursor extends Model { ]); } - // Public: Moves the cursor to the end of the line. + // Public: Moves the cursor to the end of the screen line. moveToEndOfScreenLine() { this.setScreenPosition([this.getScreenRow(), Infinity]); } // Public: Moves the cursor to the end of the buffer line. + // + // Deprecated; prefer {::moveToEndOfBufferLine}. moveToEndOfLine() { + this.moveToEndOfBufferLine(); + } + + // Public: Moves the cursor to the end of the buffer line. + moveToEndOfBufferLine() { this.setBufferPosition([this.getBufferRow(), Infinity]); } diff --git a/src/selection.js b/src/selection.js index 8b1540272c..7d4958462a 100644 --- a/src/selection.js +++ b/src/selection.js @@ -308,27 +308,49 @@ module.exports = class Selection { } // Public: Selects all the text from the current cursor position to the - // beginning of the line. + // beginning of the buffer line. + // + // Deprecated; prefer {::selectToBeginningOfBufferLine}. selectToBeginningOfLine() { - this.modifySelection(() => this.cursor.moveToBeginningOfLine()); + this.selectToBeginningOfBufferLine(); + } + + // Public: Selects all the text from the current cursor position to the + // beginning of the screen line. + selectToBeginningOfScreenLine() { + this.modifiySelection(() => this.cursor.moveToBeginningOfScreenLine()); + } + + // Public: Selects all the text from the current cursor position to the + // beginning of the buffer line. + selectToBeginningOfBufferLine() { + this.modifySelection(() => this.cursor.moveToBeginningOfBufferLine()); } // Public: Selects all the text from the current cursor position to the first - // character of the line. + // non-whitespace character of the screen line. selectToFirstCharacterOfLine() { this.modifySelection(() => this.cursor.moveToFirstCharacterOfLine()); } + // Public: Selects all the text from the current cursor position to the end + // of the screen line. + // + // Deprecated; prefer {::selectToEndOfScreenLine}. + selectToEndOfLine() { + this.selectToEndOfScreenLine(); + } + // Public: Selects all the text from the current cursor position to the end of // the screen line. - selectToEndOfLine() { + selectToEndOfScreenLine() { this.modifySelection(() => this.cursor.moveToEndOfScreenLine()); } // Public: Selects all the text from the current cursor position to the end of // the buffer line. selectToEndOfBufferLine() { - this.modifySelection(() => this.cursor.moveToEndOfLine()); + this.modifySelection(() => this.cursor.moveToEndOfBufferLine()); } // Public: Selects all the text from the current cursor position to the @@ -632,13 +654,23 @@ module.exports = class Selection { this.deleteSelectedText(options); } - // Public: Removes from the beginning of the line which the selection begins on - // all the way through to the end of the selection. + // Public: Removes from the beginning of the buffer line which the selection + // begins on all the way through to the end of the selection. + // + // Deprecated; prefer {::deleteToBeginningOfBufferLine}. + deleteToBeginningOfLine(options = {}) { + return this.deleteToBeginningOfBufferLine(options); + } + + // Public: Removes all text from the beginning of the buffer line which the + // selection begins on all the way through to the end of the selection. When + // the cursor is on the first column of the buffer line and the selection is + // empty, deletes the preceding newline character. // // * `options` (optional) {Object} // * `bypassReadOnly` (optional) {Boolean} Must be `true` to modify text within a read-only editor. (default: false) - deleteToBeginningOfLine(options = {}) { - if (!this.ensureWritable('deleteToBeginningOfLine', options)) return; + deleteToBeginningOfBufferLine(options = {}) { + if (!this.ensureWritable('deleteToBeginningOfBufferLine', options)) return; if (this.isEmpty() && this.cursor.isAtBeginningOfLine()) { this.selectLeft(); } else { @@ -647,6 +679,23 @@ module.exports = class Selection { this.deleteSelectedText(options); } + // Public: Removes all text from the beginning of the screen line which the + // selection begins on all the way through to the end of the selection. When + // the cursor is on the first column of the buffer line and the selection is + // empty, deletes the preceding newline character. + // + // * `options` (optional) {Object} + // * `bypassReadOnly` (optional) {Boolean} Must be `true` to modify text within a read-only editor. (default: false) + deleteToBeginningOfScreenLine(options = {}) { + if (!this.ensureWritable('deleteToBeginningOfBufferLine', options)) return; + if (this.isEmpty()) { + this.selectLeft(); + } else { + this.selectToBeginningOfLine(); + } + this.deleteSelectedText(options); + } + // Public: Removes the selection or the next character after the start of the // selection if the selection is empty. // @@ -659,20 +708,45 @@ module.exports = class Selection { } // Public: If the selection is empty, removes all text from the cursor to the - // end of the line. If the cursor is already at the end of the line, it - // removes the following newline. If the selection isn't empty, only deletes - // the contents of the selection. + // end of the screen line. If the cursor is already at the end of the screen + // line, it takes no action. If the selection isn't empty, only deletes the + // contents of the selection. + // + // Deprecated; prefer {::deleteToEndOfScreenLine}. + deleteToEndOfLine(options = {}) { + return this.deleteToEndOfScreenLine(options); + } + + // Public: If the selection is empty, removes all text from the cursor to the + // end of the screen line. If the cursor is already at the end of the screen + // line, it takes no action. If the selection isn't empty, only deletes the + // contents of the selection. // // * `options` (optional) {Object} // * `bypassReadOnly` (optional) {Boolean} Must be `true` to modify text within a read-only editor. (default: false) - deleteToEndOfLine(options = {}) { - if (!this.ensureWritable('deleteToEndOfLine', options)) return; + deleteToEndOfScreenLine(options = {}) { + if (!this.ensureWritable('deleteToEndOfScreenLine', options)) return; + if (this.isEmpty()) { + this.selectToEndOfScreenLine(); + } + this.deleteSelectedText(options); + } + + // Public: If the selection is empty, removes all text from the cursor to the + // end of the buffer line. If the cursor is already at the end of the buffer + // line, it deletes the following newline. If the selection isn't empty, only + // deletes the contents of the selection. + // + // * `options` (optional) {Object} + // * `bypassReadOnly` (optional) {Boolean} Must be `true` to modify text within a read-only editor. (default: false) + deleteToEndOfBufferLine(options = {}) { + if (!this.ensureWritable('deleteToEndOfBufferLine', options)) return; if (this.isEmpty()) { if (this.cursor.isAtEndOfLine()) { this.delete(options); return; } - this.selectToEndOfLine(); + this.selectToEndOfBufferLine(); } this.deleteSelectedText(options); } @@ -859,12 +933,19 @@ module.exports = class Selection { }); } + // Public: Cuts the selection until the end of the screen line. + // + // Deprecated; prefer {::cutToEndOfScreenLine}. + cutToEndOfLine(maintainClipboard, options = {}) { + return this.cutToEndOfScreenLine(maintainClipboard, options); + } + // Public: Cuts the selection until the end of the screen line. // // * `maintainClipboard` {Boolean} // * `options` (optional) {Object} // * `bypassReadOnly` (optional) {Boolean} Must be `true` to modify text within a read-only editor. (default: false) - cutToEndOfLine(maintainClipboard, options = {}) { + cutToEndOfScreenLine(maintainClipboard, options = {}) { if (!this.ensureWritable('cutToEndOfLine', options)) return; if (this.isEmpty()) this.selectToEndOfLine(); return this.cut(maintainClipboard, false, options.bypassReadOnly); diff --git a/src/text-editor.js b/src/text-editor.js index 8132eb8411..0abdf1774a 100644 --- a/src/text-editor.js +++ b/src/text-editor.js @@ -2352,29 +2352,73 @@ module.exports = class TextEditor { ); } - // Extended: For each selection, if the selection is empty, delete all characters - // of the containing line that precede the cursor. Otherwise delete the - // selected text. + // Extended: For each selection, if the selection is empty, delete all + // characters of the containing buffer line that precede the cursor. + // Otherwise delete the selected text. + // + // Deprecated; prefer {::deleteToBeginningOfBufferLine}. + deleteToBeginningOfLine() { + return this.deleteToBeginningOfBufferLine(); + } + + // Extended: For each selection, if the selection is empty, delete all + // characters of the containing buffer line that precede the cursor. + // Otherwise delete the selected text. // // * `options` (optional) {Object} // * `bypassReadOnly` (optional) {Boolean} Must be `true` to modify a read-only editor. (default: false) - deleteToBeginningOfLine(options = {}) { - if (!this.ensureWritable('deleteToBeginningOfLine', options)) return; + deleteToBeginningOfBufferLine(options = {}) { + if (!this.ensureWritable('deleteToBeginningOfBufferLine', options)) return; this.mutateSelectedText(selection => - selection.deleteToBeginningOfLine(options) + selection.deleteToBeginningOfBufferLine(options) ); } + // Extended: For each selection, if the selection is empty, delete all + // characters of the containing screen line that precede the cursor. + // Otherwise delete the selected text. + // + // * `options` (optional) {Object} + // * `bypassReadOnly` (optional) {Boolean} Must be `true` to modify a read-only editor. (default: false) + deleteToBeginningOfScreenLine(options = {}) { + if (!this.ensureWritable('deleteToBeginningOfScreenLine', options)) return; + this.mutateSelectedText(selection => + selection.deleteToBeginningOfScreenLine(options) + ); + } + + // Extended: For each selection, if the selection is not empty, deletes the + // selection; otherwise, deletes all characters of the containing screen line + // following the cursor. If the cursor is already at the end of the screen + // line, takes no action. + // + // Deprecated; prefer {::deleteToEndOfScreenLine}. + deleteToEndOfLine(options = {}) { + return this.deleteToEndOfScreenLine(options); + } + + // Extended: For each selection, if the selection is not empty, deletes the + // selection; otherwise, deletes all characters of the containing screen line + // following the cursor. If the cursor is already at the end of the screen + // line, takes no action. + // + // * `options` (optional) {Object} + // * `bypassReadOnly` (optional) {Boolean} Must be `true` to modify a read-only editor. (default: false) + deleteToEndOfScreenLine(options = {}) { + if (!this.ensureWritable('deleteToEndOfScreenLine', options)) return; + this.mutateSelectedText(selection => selection.deleteToEndOfScreenLine(options)); + } + // Extended: For each selection, if the selection is not empty, deletes the - // selection; otherwise, deletes all characters of the containing line + // selection; otherwise, deletes all characters of the containing buffer line // following the cursor. If the cursor is already at the end of the line, // deletes the following newline. // // * `options` (optional) {Object} // * `bypassReadOnly` (optional) {Boolean} Must be `true` to modify a read-only editor. (default: false) - deleteToEndOfLine(options = {}) { - if (!this.ensureWritable('deleteToEndOfLine', options)) return; - this.mutateSelectedText(selection => selection.deleteToEndOfLine(options)); + deleteToEndOfBufferLine(options = {}) { + if (!this.ensureWritable('deleteToEndOfBufferLine', options)) return; + this.mutateSelectedText(selection => selection.deleteToEndOfBufferLine(options)); } // Extended: For each selection, if the selection is empty, delete all characters @@ -3726,13 +3770,31 @@ module.exports = class TextEditor { return this.expandSelectionsForward(selection => selection.selectAll()); } - // Essential: Move the cursor of each selection to the beginning of its line - // while preserving the selection's tail position. + // Essential: Move the cursor of each selection to the beginning of its + // buffer line while preserving the selection's tail position. // - // This method may merge selections that end up intersecting. + // Deprecated; prefer {::selectToBeginningOfBufferLine}. selectToBeginningOfLine() { + return this.selectToBeginningOfBufferLine(); + } + + // Essential: Move the cursor of each selection to the beginning of its + // screen line while preserving the selection's tail position. + // + // This method may merge selections that end up intersecting. + selectToBeginningOfScreenLine() { return this.expandSelectionsBackward(selection => - selection.selectToBeginningOfLine() + selection.selectToBeginningOfScreenLine() + ); + } + + // Essential: Move the cursor of each selection to the beginning of its + // buffer line while preserving the selection's tail position. + // + // This method may merge selections that end up intersecting. + selectToBeginningOfBufferLine() { + return this.expandSelectionsBackward(selection => + selection.selectToBeginningOfBufferLine() ); } @@ -3748,13 +3810,31 @@ module.exports = class TextEditor { ); } - // Essential: Move the cursor of each selection to the end of its line while - // preserving the selection's tail position. + // Essential: Move the cursor of each selection to the end of its screen line + // while preserving the selection's tail position. // - // This method may merge selections that end up intersecting. + // Deprecated; prefer {::selectToEndOfScreenLine}. selectToEndOfLine() { + return this.selectToEndOfScreenLine(); + } + + // Essential: Move the cursor of each selection to the end of its screen line + // while preserving the selection's tail position. + // + // This method may merge selections that end up intersecting. + selectToEndOfScreenLine() { return this.expandSelectionsForward(selection => - selection.selectToEndOfLine() + selection.selectToEndOfScreenLine() + ); + } + + // Essential: Move the cursor of each selection to the end of its buffer line + // while preserving the selection's tail position. + // + // This method may merge selections that end up intersecting. + selectToEndOfBufferLine() { + return this.expandSelectionsForward(selection => + selection.selectToEndOfBufferLine() ); } @@ -4784,17 +4864,26 @@ module.exports = class TextEditor { }); } + // Essential: For each selection, if the selection is empty, cut all characters + // of the containing screen line following the cursor. Otherwise cut the selected + // text. + // + // Deprecated; prefer {::cutToEndOfScreenLine}. + cutToEndOfLine(options = {}) { + return this.cutToEndOfScreenLine(options); + } + // Essential: For each selection, if the selection is empty, cut all characters // of the containing screen line following the cursor. Otherwise cut the selected // text. // // * `options` (optional) {Object} // * `bypassReadOnly` (optional) {Boolean} Must be `true` to modify a read-only editor. - cutToEndOfLine(options = {}) { + cutToEndOfScreenLine(options = {}) { if (!this.ensureWritable('cutToEndOfLine', options)) return; let maintainClipboard = false; this.mutateSelectedText(selection => { - selection.cutToEndOfLine(maintainClipboard, options); + selection.cutToEndOfScreenLine(maintainClipboard, options); maintainClipboard = true; }); } From 47a602247d040be72b2a003795c4a137884eb6d2 Mon Sep 17 00:00:00 2001 From: Andrew Dupont Date: Fri, 28 Jun 2024 17:45:36 -0700 Subject: [PATCH 2/4] Fix specs; add some deprecation messages --- src/selection.js | 15 ++++++++++----- src/text-editor.js | 28 +++++++++++++++++++++++----- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/selection.js b/src/selection.js index 7d4958462a..86c722893c 100644 --- a/src/selection.js +++ b/src/selection.js @@ -659,6 +659,7 @@ module.exports = class Selection { // // Deprecated; prefer {::deleteToBeginningOfBufferLine}. deleteToBeginningOfLine(options = {}) { + if (!this.ensureWritable('deleteToBeginningOfLine', options)) return; return this.deleteToBeginningOfBufferLine(options); } @@ -709,8 +710,8 @@ module.exports = class Selection { // Public: If the selection is empty, removes all text from the cursor to the // end of the screen line. If the cursor is already at the end of the screen - // line, it takes no action. If the selection isn't empty, only deletes the - // contents of the selection. + // line, deletes the following newline. If the selection isn't empty, only + // deletes the contents of the selection. // // Deprecated; prefer {::deleteToEndOfScreenLine}. deleteToEndOfLine(options = {}) { @@ -719,14 +720,18 @@ module.exports = class Selection { // Public: If the selection is empty, removes all text from the cursor to the // end of the screen line. If the cursor is already at the end of the screen - // line, it takes no action. If the selection isn't empty, only deletes the - // contents of the selection. + // line, deletes the following newline. If the selection isn't empty, only + // deletes the contents of the selection. // // * `options` (optional) {Object} // * `bypassReadOnly` (optional) {Boolean} Must be `true` to modify text within a read-only editor. (default: false) deleteToEndOfScreenLine(options = {}) { if (!this.ensureWritable('deleteToEndOfScreenLine', options)) return; if (this.isEmpty()) { + if (this.cursor.isAtEndOfLine()) { + this.delete(options); + return; + } this.selectToEndOfScreenLine(); } this.deleteSelectedText(options); @@ -734,7 +739,7 @@ module.exports = class Selection { // Public: If the selection is empty, removes all text from the cursor to the // end of the buffer line. If the cursor is already at the end of the buffer - // line, it deletes the following newline. If the selection isn't empty, only + // line, deletes the following newline. If the selection isn't empty, only // deletes the contents of the selection. // // * `options` (optional) {Object} diff --git a/src/text-editor.js b/src/text-editor.js index 0abdf1774a..19c12da38d 100644 --- a/src/text-editor.js +++ b/src/text-editor.js @@ -2357,8 +2357,12 @@ module.exports = class TextEditor { // Otherwise delete the selected text. // // Deprecated; prefer {::deleteToBeginningOfBufferLine}. - deleteToBeginningOfLine() { - return this.deleteToBeginningOfBufferLine(); + deleteToBeginningOfLine(options = {}) { + Grim.deprecate( + 'This method is deprecated. Call `deleteToBeginningOfBufferLine` instead.' + ); + if (!this.ensureWritable('deleteToBeginningOfLine', options)) return; + return this.deleteToBeginningOfBufferLine(options); } // Extended: For each selection, if the selection is empty, delete all @@ -2390,17 +2394,21 @@ module.exports = class TextEditor { // Extended: For each selection, if the selection is not empty, deletes the // selection; otherwise, deletes all characters of the containing screen line // following the cursor. If the cursor is already at the end of the screen - // line, takes no action. + // line, deletes the following newline. // // Deprecated; prefer {::deleteToEndOfScreenLine}. deleteToEndOfLine(options = {}) { + Grim.deprecate( + 'This method is deprecated. Call TextEditor::deleteToEndOfScreenLine instead.' + ); + if (!this.ensureWritable('deleteToEndOfLine', options)) return; return this.deleteToEndOfScreenLine(options); } // Extended: For each selection, if the selection is not empty, deletes the // selection; otherwise, deletes all characters of the containing screen line // following the cursor. If the cursor is already at the end of the screen - // line, takes no action. + // line, deletes the following newline. // // * `options` (optional) {Object} // * `bypassReadOnly` (optional) {Boolean} Must be `true` to modify a read-only editor. (default: false) @@ -3775,6 +3783,9 @@ module.exports = class TextEditor { // // Deprecated; prefer {::selectToBeginningOfBufferLine}. selectToBeginningOfLine() { + Grim.deprecate( + 'This method is deprecated. Call TextEditor::selectToBeginningOfBufferLine instead.' + ); return this.selectToBeginningOfBufferLine(); } @@ -3815,6 +3826,9 @@ module.exports = class TextEditor { // // Deprecated; prefer {::selectToEndOfScreenLine}. selectToEndOfLine() { + Grim.deprecate( + 'This method is deprecated. Call TextEditor::selectToEndOfScreenLine instead.' + ); return this.selectToEndOfScreenLine(); } @@ -4870,6 +4884,10 @@ module.exports = class TextEditor { // // Deprecated; prefer {::cutToEndOfScreenLine}. cutToEndOfLine(options = {}) { + Grim.deprecate( + 'This method is deprecated. Call TextEditor::cutToEndOfScreenLine instead.' + ); + if (!this.ensureWritable('cutToEndOfLine', options)) return; return this.cutToEndOfScreenLine(options); } @@ -4880,7 +4898,7 @@ module.exports = class TextEditor { // * `options` (optional) {Object} // * `bypassReadOnly` (optional) {Boolean} Must be `true` to modify a read-only editor. cutToEndOfScreenLine(options = {}) { - if (!this.ensureWritable('cutToEndOfLine', options)) return; + if (!this.ensureWritable('cutToEndOfScreenLine', options)) return; let maintainClipboard = false; this.mutateSelectedText(selection => { selection.cutToEndOfScreenLine(maintainClipboard, options); From dc574ab6b890279ea0370408bb558cbac44c9abd Mon Sep 17 00:00:00 2001 From: Andrew Dupont Date: Fri, 28 Jun 2024 18:47:23 -0700 Subject: [PATCH 3/4] OK, fine, I'll remove the deprecation messages; specs are weird --- src/text-editor.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/text-editor.js b/src/text-editor.js index 19c12da38d..5e5f547116 100644 --- a/src/text-editor.js +++ b/src/text-editor.js @@ -2358,9 +2358,6 @@ module.exports = class TextEditor { // // Deprecated; prefer {::deleteToBeginningOfBufferLine}. deleteToBeginningOfLine(options = {}) { - Grim.deprecate( - 'This method is deprecated. Call `deleteToBeginningOfBufferLine` instead.' - ); if (!this.ensureWritable('deleteToBeginningOfLine', options)) return; return this.deleteToBeginningOfBufferLine(options); } @@ -2398,9 +2395,6 @@ module.exports = class TextEditor { // // Deprecated; prefer {::deleteToEndOfScreenLine}. deleteToEndOfLine(options = {}) { - Grim.deprecate( - 'This method is deprecated. Call TextEditor::deleteToEndOfScreenLine instead.' - ); if (!this.ensureWritable('deleteToEndOfLine', options)) return; return this.deleteToEndOfScreenLine(options); } @@ -3783,9 +3777,6 @@ module.exports = class TextEditor { // // Deprecated; prefer {::selectToBeginningOfBufferLine}. selectToBeginningOfLine() { - Grim.deprecate( - 'This method is deprecated. Call TextEditor::selectToBeginningOfBufferLine instead.' - ); return this.selectToBeginningOfBufferLine(); } @@ -3826,9 +3817,6 @@ module.exports = class TextEditor { // // Deprecated; prefer {::selectToEndOfScreenLine}. selectToEndOfLine() { - Grim.deprecate( - 'This method is deprecated. Call TextEditor::selectToEndOfScreenLine instead.' - ); return this.selectToEndOfScreenLine(); } @@ -4884,9 +4872,6 @@ module.exports = class TextEditor { // // Deprecated; prefer {::cutToEndOfScreenLine}. cutToEndOfLine(options = {}) { - Grim.deprecate( - 'This method is deprecated. Call TextEditor::cutToEndOfScreenLine instead.' - ); if (!this.ensureWritable('cutToEndOfLine', options)) return; return this.cutToEndOfScreenLine(options); } From 639f42dcfe92dfcc36e586e77adbd9be06bf60f4 Mon Sep 17 00:00:00 2001 From: Andrew Dupont Date: Wed, 17 Jul 2024 23:38:53 -0700 Subject: [PATCH 4/4] =?UTF-8?q?Add=20corresponding=20commands=20for=20the?= =?UTF-8?q?=20new=20methods=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …wherever a command is currently mapped to a method we just deprecated. (Nothing has changed about the keymaps!) --- src/register-default-commands.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/register-default-commands.js b/src/register-default-commands.js index fedfc64517..fa501ca9b5 100644 --- a/src/register-default-commands.js +++ b/src/register-default-commands.js @@ -344,12 +344,18 @@ module.exports = function({commandRegistry, commandInstaller, config, notificati 'editor:move-to-beginning-of-line': function() { return this.moveToBeginningOfLine(); }, + 'editor:move-to-beginning-of-buffer-line': function() { + return this.moveToBeginningOfBufferLine(); + }, 'editor:move-to-end-of-screen-line': function() { return this.moveToEndOfScreenLine(); }, 'editor:move-to-end-of-line': function() { return this.moveToEndOfLine(); }, + 'editor:move-to-end-of-buffer-line': function() { + return this.moveToEndOfBufferLine(); + }, 'editor:move-to-first-character-of-line': function() { return this.moveToFirstCharacterOfLine(); }, @@ -383,9 +389,15 @@ module.exports = function({commandRegistry, commandInstaller, config, notificati 'editor:select-to-end-of-line': function() { return this.selectToEndOfLine(); }, + 'editor:select-to-end-of-buffer-line': function() { + return this.selectToEndOfBufferLine(); + }, 'editor:select-to-beginning-of-line': function() { return this.selectToBeginningOfLine(); }, + 'editor:select-to-beginning-of-buffer-line': function() { + return this.selectToBeginningOfBufferLine(); + }, 'editor:select-to-end-of-word': function() { return this.selectToEndOfWord(); }, @@ -468,9 +480,15 @@ module.exports = function({commandRegistry, commandInstaller, config, notificati 'editor:delete-to-beginning-of-line': function() { return this.deleteToBeginningOfLine(); }, + 'editor:delete-to-beginning-of-buffer-line': function() { + return this.deleteToBeginningOfBufferLine(); + }, 'editor:delete-to-end-of-line': function() { return this.deleteToEndOfLine(); }, + 'editor:delete-to-end-of-buffer-line': function() { + return this.deleteToEndOfBufferLine(); + }, 'editor:delete-to-end-of-word': function() { return this.deleteToEndOfWord(); },