Closed Brenzle closed 1 month ago
This feature will be very useful if implemented.
I've come up with some rough ideas for the implementation, so I'd like to share them.
Let's use the formula $1 \leq 2$
as an example, where the part \leq
needs to be properly concealed. We define three types of positions seen from this part.
$1 \|leq 2$
)$1 |\leq 2$
)$1| \leq 2$
)We determine whether to conceal \leq
based on which type the current cursor position falls into. If the type is A, \leq
is not concealed now, and we still don't want to conceal it. If the type is C, we can always conceal \leq
.
Things become a bit more complicated when the type is B. In this case, we use information about whether or not \leq
is concealed now. If it is not concealed, we still don't conceal it. If it is concealed, we keep it concealed. Also, we notify a certain manager to stop concealing it with a time delay.
A simple bulleted summary is as follows:
\leq
is concealed now → Conceal and notify the manager\leq
is not concealed now → Do not concealHere is an explanation regarding the manager. Generally, the manager should uncover the provided parts of formulas with a time delay. However, the manager should cancel all the actions if the cursor has moved before the delay.
This feature will be very useful if implemented.
I've come up with some rough ideas for the implementation, so I'd like to share them.
Let's use the formula
$1 \leq 2$
as an example, where the part\leq
needs to be properly concealed. We define three types of positions seen from this part.
- Type A: entirely within the part (e.g.,
$1 \|leq 2$
)- Type B: just at the edge of the part (e.g.
$1 |\leq 2$
)- Type C: apart from the part (e.g.,
$1| \leq 2$
)We determine whether to conceal
\leq
based on which type the current cursor position falls into. If the type is A,\leq
is not concealed now, and we still don't want to conceal it. If the type is C, we can always conceal\leq
.
Sure, that sounds reasonable.
However, I don't believe this alone will resolve the problem of not knowing exactly how many characters left/right you need to move to get to another position. We probably need to use atomicRanges, so that pressing → when you are in the position $1 |≤ 2$
takes you directly to $1 ≤| 2$
.
@shunby and I are currently working on implementing this feature. We plan to submit a PR in a few weeks!
Description of the Problem
When moving the text cursor left or right through an equation with conceal mode turned on, it's impossible to know how many clicks you need to select exactly what you want or to position the cursor where you want. If I see I'm three characters from the place I want to get to, if it's concealed math then I'm further away. Real LaTeX syntax will be revealed every time I get to a new symbol and be hidden once I pass it, which is very annoying.
Description of the Solution
A time delay, where in the first
x
seconds a symbol of concealed math that I'm next to won't be replaced with real underlying LaTeX.1s seems good to start with, but a configurable option would be the best.
That way it is possible to edit equations faster, more predictable, and easier - not requiring the user to think about syntax when editing and letting him focus on math.
Additional information
When a section of text is selected, the symbols should convert to LaTeX syntax after the time delay, and should keep the accurate selection over themselves, if possible.
If the text cursor is positioned between two "concealed math" symbols and the user starts typing, the symbols won't convert to real syntax until the cursor has been idle for longer than
x
.Open for suggestions
If anyone who reads this finds that it would make more sense to add/modify a part of the idea, please comment so we can discuss it and find the best solution. :)