Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot paste multi line text from system clipboard in some cases #8600

Closed
CptPotato opened this issue Oct 24, 2023 · 1 comment
Closed

Cannot paste multi line text from system clipboard in some cases #8600

CptPotato opened this issue Oct 24, 2023 · 1 comment
Labels
C-bug Category: This is a bug

Comments

@CptPotato
Copy link
Contributor

CptPotato commented Oct 24, 2023

Summary

I continue running into an issue where pasting multi-line text from the system clipboard (SpaceP) only inserts a single line.

I think I narrowed it down to my (ab)use of Spacey with multiple cursors to join and yank selections and then paste the combined text with SpaceP using a single cursor.

Reproduction Steps

Start with this file:

int main() {
    switch (1) {
        case 0: break;
        case 1: break;
        case 2: break;
        case 3: break;
    }
}
  • Select all lines with case:
    %scase Return X
  • Yank the joined selections:
    Spacey
  • Replace the file content with the system clipboard:
    % SpaceR

Expected result (this worked a while ago):

        case 0: break;

        case 1: break;

        case 2: break;

        case 3: break;

Actual result:

        case 0: break;

It almost seems like the clipboard's contents break somehow. If I paste the yanked text in another editor, I get the expected result and from there I can copy and (in helix) paste the text without issues.

I tried inspecting the bytes of the yanked text by saving the bad result as a file, but wasn't able to find anything.

Helix log

log (-vvv, nothing of interest)
2023-10-24T13:04:35.912 helix_tui::backend::crossterm [DEBUG] The keyboard enhancement protocol is not supported in this terminal (checked in 100ns)
2023-10-24T13:04:35.913 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-24T13:04:35.913 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-24T13:04:36.174 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-24T13:04:38.571 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-24T13:04:40.882 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-24T13:04:42.100 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-24T13:04:42.353 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-24T13:04:43.300 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2023-10-24T13:04:43.552 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-24T13:04:44.076 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-10-24T13:04:44.334 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-24T13:04:46.260 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-10-24T13:04:46.520 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-24T13:04:47.500 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-10-24T13:04:48.476 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-10-24T13:04:48.932 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-10-24T13:04:49.012 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-10-24T13:04:49.420 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-10-24T13:04:50.052 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-10-24T13:04:50.310 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-24T13:04:50.964 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-10-24T13:04:51.036 helix_view::editor [DEBUG] editor status: yanked 4 selections to register *
2023-10-24T13:04:51.036 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-10-24T13:04:51.295 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-24T13:04:52.380 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-10-24T13:04:52.640 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-24T13:04:53.036 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2023-10-24T13:04:53.296 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-24T13:04:53.388 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 2
2023-10-24T13:04:53.641 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-24T13:04:54.996 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 2
2023-10-24T13:04:55.250 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-24T13:04:56.036 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 2
2023-10-24T13:04:56.284 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 2
2023-10-24T13:04:56.299 helix_term::application [DEBUG] received editor event: IdleTimer
2023-10-24T13:04:56.340 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 2

Platform

Windows

Terminal Emulator

wezterm (nightly)

Helix Version

e6d2835

@CptPotato CptPotato added the C-bug Category: This is a bug label Oct 24, 2023
@pascalkuthe
Copy link
Member

this is expected behavior if you paste from helix to helix.

With #6985 helix now treats the clipboard the same as any other register with regards to multicursors.

Specifically y does not join selections anymore. So you would need to join selections first or use :yank-joined.

In the past running (for youx example) %s\d<ret><space>y<space>p would have pasted 1\n0\n1\n2\n3 at every cursor where now it will simply duplicate the number just as if you used y and p

@helix-editor helix-editor locked and limited conversation to collaborators Oct 24, 2023
@pascalkuthe pascalkuthe converted this issue into discussion #8601 Oct 24, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

2 participants