David Pokorny wrote:
Thanks for the lively discussion :)
This is actually a somewhat common problem for me, and I understand
the value of asking that new users acclimate to a new interface, but
in this particular instance, I have to disagree:
First, the current behavior is a small (but important) violation of
the principle of least astonishment: in all other office applications,
typing a backspace either has a small effect or it deletes the current
selection. I have also never observed the behavior of "typing a
backspace selects something" in any other office application.
Backspace selecting something is perhaps a LyX specific
thing. This is so you can see what will be deleted if
you go on - that is not necessarily obvious inside
a math inset. Math is not structured as linearly as text.
Getting a selection this way takes away the deletion surprise,
because the user knows that backspace will delete a
selection.
Second, the canonical workaround (typing a left arrow key) is a burden
since it means the user has to move his/her right hand to the arrow
keys. This constitutes an interruption to the flow of typing if the
user finishes a formula, types a few words outside a formula, then
decides to rework the formula. Personally this is a very common
activity, but I would hazard a guess that any user who is, say, typing
up marginally legible class notes, would be in this position
moderately frequently. The issue is not the time saved (which is
trivial) but rather the necessary interruption of flow.
So the argument is that the following change to the behavior of the
backspace key is both easier to learn for new users and more useful
for all users:
* Both inside and outside math, typing a backspace when the cursor is
adjacent to the right hand side of an inset moves the cursor to the
last position of the left-adjacent inset; typing a backspace has an
effect identical to typing the left arrow key.
I don't like "backspace as left arrow". Backspace is
for deleting. And "any other word processor" will indeed
delete a large chunk of non-selected stuff, if the thing to the
left of the cursor happens to be a large image. Or perhaps a table.
So, backspace deleting an image in LyX is no surprise at all.
Having backspace delete other _clearly defined_ entities,
like boxes, minipages, footnotes etc. is also easy to
understand. These things all have a border, they are
clearly "big things" placed into the text.
Now formulas may not be so clearly differentiated from
text, especially simple inline ones like "x+ay=4z"
So I understand the surprise here, and there are many
ways of "fixing" the surprise. Some ideas:
1. Have backspace jump into the formula and just
delete the last character there. Downside - it is
now harder to delete an entire formula.
2a.Have backspace against a formula act the way backspace
works inside formulas. That is, select what will be deleted
first, then delete on the next press. This makes LyX
more self-consistent. Formula editing will work the same
even if the cursor comes in from outside.
Yes - this is different from what other word processors
do, but LyX is sort of famous for having a better math
editor than the others anyway.
b.One can then discuss if this "select before deleting"
policy should be extended to cover footnotes and such too.
c.Having to press backspace twice can be avoided in the case of
repeated backspacing. When backspacing _into_ the place
immediately after a formula (or behind anythin else where we
might want to use the selection trick), perform the selection
immediately. I.e. don't wait till the user hit backspace
again. We know this won't upset any existing selection,
the user just pressed backspace so any earlier selection
is gone already. This gives "one deletion per backspace"
as well as an indication of what will go next time. It could
even work in normal text, if one wants consistency all the way.
3. Put a border around any formula, so it will be clearer
that the formula is a deletable entity similiar to
a footnote, box or table. The downside is that
this breaks up reading a page with lots of inline
math. Not good, as LyX is supposed to be good
for math editing.
To the positive argument that users get used to the existing behavior
in practice, I would agree that it is possible for users to get used
to this behavior, but I would add the normative argument that users
should not have to adapt to accommodate a behavior that is (even
marginally) astonishing.
We don't want unnecessary surprises. But if a different
way of working is more efficient, then it is better.
To the argument that such behavior would be superfluous since it would
mean that there are two keys that perform the same action, consider
the identical behavior of the space key and the right arrow when the
cursor is in the last position of a math inset. Or the identical
behavior of the down arrow key and the tab key when in the cursor is
in the numerator of a fraction. I can only speak for myself: I find
the action of the tab and space keys to be very useful.
Good examples, several keys sometimes do the same because
there isn't really any other sane function for them under
the circumstances. I don't think backspace is in the same
category though - it can surely be set to delete
something when it is behind a math inset. The whole
inset or one character is of course debatable.
Helge Hafting