Closed NSoiffer closed 6 years ago
There are different concepts of "placeholder". The first one is an argument placeholder, which can be indicated in a formula using "#0", "#1". This indicates that the placeholder should be substituted by a value provided programatically. In many cases, "#0" will refer to whatever is currently selected, so some shortcuts, such as alt-[, are defined to replace the selection with a sequence that contains the selection (represented by #0). The issue here is that if there is no selection, the "#0" placeholder was left empty. The fix is in that case to use a default value for the placeholder when no argument list/selection is available.
The second concept of "placeholder" is a value that has not been specified yet. For example, the expression "\frac{}{}" has two placeholders for the missing numerator and denominator of the fraction.
Although in both cases this can result in a "placeholder" value being displayed in the formula, they are different mechanisms and should not be conflated. Hence, there is a difference between a "#" token (which represent an argument to be substituted later) and a "placeholder" token which represent a missing child.
Description
Here is the documentation that describes how
#0
should work:In practice, doing an insert with
#0
does nothing with a few exceptions (fractions, square roots, ???).Steps to Reproduce
Inline shortcuts are an easy way to see the problem.
alt-[
What is inserted is \left[\right] -- no placeholder. If you type
ctrl-2
, you get a square root with aradicand
placeholder.Both shortcuts use
#0
(see editor-shortcuts.js).The bug appears to be in
Parser.prototype.scanImplicitGroup