Skip to content

Commit

Permalink
Submitting expand-selection-to-line script.
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardo-architect committed Feb 21, 2024
1 parent fc2b3f0 commit 0340865
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
29 changes: 29 additions & 0 deletions expand-selection-to-line/expand-selection-to-line.qml
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());
}
}
}

10 changes: 10 additions & 0 deletions expand-selection-to-line/info.json
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."
}

0 comments on commit 0340865

Please sign in to comment.