File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
app/src/processing/app/syntax Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ public class SketchTextAreaEditorKit extends RSyntaxTextAreaEditorKit {
1515
1616 private static final Action [] defaultActions = {
1717 new DeleteNextWordAction (),
18- new DeleteLineToCursorAction ()
18+ new DeleteLineToCursorAction (),
19+ new SelectWholeLineAction ()
1920 };
2021
2122 @ Override
@@ -100,4 +101,29 @@ public String getMacroID() {
100101
101102 }
102103
104+ /**
105+ * Selects the line around the caret.
106+ */
107+ public static class SelectWholeLineAction extends RecordableTextAction {
108+
109+ public SelectWholeLineAction () {
110+ super (selectLineAction );
111+ }
112+
113+ @ Override
114+ public void actionPerformedImpl (ActionEvent e , RTextArea textArea ) {
115+ Document document = textArea .getDocument ();
116+ Element map = document .getDefaultRootElement ();
117+ int currentLineNum = map .getElementIndex (textArea .getCaretPosition ());
118+ Element currentLineElement = map .getElement (currentLineNum );
119+ textArea .select (currentLineElement .getStartOffset (), currentLineElement .getEndOffset ());
120+ }
121+
122+ @ Override
123+ public final String getMacroID () {
124+ return DefaultEditorKit .selectLineAction ;
125+ }
126+
127+ }
128+
103129}
You can’t perform that action at this time.
0 commit comments