Description
Summary
With 25.01, adding a new line after a comment/doc comment prepend the relevant comment prefix to the new line. This seems to give weird results in some cases
Reproduction Steps
I began with the following code in Rust
/// Details of an IPv4 address.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Ipv4Details {}
/// Details of an IPv6 address.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Ipv6Details {}
I wanted to add a line in the doc comments of both that they're currently unused and only exist for completeness. So I put my only cursor after the period on the IPv4 comment, then alt-clicked to place a new cursor after the period on the IPv6 comment.
After this, I pressed enter twice, and had the following code:
/// Details of an IPv4 address.
///
///
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Ipv4Details {}
/// Details of an IPv6 address.
///
///
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Ipv6Details {}
While the text is as expected and the cursor for the IPv4 comment was at the end of the doc comment's third line as expected, the cursor for the IPv6 comment was over the #
of the derive invocation.
Reversing the order of cursors gives the exact same result, with the IPv6 comment giving the weird result
Helix log
~/.cache/helix/helix.log
The log doesn't contain any lines past 2025-01-04, so I assume it's not relevant. Also I doubt any of the code involved has any reason to print to the log.
Platform
Linux, Kubuntu 24.10, KDE Plasma 6.1.5
Terminal Emulator
Konsole 24.08.1
Installation Method
Snap
Helix Version
25.1 (dabfb6c)