Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2016-03-16 12:52:09 +0000
committerTom Schindl2016-03-16 12:52:09 +0000
commite7344acaf3ec022976e279e06dd816c783ecddb5 (patch)
tree2fc8042d1e4f51ab86d2000684275f4988cf47f8
parent25459d2cf45c83fceaf960a4fc67be4c932c923a (diff)
parent57affa18f3450256590f615e73632c44f3c81b52 (diff)
downloadorg.eclipse.efxclipse-e7344acaf3ec022976e279e06dd816c783ecddb5.tar.gz
org.eclipse.efxclipse-e7344acaf3ec022976e279e06dd816c783ecddb5.tar.xz
org.eclipse.efxclipse-e7344acaf3ec022976e279e06dd816c783ecddb5.zip
Merge branch 'master' of ssh://tschindl@git.eclipse.org:29418/efxclipse/org.eclipse.efxclipse
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/StyledTextArea.java11
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/behavior/StyledTextBehavior.java12
2 files changed, 16 insertions, 7 deletions
diff --git a/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/StyledTextArea.java b/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/StyledTextArea.java
index d0133df46..237beb772 100644
--- a/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/StyledTextArea.java
+++ b/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/StyledTextArea.java
@@ -1705,4 +1705,15 @@ public class StyledTextArea extends Control {
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
return getClassCssMetaData();
}
+
+ /**
+ * navigates to specified line
+ * @param lineIndex
+ */
+ public void navigateToLine(int lineIndex) {
+ if (lineIndex >= 0 && lineIndex <= getContent().getLineCount()) {
+ int offset = getContent().getOffsetAtLine(lineIndex);
+ setCaretOffset(offset);
+ }
+ }
}
diff --git a/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/behavior/StyledTextBehavior.java b/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/behavior/StyledTextBehavior.java
index 2f25be6c5..8cb7f9059 100644
--- a/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/behavior/StyledTextBehavior.java
+++ b/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/behavior/StyledTextBehavior.java
@@ -1025,10 +1025,7 @@ public class StyledTextBehavior {
}
protected void defaultNavigateToLine(int lineIndex) {
- if (lineIndex >= 0 && lineIndex <= getControl().getContent().getLineCount()) {
- int offset = getControl().getContent().getOffsetAtLine(lineIndex);
- getControl().setCaretOffset(offset);
- }
+ getControl().navigateToLine(lineIndex);
}
@@ -1403,6 +1400,8 @@ public class StyledTextBehavior {
keyMapping.mapKey(new KeyCombo(D, MetaKey), this.ACTION_DELETE_LINE);
keyMapping.mapKey(new KeyCombo(UP, AltKey), this.ACTION_MOVE_LINES_UP);
keyMapping.mapKey(new KeyCombo(DOWN, AltKey), this.ACTION_MOVE_LINES_DOWN);
+
+ keyMapping.mapKey(new KeyCombo(KeyCode.L, MetaKey), this.ACTION_NAVIGATE_TO_LINE);
} else {
keyMapping.mapKey(new KeyCombo(RIGHT, ControlKey), this.ACTION_NAVIGATE_WORD_NEXT);
keyMapping.mapKey(new KeyCombo(LEFT, ControlKey), this.ACTION_NAVIGATE_WORD_PREVIOUS);
@@ -1437,6 +1436,8 @@ public class StyledTextBehavior {
keyMapping.mapKey(new KeyCombo(UP, AltKey), this.ACTION_MOVE_LINES_UP);
keyMapping.mapKey(new KeyCombo(DOWN, AltKey), this.ACTION_MOVE_LINES_DOWN);
+ keyMapping.mapKey(new KeyCombo(KeyCode.L, ControlKey), this.ACTION_NAVIGATE_TO_LINE);
+
}
keyMapping.mapKey(new KeyCombo(TAB), this.ACTION_INDENT, this::isMultilineSelection);
@@ -1459,9 +1460,6 @@ public class StyledTextBehavior {
// action for insert tab support
keyMapping.mapKey(new KeyCombo(TAB), () -> getControl().insert("\t")); //$NON-NLS-1$
-
-
- keyMapping.mapKey(new KeyCombo(KeyCode.L, ControlKey), this.ACTION_NAVIGATE_TO_LINE);
}
// /**

Back to the top