This is an automated email from the ASF dual-hosted git repository.
lkishalmi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 7f8dfdeb60 YAML: Step right curly and brackets when they are right to
the caret
7f8dfdeb60 is described below
commit 7f8dfdeb60ce3bec5554fc19ddb40fac0388d885
Author: Laszlo Kishalmi <[email protected]>
AuthorDate: Tue Apr 11 07:55:58 2023 -0700
YAML: Step right curly and brackets when they are right to the caret
---
.../modules/languages/yaml/YamlKeystrokeHandler.java | 7 +++++++
.../modules/languages/yaml/YamlKeystrokeHandlerTest.java | 16 ++++++++++++++++
2 files changed, 23 insertions(+)
diff --git
a/ide/languages.yaml/src/org/netbeans/modules/languages/yaml/YamlKeystrokeHandler.java
b/ide/languages.yaml/src/org/netbeans/modules/languages/yaml/YamlKeystrokeHandler.java
index d547ff19a6..a6c1e8f288 100644
---
a/ide/languages.yaml/src/org/netbeans/modules/languages/yaml/YamlKeystrokeHandler.java
+++
b/ide/languages.yaml/src/org/netbeans/modules/languages/yaml/YamlKeystrokeHandler.java
@@ -115,6 +115,13 @@ public class YamlKeystrokeHandler implements
KeystrokeHandler {
return true;
}
+ if (((c == '}') || (c == ']')) && dotPos < doc.getLength()) {
+ if (String.valueOf(c).equals(doc.getText(dotPos, 1))) {
+ caret.setDot(dotPos + 1);
+ return true;
+ }
+ }
+
if ((c == '\'') || (c == '"')) {
int sstart = target.getSelectionStart();
int send = target.getSelectionEnd();
diff --git
a/ide/languages.yaml/test/unit/src/org/netbeans/modules/languages/yaml/YamlKeystrokeHandlerTest.java
b/ide/languages.yaml/test/unit/src/org/netbeans/modules/languages/yaml/YamlKeystrokeHandlerTest.java
index fa2793ff20..5529f2c792 100644
---
a/ide/languages.yaml/test/unit/src/org/netbeans/modules/languages/yaml/YamlKeystrokeHandlerTest.java
+++
b/ide/languages.yaml/test/unit/src/org/netbeans/modules/languages/yaml/YamlKeystrokeHandlerTest.java
@@ -189,6 +189,22 @@ public class YamlKeystrokeHandlerTest extends YamlTestBase
{
insertChar("foo: '^'", '\'', "foo: ''^");
}
+ public void testStepCurly1() throws Exception {
+ insertChar("foo: {^}", '}', "foo: {}^");
+ }
+
+ public void testStepCurly2() throws Exception {
+ insertChar("foo: {{^}}", '}', "foo: {{}^}");
+ }
+
+ public void testStepBracket1() throws Exception {
+ insertChar("foo: [^]", ']', "foo: []^");
+ }
+
+ public void testStepBracket2() throws Exception {
+ insertChar("foo: [[^]]", ']', "foo: [[]^]");
+ }
+
public void testDeleteSingle1() throws Exception {
deleteChar("foo: '^'", "foo: ^");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists