Bug Report
Disable all the other extensions except for LaTeX Workshop and LaTeX Utilities, and check that you still see this issue.
You still see this issue?: Yes
Describe the bug
When using snippets to automatically add spaces around operators (like =) in my document, the cursor position incorrectly jumps when I'm inside inline math environments \(...\). Specifically, after typing an operator like =, the cursor jumps backward to a position right after the opening \ character, resulting in corrupted LaTeX formulas.
To Reproduce
Steps to reproduce the behavior:
- Create a LaTeX document with the following snippets in your settings:
{
"prefix": "([^ &\\\\\\+\\-=<>\\|!~@])([\\+\\-=<>])$",
"body": "$1 $2",
"mode": "maths",
"priority": -1,
"triggerWhenComplete": true
},
{
"prefix": "([\\+\\-=<>])([^ &\\\\\\+\\-=<>\\|!~])$",
"body": "$1 $2",
"mode": "maths",
"priority": -1,
"triggerWhenComplete": true
}
- Start typing an inline math formula:
\(y=x\)
- After typing the
= character, observe the cursor position
Expected behaviour
Expected: The cursor should remain at the correct position after the = sign, and the snippet should add a space after the = sign, resulting in \(y=\x).
Actual behavior
Actual: The cursor incorrectly jumps to a position after the opening \ character, and the snippet adds the space in the wrong location, resulting in something like \(y =\x) when continuing to type.
By the way, the set {} turns out to be the same condition.
Bug Report
Disable all the other extensions except for LaTeX Workshop and LaTeX Utilities, and check that you still see this issue.
You still see this issue?: Yes
Describe the bug
When using snippets to automatically add spaces around operators (like
=) in my document, the cursor position incorrectly jumps when I'm inside inline math environments\(...\). Specifically, after typing an operator like=, the cursor jumps backward to a position right after the opening\character, resulting in corrupted LaTeX formulas.To Reproduce
Steps to reproduce the behavior:
{ "prefix": "([^ &\\\\\\+\\-=<>\\|!~@])([\\+\\-=<>])$", "body": "$1 $2", "mode": "maths", "priority": -1, "triggerWhenComplete": true }, { "prefix": "([\\+\\-=<>])([^ &\\\\\\+\\-=<>\\|!~])$", "body": "$1 $2", "mode": "maths", "priority": -1, "triggerWhenComplete": true }\(y=x\)=character, observe the cursor positionExpected behaviour
Expected: The cursor should remain at the correct position after the
=sign, and the snippet should add a space after the=sign, resulting in\(y=\x).Actual behavior
Actual: The cursor incorrectly jumps to a position after the opening
\character, and the snippet adds the space in the wrong location, resulting in something like\(y =\x)when continuing to type.By the way, the set {} turns out to be the same condition.