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

Settings: Fix completion values #348

Merged
merged 1 commit into from
Feb 26, 2022

Conversation

ratijas
Copy link
Contributor

@ratijas ratijas commented Jun 11, 2021

The root cause was that text manipulation was reordered in a wrong way:
JSON-encoded string was converted to snippet-field-content-encoded
string first, but then it was treated as a simply JSON-encoded string
again. Namely, stripping curly brackets away after encoding them
as \} broke cursor things in a weird ways.

Used pretty printing just because it looks better. But it required extra
whitespace stripping: both outside and inside stripped
brackets/braces.

Also changed variable name from encoded to content in fmt, so they
can never be accidentally reordered again.

Fixes #347

The root cause was that text manipulation was reordered in a wrong way:
JSON-encoded string was converted to snippet-field-content-encoded
string first, but then it was treated as a simply JSON-encoded string
again. Namely, stripping curly brackets away _after_ encoding them
as \\} broke cursor things in a weird ways.

Used pretty printing just because it looks better. But it required extra
whitespace stripping: both outside and inside stripped
brackets/braces.

Also changed variable name from `encoded` to `content` in fmt, so they
can never be accidentally reordered again.

Fixes SublimeText#347
@FichteFoll FichteFoll added this to the 3.3.2 milestone Jun 22, 2021
@ratijas
Copy link
Contributor Author

ratijas commented Jul 19, 2021

ping @FichteFoll

@FichteFoll
Copy link
Member

Sorry for the delay. I took a very brief look but haven't found the time to finish up a release where this would then be included (I already added the milestone of the next version). I don't want to make promises, but I have some free time on Thursday where I hope to finally get to PD again.

@ratijas
Copy link
Contributor Author

ratijas commented Aug 12, 2021

take your time :)

@FichteFoll
Copy link
Member

FichteFoll commented Feb 26, 2022

Thanks, works really well and pretty-printing is a good idea, especially since we already insert the content in a new line.

(Sorry again for the delay.)

Edit: re-added commit message via bfa509b.

@FichteFoll FichteFoll changed the title Fix wrong content & cursor selection after inserting settings snippet Settings: Fix completion values Feb 26, 2022
@FichteFoll FichteFoll merged commit 8274c82 into SublimeText:master Feb 26, 2022
FichteFoll pushed a commit that referenced this pull request Feb 26, 2022
The root cause was that text manipulation was reordered in a wrong way:
JSON-encoded string was converted to snippet-field-content-encoded
string first, but then it was treated as a simply JSON-encoded string
again. Namely, stripping curly brackets away _after_ encoding them
as \\} broke cursor things in a weird ways.

Used pretty printing just because it looks better. But it required extra
whitespace stripping: both outside and inside stripped
brackets/braces.

Also changed variable name from `encoded` to `content` in fmt, so they
can never be accidentally reordered again.

Fixes #347
@ratijas ratijas deleted the fix-insert-settings branch March 11, 2022 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong text alignment & cursor when editing JSON object-valued preferences via phantom button
2 participants