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 close matching pair feature causes corruption with nested quotes (edge case) #2400

Closed
aral opened this issue May 4, 2022 · 3 comments
Closed
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug

Comments

@aral
Copy link
Contributor

aral commented May 4, 2022

Summary

When multiple cursors are active around a string with nested quotes and you change the quote characters, the auto-close matching pair feature results in corrupted code.

Reproduction Steps

const a = 'hello "there"'
  1. Select opening single quote /' return
  2. Extend selection v
  3. Select next single quote n
  4. Change the quotes c
  5. Enter backtick `

What should happen

The two single quotes should be replaced by backticks:

const a = `hello "there"`

What actually happens

The two quotes are replaced by backticks and an additional backtick is added to the end:

const a = `hello "there"``

Helix log

n/a

Platform

Linux

Terminal Emulator

GNOME Terminal

Helix Version

helix 22.05-dev (3a398ee)

@aral aral added the C-bug Category: This is a bug label May 4, 2022
@aral aral changed the title Auto close corruption with nested quotes (edge case) Auto close matching pair feature causes corruption with nested quotes (edge case) May 4, 2022
@the-mikedavis the-mikedavis added the A-helix-term Area: Helix term improvements label May 4, 2022
@archseer
Copy link
Member

archseer commented May 5, 2022

@dead10ck maybe? I think it falls under auto-pairs

@dead10ck
Copy link
Member

dead10ck commented May 5, 2022

Sorry to be this person, but... this doesn't seem like a bug to me? You have a case where there are two independent cursors in insert mode, so each are going to insert their own auto pairs. Neither are aware of the other. The first cursor does not auto pair in this case because it happens to precede an alpha character.

I think what you want here is mc'` or even just r`

@archseer
Copy link
Member

archseer commented May 5, 2022

Ah yep, r` is what I'd suggest

@dead10ck dead10ck closed this as not planned Won't fix, can't repro, duplicate, stale Mar 10, 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

No branches or pull requests

4 participants