branch: elpa/yaml-mode commit 3362e1be9df87b1cf13a0fc40e53f511ebab9add Merge: dcdcd81 bdc47a4 Author: Vasilij Schneidermann <v.schneiderm...@gmail.com> Commit: Vasilij Schneidermann <v.schneiderm...@gmail.com>
Merge pull request #33 from antalk2/antalk2-patch-1 allow spaces before '-' in yaml-scalar-context-re --- test-files/allow-spaces-before-dash-1.yaml | 18 ++++++++++++++++++ test-files/allow-spaces-before-dash-2.yaml | 7 +++++++ test-files/allow-spaces-before-dash-3.yaml | 7 +++++++ yaml-mode.el | 2 +- 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/test-files/allow-spaces-before-dash-1.yaml b/test-files/allow-spaces-before-dash-1.yaml new file mode 100644 index 0000000..c46f823 --- /dev/null +++ b/test-files/allow-spaces-before-dash-1.yaml @@ -0,0 +1,18 @@ + +## Old behaviour (v0.0.12) +## +## (1) open this file +## +## (2) move to the line containing l1 +## +## (3) Press TAB. First character of l1 should now be below '|', but +## it is below the dash +## +## New behaviour: +## +## (1) When l1 is unindented, pressing TAB indents it to start below '|' +## +## +- bb: + - | +l1 diff --git a/test-files/allow-spaces-before-dash-2.yaml b/test-files/allow-spaces-before-dash-2.yaml new file mode 100644 index 0000000..3fa43f4 --- /dev/null +++ b/test-files/allow-spaces-before-dash-2.yaml @@ -0,0 +1,7 @@ +# For comparison: this is handled correctly in v0.0.12 +# +# (1) Move to line containing l3 +# (2) TAB indents l3 by 2 spaces to start below '|' +# +- | +l3 diff --git a/test-files/allow-spaces-before-dash-3.yaml b/test-files/allow-spaces-before-dash-3.yaml new file mode 100644 index 0000000..4703b9b --- /dev/null +++ b/test-files/allow-spaces-before-dash-3.yaml @@ -0,0 +1,7 @@ +# For comparison: this is handled correctly in v0.0.12 +# +# (1) Move to line containing l4 +# (2) Pressing TAB indents l4 by 2 spaces to starts below ':' +# +xy: | +l4 diff --git a/yaml-mode.el b/yaml-mode.el index e40a3bd..3e67139 100644 --- a/yaml-mode.el +++ b/yaml-mode.el @@ -146,7 +146,7 @@ that key is pressed to begin a block literal." "Regexp matching a single YAML hash key.") (defconst yaml-scalar-context-re - (concat "\\(?:^\\(?:--- \\)?\\|{\\|\\(?:[-,] +\\)+\\) *" + (concat "\\(?:^\\(?:--- \\)?\\|{\\|\\(?: *[-,] +\\)+\\) *" "\\(?:" yaml-bare-scalar-re " *: \\)?") "Regexp indicating the begininng of a scalar context.")