aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-02-01 04:23:59 +0800
committerGitHub <noreply@github.com>2022-02-01 04:23:59 +0800
commit5205bcc9049a171e90ebd01bbc0367f4ae2371d1 (patch)
tree326fb170c0e4c18b6d1941031c107397084e56bd /src/nvim/ops.c
parentc00b844988ddbb5c0dc2ee2b6b4dbbc2901b5fbe (diff)
parentba2bb6a81b0b25cc1670a5b9524d17c9cba27296 (diff)
downloadrneovim-5205bcc9049a171e90ebd01bbc0367f4ae2371d1.tar.gz
rneovim-5205bcc9049a171e90ebd01bbc0367f4ae2371d1.tar.bz2
rneovim-5205bcc9049a171e90ebd01bbc0367f4ae2371d1.zip
Merge pull request #17254 from zeertzjq/vim-8.2.3787
vim-patch:8.2.{3787,3932,3934,3935,3938}: text formatting patches
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r--src/nvim/ops.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 83a7c31991..11484eee57 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -4350,7 +4350,7 @@ void format_lines(linenr_T line_count, int avoid_fex)
int leader_len = 0; // leader len of current line
int next_leader_len; // leader len of next line
char_u *leader_flags = NULL; // flags for leader of current line
- char_u *next_leader_flags; // flags for leader of next line
+ char_u *next_leader_flags = NULL; // flags for leader of next line
bool advance = true;
int second_indent = -1; // indent for second line (comment aware)
bool first_par_line = true;
@@ -4467,7 +4467,14 @@ void format_lines(linenr_T line_count, int avoid_fex)
leader_len, leader_flags,
next_leader_len,
next_leader_flags)) {
- is_end_par = true;
+ // Special case: If the next line starts with a line comment
+ // and this line has a line comment after some text, the
+ // paragraph doesn't really end.
+ if (next_leader_flags == NULL
+ || STRNCMP(next_leader_flags, "://", 3) != 0
+ || check_linecomment(get_cursor_line_ptr()) == MAXCOL) {
+ is_end_par = true;
+ }
}
/*