Commit Graph

11 Commits

Author SHA1 Message Date
Maxime Coste
78530b82be Add an indentation test for braces after if 2017-10-25 10:27:39 +08:00
Tim Allen
e640e6d859 Consecutive markdown list bullets are not a valid list prefix.
Previously, if you opened a new line after an underlined heading (what
the CommonMark spec calls a "Setext heading") or inserted a newline into
a line that started with `**strong emphasis**` the Markdown autoindent
hook would assume the leading symbols were list bullets and paste them
at the beginning of the new line.

However, the CommonMark specification says that list bullets must be
followed by at least one horizontal whitespace character, so Setext
heading underlines and strong emphasis are not valid list bullets and
should not be matched by the autoindent pattern.

This commit changes the regex that selects the pastable prefix of the
previous line so that it must match either:

  - One or more `>` characters with optional whitespace between them
    (a blockquote prefix), optionally followed by a list bullet; or
  - An optional blockquote prefix and a list bullet

Since we don't strictly need either the blockquote prefix nor the list
bullet, we could concievably just make both optional... but for lines
without either, the regex would find a zero-length match, and for the
purposes of copy/paste Kakoune treats that as a one-character match.
Therefore, the regex is written to fail if neither pattern is found.
2017-08-01 20:36:40 +10:00
Tim Allen
8a6df93dc6 More tests for markdown autoindent.
All these tests pass with the current implementation.
2017-08-01 19:53:01 +10:00
Maxime Coste
bb9dd14a09 Check final cursor position in indent/c-family/indent-if-body test 2017-07-29 10:46:41 +07:00
Maxime Coste
e73cd78288 Fix corner case in C family indenting 2017-06-13 10:19:38 +01:00
Maxime Coste
1c16a91fd6 Add some missing tests for c-family indent 2017-05-21 22:33:00 +01:00
Maxime Coste
2f9b77b748 Smarter align to opening parenthesis/brace supporting multiline 2017-05-21 22:31:05 +01:00
Maxime Coste
cab0adaa53 Support aligning to opening { as well as ( in c-family indent 2017-05-20 11:08:13 +01:00
Maxime Coste
fc61ed93e6 Import unit tests from danr/comment-insertion-refix pull request 2017-01-13 00:30:02 +00:00
Maxime Coste
d5231c713e Fix corner case in C indentation 2017-01-02 04:15:12 +00:00
Maxime Coste
d8f00198f3 Improve C indentation support around namespace/struct closing bracket 2016-12-09 13:50:41 +00:00