Commit Graph

18 Commits

Author SHA1 Message Date
Maxime Coste
567c82840a ruby.kak: Refactor end autoinsertion logic to be more robust
Fixes the bug described by PR #1994
2018-04-14 12:47:42 +10:00
Nate Clark
27604359d4 Add test for buggy ruby method newline
Currently, inserting a newline after a ruby method will incorrectly
cause the following line to repeat the method header. This commit
adds a test case to illustrate the bug.
2018-04-10 18:30:12 -05:00
Maxime Coste
65258934d3 lua.kak: Rework 'end' auto insertion logic
Fixes #1525
2018-03-04 10:36:32 +11:00
Alyssa Ross
79af68843e
Add Ruby indentation test
See https://github.com/mawww/kakoune/issues/1525#issuecomment-324571751.
2018-03-02 13:13:19 +00:00
Maxime Coste
67424aae1e Remove avoidance of end of lines
Various places in Kakoune code used to modify selections so that
cursors would not lie on an end of line. Remove those to increase
Kakoune's consistency and simplicity.

Now that end of lines are highlighted separately, they should not
be handled specially in most commands.
2018-02-25 00:05:05 +11:00
Maxime Coste
1a38849086 c-family.kak: indent after parenthesis at end of line 2017-12-03 17:47:44 +08:00
Maxime Coste
2b993b7c4b Add an indent test for html closing tag 2017-11-04 12:45:27 +08:00
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