Ibrahim Khan
52af3dd60c
vim: Continue multiline comments with o ( #63751 )
...
# Objective
In Vim mode, pressing `o` to open a line inside a documentation-style
block comment preserves indentation but drops the `* ` prefix.
The behavior for pressing Return is already correct as it continues this
prefix in the next line.
This change makes both actions behave consistently.
Fixes #55049
## Solution
Make Vim’s `o` and `O` commands copy documentation-comment prefixes such
as `* ` onto the new line. This happens only when the current line is
parsed as a comment.
Also added regression coverage for this and folded it into the existing
`test_o_comment` test.
## Testing
- `CC=clang CXX=clang++ cargo test -p vim test_o_comment -- --nocapture`
- `CC=clang CXX=clang++ cargo test -p vim`
- `CC=clang CXX=clang++ cargo test -p multi_buffer`
- `cargo fmt --all -- --check`
- `CC=clang CXX=clang++ ./script/clippy -p vim -p multi_buffer`
- Tested on Linux aarch64.
## Self-Review Checklist:
- [x] I reviewed the diff for quality, security, and reliability
- [x] Unsafe blocks, if any, have justifying comments
- [x] The content adheres to the Zed UI standards
- [x] Tests cover the changed behavior
- [x] Performance impact is acceptable
---
Release Notes:
- Fixed Vim `o` comment continuation in C-style multiline comments.
2026-09-04 11:09:15 +00:00
..
2026-09-01 15:52:33 +00:00
2026-08-20 10:08:48 +00:00
2026-09-01 15:52:33 +00:00
2026-09-04 10:39:14 +00:00
2026-09-03 18:29:10 +00:00
2026-08-20 10:08:48 +00:00
2026-08-18 12:40:18 +00:00
2026-06-08 14:57:47 +00:00
2026-09-03 18:29:10 +00:00
2026-08-20 10:08:48 +00:00
2026-09-01 18:58:47 +00:00
2026-08-20 10:08:48 +00:00
2026-08-31 17:37:00 +00:00
2026-08-20 10:08:48 +00:00
2026-08-19 14:32:19 +00:00
2026-08-19 14:32:19 +00:00
2026-08-20 10:08:48 +00:00
2026-08-24 20:32:44 +00:00
2026-08-31 11:58:50 +00:00
2026-06-01 04:40:13 +00:00
2026-09-01 15:52:33 +00:00
2026-08-09 22:29:52 +00:00
2026-08-28 11:51:00 +00:00
2026-08-31 11:58:50 +00:00
2026-08-26 14:33:13 +00:00
2026-09-03 14:38:23 +00:00
2026-08-31 05:45:47 +00:00
2026-09-03 14:38:23 +00:00
2026-08-20 17:53:44 +00:00
2026-08-20 16:42:42 +00:00
2026-09-02 19:54:04 +00:00
2026-08-27 16:21:41 +00:00
2026-06-05 10:32:57 +00:00
2026-08-28 22:35:33 +00:00
2026-06-05 10:32:57 +00:00
2026-05-29 07:06:57 +00:00
2026-08-26 14:33:10 +00:00
2026-08-29 22:33:39 +00:00
2026-08-28 18:06:41 +00:00
2026-09-01 18:58:47 +00:00
2026-07-30 10:34:16 +00:00
2026-08-31 15:29:14 +00:00
2026-08-20 10:08:48 +00:00
2026-08-26 14:33:13 +00:00
2026-08-20 10:08:48 +00:00
2026-04-24 10:29:51 +00:00
2026-05-13 23:35:10 +00:00
2026-08-28 18:59:38 +00:00
2026-08-14 09:38:52 +00:00
2026-09-04 03:02:13 +00:00
2026-08-27 12:55:42 +00:00
2026-08-09 22:29:52 +00:00
2026-09-01 16:07:40 +00:00
2026-08-31 17:37:00 +00:00
2026-08-31 12:04:06 +00:00
2026-08-20 10:08:48 +00:00
2026-08-20 16:42:42 +00:00
2026-09-01 16:07:40 +00:00
2026-09-04 08:25:51 +00:00
2026-06-05 19:24:28 +00:00
2026-08-27 16:21:41 +00:00
2026-09-02 18:21:25 +00:00
2026-08-09 22:29:52 +00:00
2026-08-20 10:08:48 +00:00
2026-09-02 18:21:25 +00:00
2026-09-02 18:23:27 +00:00
2026-08-20 10:08:48 +00:00
2026-09-02 22:45:15 +00:00
2026-09-02 18:23:27 +00:00
2026-08-27 16:21:41 +00:00
2026-08-04 15:35:05 +00:00
2026-04-18 06:34:19 +00:00
2026-05-04 06:30:47 +00:00
2026-08-27 16:21:41 +00:00
2026-08-27 20:11:28 +00:00
2026-09-04 10:39:14 +00:00
2026-07-30 13:24:19 +00:00
2026-07-30 12:59:16 +00:00
2026-09-03 11:14:41 +00:00
2026-08-21 21:31:55 +00:00
2026-09-04 10:08:26 +00:00
2026-09-01 15:52:33 +00:00
2026-08-20 10:08:48 +00:00
2026-08-28 14:06:27 +00:00
2026-09-03 14:36:51 +00:00
2026-08-31 17:37:00 +00:00
2026-09-01 15:53:08 +00:00
2026-08-31 14:31:41 +00:00
2026-07-08 15:52:48 +00:00
2026-08-26 11:00:10 +00:00
2026-09-01 21:39:47 +00:00
2026-06-16 13:47:55 +00:00
2026-09-01 21:39:47 +00:00
2026-09-04 01:35:56 +00:00
2026-08-25 17:56:09 +00:00
2026-09-02 18:21:25 +00:00
2026-08-31 17:37:00 +00:00
2026-08-11 15:16:03 +00:00
2026-08-26 14:33:13 +00:00
2026-07-14 15:29:30 +00:00
2026-08-31 14:36:04 +00:00
2026-08-26 21:36:59 +00:00
2026-08-25 23:21:19 +00:00
2026-08-31 17:37:00 +00:00
2026-06-22 18:20:57 +00:00
2026-08-20 10:08:48 +00:00
2026-08-27 17:09:28 +00:00
2026-08-26 14:33:10 +00:00
2026-09-02 18:23:27 +00:00
2026-08-19 16:26:14 +00:00
2026-08-28 13:19:29 +00:00
2026-09-02 18:23:27 +00:00
2026-08-28 14:06:27 +00:00
2026-09-03 16:46:06 +00:00
2026-09-03 18:29:10 +00:00
2026-09-02 15:41:05 +00:00
2026-08-27 16:21:41 +00:00
2026-09-03 09:35:53 +00:00
2026-08-27 12:55:42 +00:00
2026-08-27 16:21:41 +00:00
2026-08-26 14:33:13 +00:00
2026-08-20 10:20:14 +00:00
2026-09-02 15:41:05 +00:00
2026-09-02 15:41:05 +00:00
2026-09-02 19:54:04 +00:00
2026-08-20 11:17:57 +00:00
2026-09-04 10:54:29 +00:00
2026-09-04 10:54:29 +00:00
2026-09-02 18:21:25 +00:00
2026-09-02 18:21:25 +00:00
2026-09-04 10:54:29 +00:00
2026-08-21 07:28:05 +00:00
2026-08-25 09:46:30 +00:00
2026-09-04 11:09:15 +00:00
2026-08-20 10:08:48 +00:00
2026-08-20 10:08:48 +00:00
2026-08-20 10:08:48 +00:00
2026-05-14 21:03:56 +00:00
2026-06-23 09:21:31 +00:00
2026-08-27 16:21:41 +00:00
2026-09-02 15:41:05 +00:00
2026-08-27 16:21:41 +00:00
2026-09-02 15:41:05 +00:00
2026-09-02 13:50:06 +00:00
2026-08-19 11:07:38 +00:00
2026-08-28 03:28:04 +00:00
2026-08-31 14:36:04 +00:00
2026-08-19 12:16:37 +00:00
2026-07-15 08:33:25 +00:00
2026-08-19 21:10:56 +00:00
2026-07-14 17:18:23 +00:00
2026-08-18 07:00:34 +00:00
2026-06-13 05:21:05 +00:00
2026-09-02 19:54:04 +00:00
2026-08-18 10:02:20 +00:00
2026-09-04 11:05:53 +00:00
2026-08-28 11:51:00 +00:00
2026-08-27 12:55:42 +00:00
2026-09-02 19:54:04 +00:00
2026-07-23 22:46:06 +00:00
2026-09-03 11:04:20 +00:00
2026-07-27 18:20:35 +00:00
2026-09-04 03:02:13 +00:00
2026-08-18 10:02:20 +00:00
2026-09-02 19:54:04 +00:00
2026-08-20 10:08:48 +00:00
2026-08-20 10:08:48 +00:00
2026-08-20 10:08:48 +00:00
2026-08-27 16:21:41 +00:00
2026-09-02 18:21:25 +00:00
2026-08-31 13:35:07 +00:00
2026-08-20 10:08:48 +00:00
2026-08-31 11:41:34 +00:00
2026-08-24 10:41:04 +00:00
2026-09-04 11:05:53 +00:00
2026-09-04 11:05:53 +00:00
2026-08-28 17:22:25 +00:00
2026-06-23 09:33:47 +00:00
2026-09-04 11:05:53 +00:00
2026-05-05 16:25:56 +00:00
2026-09-03 18:29:10 +00:00
2026-07-20 11:17:43 +00:00
2026-04-29 10:27:47 +00:00
2026-08-27 16:21:41 +00:00
2026-08-24 20:13:37 +00:00
2026-08-09 22:29:52 +00:00
2026-05-27 19:33:04 +00:00
2026-08-20 10:08:48 +00:00
2026-07-20 04:08:28 +00:00
2026-08-28 03:28:04 +00:00
2026-05-04 06:30:47 +00:00
2026-07-31 19:57:13 +00:00
2026-08-31 12:04:06 +00:00
2026-08-18 07:58:21 +00:00
2026-08-20 10:08:48 +00:00
2026-08-20 10:08:48 +00:00
2026-08-27 06:40:50 +00:00
2026-08-26 14:33:10 +00:00
2026-08-28 18:05:57 +00:00
2026-08-29 22:00:45 +00:00
2026-07-29 20:59:24 +00:00
2026-08-27 16:21:41 +00:00
2026-09-04 10:54:29 +00:00
2026-05-28 19:43:30 +00:00
2026-09-04 09:32:29 +00:00
2026-08-28 17:31:36 +00:00
2026-09-03 09:35:53 +00:00
2026-07-01 04:25:40 +00:00
2026-05-29 07:06:57 +00:00
2026-06-08 14:59:39 +00:00
2026-09-04 03:02:13 +00:00
2026-09-04 11:09:15 +00:00
2026-05-27 10:31:53 +00:00
2026-08-20 10:08:48 +00:00
2026-08-20 10:08:48 +00:00
2026-09-03 09:35:53 +00:00
2026-05-01 22:33:54 +00:00
2026-09-04 10:54:29 +00:00
2026-08-20 12:29:17 +00:00
2026-08-28 14:06:27 +00:00
2026-09-04 10:08:26 +00:00
2026-09-03 09:35:53 +00:00
2026-08-20 10:08:48 +00:00
2026-08-09 22:29:52 +00:00
2026-09-01 21:39:47 +00:00
2026-09-01 21:39:47 +00:00
2026-09-01 21:39:47 +00:00