Skip to content

Multiple quotation mark replacement fails #5146

Description

@aral

Summary

Replacing multiple quotation marks results in inconsistent behaviour.

Reproduction Steps

To reproduce

  1. Add the following code to a JavaScript page:
export default _ => html`
  <script defer src='https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js'></script>
  <h1 x-data="{ message: 'I ❤️ Alpine'}" x-text='message'></h1>
  <div x-data="{ count: 0 }">
    <button x-on:click="count++" style=>Increment</button>
    <span x-text="count"></span>
  </div>
`
  1. Select all and then select all double quote marks. % s"

    image

  2. Press c and type a single quote(')

What should happen

All double quotes should be replaced with one single quote.

What actually happens

Some double quotes are replaced with one single quote, others are replaced with two.

image

This is also inconsistent with r which does the right thing.

Helix log

n/a

Platform

Linux (Fedora Silverblue 37)

Terminal Emulator

Black Box

Helix Version

helix 22.12 (0f2ae35)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions