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 makes it difficult to insert an item at the beginning of a list of quoted strings #12406

Open
zakj opened this issue Jan 4, 2025 · 0 comments
Labels
C-bug Category: This is a bug

Comments

@zakj
Copy link

zakj commented Jan 4, 2025

Summary

auto-pairs seems not to understand existing matching pairs, which makes it awkward to prepend an item to a list of quoted items. The first " entered is consumed instead of emitted, which means to add "a" to the beginning of ["b", "c"] you end up typing " three times ("a", "). See the example below.

Reproduction Steps

Can be reproduced with default configs.

This is what I would have expected (cursor is |):

[|"b", "c"]
type: "
["|"b", "c"]
type: a",·
["a", |"b", "c"]

This is what happens instead:

[|"b", "c"]
type: "
["|b", "c"]
type: a",·
["a", |b", "c"]

Helix log

2025-01-04T11:08:40.767 helix_core::auto_pairs [DEBUG] auto pair transaction: Transaction {
    changes: ChangeSet {
        changes: [
            Retain(
                11,
            ),
        ],
        len: 11,
        len_after: 11,
    },
    selection: Some(
        Selection {
            ranges: [
                Range {
                    anchor: 0,
                    head: 3,
                    old_visual_position: None,
                },
            ],
            primary_index: 0,
        },
    ),
}
[...]
2025-01-04T11:08:43.258 helix_core::auto_pairs [DEBUG] auto pair transaction: Transaction {
    changes: ChangeSet {
        changes: [
            Retain(
                3,
            ),
            Insert(
                "\"",
            ),
            Retain(
                9,
            ),
        ],
        len: 12,
        len_after: 13,
    },
    selection: Some(
        Selection {
            ranges: [
                Range {
                    anchor: 0,
                    head: 5,
                    old_visual_position: None,
                },
            ],
            primary_index: 0,
        },
    ),
}

Platform

macOS

Terminal Emulator

ghostty 1.0.1

Installation Method

brew

Helix Version

helix 25.1 (dabfb6c)

@zakj zakj added the C-bug Category: This is a bug label Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

1 participant