Skip to content

Lines copied with multi-cusor pastes with extra newlines #40923

@injust

Description

@injust

Summary

After copying entire lines (i.e. without selection) with multiple cursors, pasting with a different number of cursors adds extra newlines between the pasted lines.

Description

As noted by @notpeter in #34797 (comment) (emphasis mine):

Multicursor cut/copy in vscode does not use this alternate line-wise paste mode and pastes to the cursor position(s) like a normal clipboard action. Multicursor in Jetbrains and Sublime have an odd behavior -- when cut/copying two adjacent lines if you paste to a single cursor you will get an extra line break between the pasted lines. (this makes cut/paste non-symmetrical). If pasting two lines to two cursors, Sublime will give you four lines separated by two linebreaks each; jetbrains will give you two lines seperated by two newlines each. I find all of these behaviors unintuitive.

Steps to reproduce:

  1. Place multiple (N > 1) cursors on separate lines
  2. Copy (without selecting any text, which copies entire lines)
  3. Paste using a different number of cursors (including just 1 cursor)

Expected Behavior: N lines are pasted at each cursor
Actual Behavior: 2N-1 lines are pasted at each cursor (the original N lines are interleaved with extra newlines)

Zed Version and System Specs

Zed: v0.209.4 (Zed)
OS: macOS 15.7.1
Memory: 16 GiB
Architecture: x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    editorFeedback for code editing, formatting, editor iterations, etcreproducibleVerified steps to reproduce included

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions