Skip to content
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

Auto pairs incorrectly shifts selections with crlf line endings #8043

Open
CptPotato opened this issue Aug 23, 2023 · 4 comments · May be fixed by #7269
Open

Auto pairs incorrectly shifts selections with crlf line endings #8043

CptPotato opened this issue Aug 23, 2023 · 4 comments · May be fixed by #7269
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug

Comments

@CptPotato
Copy link
Contributor

CptPotato commented Aug 23, 2023

Summary

When using multiple selections and crlf line endings, auto pairs can cause selections to shift when inserting on the newline character.

Reproduction Steps

Open a new file with this content:

fn aaa
fn bbb
fn ccc
fn ddd
  • Set the line endings :line-ending crlf
  • Create one cursor on each line %<Alt+s>
  • Then append to all line ends A (not a)
  • Type (

The result is this (each auto pair causes the following selections' anchor to shift):

image

All selections should remain 1 character wide instead.

Helix log

log
2023-08-23T10:20:55.527 helix_core::auto_pairs [DEBUG] auto pair transaction: Transaction {
    changes: ChangeSet {
        changes: [
            Retain(
                6,
            ),
            Insert(
                "()",
            ),
            Retain(
                8,
            ),
            Insert(
                "()",
            ),
            Retain(
                8,
            ),
            Insert(
                "()",
            ),
            Retain(
                8,
            ),
            Insert(
                "()",
            ),
            Retain(
                2,
            ),
        ],
        len: 32,
        len_after: 40,
    },
    selection: Some(
        Selection {
            ranges: [
                Range {
                    anchor: 7,
                    head: 8,
                    old_visual_position: None,
                },
                Range {
                    anchor: 15,
                    head: 18,
                    old_visual_position: None,
                },
                Range {
                    anchor: 23,
                    head: 28,
                    old_visual_position: None,
                },
                Range {
                    anchor: 31,
                    head: 38,
                    old_visual_position: None,
                },
            ],
            primary_index: 0,
        },
    ),
}

Platform

Windows

Terminal Emulator

wezterm (20230712-072601)

Helix Version

master at 929eb0c

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

cc @dead10ck

@dead10ck
Copy link
Member

I'm unable to reproduce the issue with these steps. @pascalkuthe would you be able to give it a shot just so we can rule out that I'm doing something wrong?

@dead10ck
Copy link
Member

dead10ck commented Aug 23, 2023

Oh actually I was using my personal branch. I am able to reproduce from the latest master. This makes me suspect that it's already fixed by #7269

Edit: yep, confirmed, this is fixed by #7269

@CptPotato
Copy link
Contributor Author

Oh actually I was using my personal branch. I am able to reproduce from the latest master. This makes me suspect that it's already fixed by #7269

Ah nice, I can check later if this fixes the auto-pair issues.

@the-mikedavis the-mikedavis linked a pull request Aug 23, 2023 that will close this issue
@kirawi kirawi added the A-helix-term Area: Helix term improvements label Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants