-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Submitting expand-selection-to-line script.
- Loading branch information
1 parent
fc2b3f0
commit 0340865
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import QtQml 2.0 | ||
import QOwnNotesTypes 1.0 | ||
|
||
/** | ||
* Script that expands selection to the current line for fast editing purposes | ||
*/ | ||
Script { | ||
/** | ||
* Initializes the custom actions | ||
*/ | ||
function init() { | ||
script.registerCustomAction("expandSelectionToLine", "Expand Selection To Line"); | ||
} | ||
|
||
function customActionInvoked(action) { | ||
/** | ||
* Locates the current line and expands selection to it | ||
*/ | ||
if (action == "expandSelectionToLine") { | ||
// selects the current line | ||
script.noteTextEditSelectCurrentLine(); | ||
// expands the selection to fit the line | ||
script.noteTextEditSetSelection( | ||
script.noteTextEditSelectionStart(), | ||
script.noteTextEditSelectionEnd()); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "Expand selection to line", | ||
"identifier": "expand-selection-to-line", | ||
"script": "expand-selection-to-line.qml", | ||
"authors": ["@eduardo-architect"], | ||
"platforms": ["linux", "macos", "windows"], | ||
"version": "0.0.1", | ||
"minAppVersion": "17.05.8", | ||
"description" : "Minimal script, that expands selection to the current line." | ||
} |