Arrays, Enter and Intuition
See original GitHub issueDescribe the bug I can’t call it a bug, but I did test it on a few people, and I believe the current behaviour is too complicated and unintuitive for most users. Basically, when a user hits enter, they are marking the “end” of an input.
Perhaps instead of using the <enter> key to make new rows in an array, we should just go with the latex shortcuts that most people editing matrices will be familiar with (&
) and (\\
). Alternatively, the matlab shortcuts also seem like a good fit (,
for new column and ;
for new row).
I noticed a few confused faces on some of the examples below:
To Reproduce
In a mathlive document, type s i n ( 3 <enter>
This will create an array inside of sin
Expected behavior Pressing enter at that location should have removed focus from the editor. I propose that:
Enter should always commit the current document whether or not the input is valid
Environment Any (but I’m on a mac)
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
Added
onCommit
listener tomf.options
. This listener is invoked when the user presses Enter or Return key, or when the field loses focus and its value has changed since it acquired it.In addition, a
change
event is triggered when using aMathfieldElement
.The event previously named
change
has been renamed toinput
.This mimics the behavior of
<input>
and<textarea>
elements.Changed the keyboard shortcuts to add columns and rows:
addRowAfter
addRowBefore
addRowAfter
addRowBefore
addColumnAfter
addColumnBefore
Note that Enter/Return no longer create a matrix/vector when inside a parenthesized expression. Use ctrl/cmd + Return/Enter instead.
Added a
commit
command to programmatically trigger theonCommit
listenerchange
event.I think the comma and semicolon are pretty common. That would be my suggestion :p