From 3715e905019c4bc8c68d907bbb5c5e21c69d0d06 Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Sun, 13 Feb 2011 15:55:05 +0100 Subject: [PATCH] implement remove to line end --- lib/ace/commands/default_commands.js | 5 +++++ lib/ace/editor.js | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/ace/commands/default_commands.js b/lib/ace/commands/default_commands.js index 35174be8..3565cc5b 100644 --- a/lib/ace/commands/default_commands.js +++ b/lib/ace/commands/default_commands.js @@ -242,6 +242,10 @@ canon.addCommand({ name: "backspace", exec: function(env, args, request) { env.editor.removeLeft(); } }); +canon.addCommand({ + name: "removetolineend", + exec: function(env, args, request) { env.editor.removeToLineEnd(); } +}); canon.addCommand({ name: "outdent", exec: function(env, args, request) { env.editor.blockOutdent(); } @@ -261,6 +265,7 @@ canon.addCommand({ name: "splitline", exec: function(env, args, request) { env.editor.splitLine(); } }); +canon.addCommand({ name: "transposeletters", exec: function(env, args, request) { env.editor.transposeLetters(); } }); diff --git a/lib/ace/editor.js b/lib/ace/editor.js index 2a9989dc..6a8d38f9 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -564,6 +564,17 @@ var Editor =function(renderer, session) { this.session.remove(this.getSelectionRange()); this.clearSelection(); }; + + this.removeToLineEnd = function() { + if (this.$readOnly) + return; + + if (this.selection.isEmpty()) + this.selection.selectLineEnd(); + + this.session.remove(this.getSelectionRange()); + this.clearSelection(); + }; this.splitLine = function() { if (this.$readOnly)