branch: elpa/yaml-mode commit d88c80acca22f864ce9dcd4b140593c1d7ea68bf Author: Antal K <anta...@gmail.com> Commit: Antal K <anta...@gmail.com>
allow spaces before dash-newline --- .../test-dash-newline-starts-sequence-2.yaml | 28 ++++++++++++++++++++++ yaml-mode.el | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/test-files/test-dash-newline-starts-sequence-2.yaml b/test-files/test-dash-newline-starts-sequence-2.yaml new file mode 100644 index 0000000..cc92543 --- /dev/null +++ b/test-files/test-dash-newline-starts-sequence-2.yaml @@ -0,0 +1,28 @@ +# +# Old behaviour (version 0.0.12) +# +# (1) Move to cursor to the beginning of the line containing 'aaa' +# (2) Press TAB repeatedly +# +# (3) The cycle of indentations of the line should include +# the 'indented more than the previous line' +# +# Problem: the line is only indented to align with +# the dash in then previous line, but not more. +# +# Note: in the line containing the dash ('-') there is no space character +# after the dash, so it is not recognized as start of the sequence entry +# by yaml-nested-sequence-re +# +# Proposed change: +# +# Change yaml-bare-scalar-re to recognize the dash-newline sequence. +# +# New behaviour: +# +# (1) Pressing TAB on the line containing 'aaa' now indents the line. +# (2) Pressing TAB again unindents the line. +# +- + - +aaa diff --git a/yaml-mode.el b/yaml-mode.el index c7c8966..ea60b13 100644 --- a/yaml-mode.el +++ b/yaml-mode.el @@ -162,7 +162,7 @@ that key is pressed to begin a block literal." "Regexp matching a line beginning a YAML block literal.") (defconst yaml-nested-sequence-re - (concat "^\\(?:\\(?: *- +\\)+\\|\\(:?-$\\)\\)" + (concat "^\\(?:\\(?: *- +\\)+\\|\\(:? *-$\\)\\)" "\\(?:" yaml-bare-scalar-re " *:\\(?: +.*\\)?\\)?$") "Regexp matching a line containing one or more nested YAML sequences.")