Skip to content

[Bug+Enhancement] Escaped quotes should be treated as separate entities #50

@sergxerj

Description

@sergxerj

I have the following scenarios while executing >Text Toolbox: Select text between quotes:

Test string (a JSON request body): "[{\"prop1\":0,\"prop2\":\"value2\"]" (zero-indexed references)

Scenario 1:
Expected behavior: at position 1 should select 1:35 ([{\"prop1\":0,\"prop2\":\"value2\"])
Actual behavior: at position 1 selects 1:4 ([{\),

Scenario 2:
Expected behavior: at position 5 should select 5:10 (prop1)
Actual behavior: at position 5 selects 5:11 (prop1\),

These escaped quotes consisting primarily of the \" characters should be treated as a single entity, and balanced as such in order to get the actual balancing one and not just the next one, which should extend for the purposes of >Text Toolbox: Cycle quotes for cycling the escaped quotes.

Preliminar suggestion for addressing:

  1. Adding an escaped boolean state property to the list of delimiters, if necessary with
  2. An escapeSequence string for properly identifying and handling escape sequences, perhaps with
  3. A quote/bracket position marker instead of a literal quote/bracket in [2] for the cycling functionality behaving dynamically. If possible, to
  4. Store [2] in a per-(programming-)language list of escaping sequences (to handle different patterns according to the active editor's language, for instance, csv's """ triple quote escaping), plus a generic one as fallback.

Possible extra enhancement as a bonus:
Adding a (couple) new command(s) >Text Toolbox: Cycle escape ([quotes, brackets])

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions