Skip to content

Commit

Permalink
editing: Added command and keybindings to remove previously selected …
Browse files Browse the repository at this point in the history
…word in multi-caret session - fixes #869

rn=
  • Loading branch information
mitchell-as authored and th3coop committed Nov 27, 2015
1 parent fe6e6af commit e050896
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/chrome/komodo/content/commandsOverlay.p.xul
Original file line number Diff line number Diff line change
Expand Up @@ -1567,6 +1567,11 @@
disabled="true"
desc="&generalPrintPreviewSelection.desc;"/>
<!-- #endif -->
<command
id="cmd_removePrevWordInCaretSet" key="key_cmd_removePrevWordInCaretSet"
oncommand="ko.commands.doCommandAsync('cmd_removePrevWordInCaretSet', event)"
disabled="true"
desc="&removePrevWordInCaretSet.desc;"/>
</commandset>

<!-- These commands need to be updated on window open,
Expand Down
27 changes: 27 additions & 0 deletions src/chrome/komodo/content/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,33 @@ editor_editorController.prototype.do_cmd_addNextWordToCaretSet = function() {
scimoz.searchFlags |= scimoz.SCFIND_WHOLEWORD;
}
scimoz.multipleSelectAddNext();
scimoz.sendUpdateCommands("select");
};

var is_cmd_removeAdditionalCaret_enabled_aux = function() {
var view = _getCurrentScimozView();
if (!view) {
return null;
}
var scimoz = view.scimoz;
if (!scimoz) {
return null;
}
return (scimoz.selections > 1) ? view : null;
};

editor_editorController.prototype.is_cmd_removePrevWordInCaretSet_enabled = function() {
return !!is_cmd_removeAdditionalCaret_enabled_aux();
}

editor_editorController.prototype.do_cmd_removePrevWordInCaretSet = function() {
var view = is_cmd_removeAdditionalCaret_enabled_aux();
if (!view) {
return;
}
var scimoz = view.scimoz;
scimoz.dropSelectionN(scimoz.selections - 1);
scimoz.sendUpdateCommands("select");
};

editor_editorController.prototype._aux_is_cmd_rename_tag_enabled = function() {
Expand Down
8 changes: 7 additions & 1 deletion src/chrome/komodo/content/keybindings/keybindings.p.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ function cloneObject(what) {
* existing keybindings to move to the state you're implementing for N+1
*
* Version history:
* 49: Komodo 10.0 - add Ctrl+Shift+D for cmd_removePrevWordInCaretSet
* 48: Komodo 9.3 - Ctrl+T is now used for new tabs
* 47: Komodo 9.3 - Add keybindings for quick bookmarks
* Juggle help (and friends) and commenting keybindings to
Expand Down Expand Up @@ -380,7 +381,7 @@ function cloneObject(what) {
* 2: Komodo 4.2.0-beta2 and above
* 1: Komodo 4.2.0-beta1 and before
*/
const currentKeybindingVersionNumber = 48;
const currentKeybindingVersionNumber = 49;

/**
* Remove this dictionary of keybinds.
Expand Down Expand Up @@ -1063,6 +1064,11 @@ this.Manager.prototype._upgradeKeybingings = function (from_version,
});
// #endif
break;
case 49:
this._add_keybinding_sequences({
'cmd_removePrevWordInCaretSet': ["Ctrl+Shift+D"],
});
break;
}
from_version += 1;
}
Expand Down
7 changes: 7 additions & 0 deletions src/chrome/komodo/content/komodo.p.xul
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@
<menuitem id="editor-context-addNextWordToCaretSet"
label="&addNextWordToCaretSet.label;"
observes="cmd_addNextWordToCaretSet"/>
<menuitem id="editor-context-removePrevWordInCaretSet"
label="&removePrevWordInCaretSet.label;"
observes="cmd_removePrevWordInCaretSet"/>
</menupopup>
</menu>
<menuitem id="editor-context-find"
Expand Down Expand Up @@ -855,6 +858,10 @@
id="menu_addNextWordToCaretSet"
observes="cmd_addNextWordToCaretSet"
/>
<menuitem label="&removePrevWordInCaretSet.label;"
id="menu_removePrevWordInCaretSet"
observes="cmd_removePrevWordInCaretSet"
/>
</menupopup>
</menu>

Expand Down
2 changes: 2 additions & 0 deletions src/chrome/komodo/locale/en-US/komodo.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,8 @@
<!ENTITY quitApplicationCmdMac.accesskey "Q">
<!ENTITY quitApplicationCmdWin.label "Exit">
<!ENTITY quitApplicationCmdWin.accesskey "x">
<!ENTITY removePrevWordInCaretSet.label "Multiple Selection - Remove Previous Occurrence">
<!ENTITY removePrevWordInCaretSet.desc "Editor: Remove Previous Word in a Multi-Caret Set">
<!ENTITY rename.label "Rename...">
<!ENTITY renameTag.label "Rename Tag">
<!ENTITY renameTag.desc "Editor: Rename Start- and End-Tag Name Simultaneously">
Expand Down
4 changes: 3 additions & 1 deletion src/schemes/Default.p.kkf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version 48
version 49

# Movement and selection
binding cmd_left Left
Expand Down Expand Up @@ -224,3 +224,5 @@ binding cmd_scope-openfiles Ctrl+<
binding cmd_invokeHyperlink Ctrl+Shift+G

binding cmd_addNextWordToCaretSet Ctrl+D
binding cmd_removePrevWordInCaretSet Ctrl+Shift+D

3 changes: 2 additions & 1 deletion src/schemes/Emacs.p.kkf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version 48
version 49

# Needs a few things to be finished
# - ?? insert forward tab / insert backward tab
Expand Down Expand Up @@ -231,3 +231,4 @@ binding cmd_scope-openfiles Ctrl+<
binding cmd_invokeHyperlink Ctrl+Shift+G

#binding cmd_addNextWordToCaretSet Ctrl+K Ctrl+D
#binding cmd_removePrevWordInCaretSet Ctrl+K Ctrl+D
3 changes: 2 additions & 1 deletion src/schemes/Mac.p.kkf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version 48
version 49

binding cmd_back Shift+Backspace
binding cmd_backSmart Backspace
Expand Down Expand Up @@ -193,6 +193,7 @@ binding cmd_scope-openfiles Meta+<
binding cmd_invokeHyperlink Ctrl+Shift+G

binding cmd_addNextWordToCaretSet Ctrl+D
binding cmd_removePrevWordInCaretSet Ctrl+Shift+D
binding cmd_htmlTagRelocator Ctrl+Shift+Z

binding cmd_lineTransposeUp Ctrl+Up
Expand Down

0 comments on commit e050896

Please sign in to comment.