aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/change.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-02-08 21:10:32 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-02-08 21:10:32 +0800
commit3c75e63bf68f6ee88d1eda31caf042ed132badd9 (patch)
tree7ef48bb661f074258198f8e514976c56ec2daa09 /src/nvim/change.c
parent51b432a7d1aa2a76ccfbf7a50f19c53e1151609f (diff)
downloadrneovim-3c75e63bf68f6ee88d1eda31caf042ed132badd9.tar.gz
rneovim-3c75e63bf68f6ee88d1eda31caf042ed132badd9.tar.bz2
rneovim-3c75e63bf68f6ee88d1eda31caf042ed132badd9.zip
vim-patch:8.2.4326: "o" and "O" copying comment not sufficiently tested
Problem: "o" and "O" copying comment not sufficiently tested. Solution: Add a test case. (closes vim/vim#9718) https://github.com/vim/vim/commit/51ab7c7d0da08aac796acff22a6c075dac579e76 Fix a mistake when porting Vim patch 8.2.3934
Diffstat (limited to 'src/nvim/change.c')
-rw-r--r--src/nvim/change.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/change.c b/src/nvim/change.c
index 54c4ba5319..6ac759d5e0 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -1201,10 +1201,10 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// Find out if the current line starts with a comment leader.
// This may then be inserted in front of the new line.
end_comment_pending = NUL;
- if (flags & OPENLINE_DO_COM && dir == FORWARD) {
- // Check for a line comment after code.
+ if (flags & OPENLINE_DO_COM) {
lead_len = get_leader_len(saved_line, &lead_flags, dir == BACKWARD, true);
- if (lead_len == 0 && do_cindent) {
+ if (lead_len == 0 && do_cindent && dir == FORWARD) {
+ // Check for a line comment after code.
comment_start = check_linecomment(saved_line);
if (comment_start != MAXCOL) {
lead_len = get_leader_len(saved_line + comment_start,