Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions CSharpMath.Editor/Keyboards/MathKeyboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,18 @@ void MoveCursorLeft() {
}
if (_insertionIndex is null)
throw new InvalidOperationException($"{nameof(_insertionIndex)} is null.");
if (MathList.AtomAt(_insertionIndex) is null &&
MathList.AtomAt(_insertionIndex?.Previous)?.AtomType is MathAtomType.Placeholder)
if (_insertionIndex.FinalSubIndexType is MathListSubIndexType.BetweenBaseAndScripts) {
var prevInd = _insertionIndex.LevelDown();
if (MathList.AtomAt(prevInd).AtomType is MathAtomType.Placeholder)
_insertionIndex = prevInd;
} else if (MathList.AtomAt(_insertionIndex) is null && MathList.AtomAt(_insertionIndex?.Previous)?.AtomType is MathAtomType.Placeholder)
_insertionIndex = _insertionIndex.Previous; // Skip right side of placeholders when end of line
}
void MoveCursorRight() {
if (_insertionIndex is null)
throw new InvalidOperationException($"{nameof(_insertionIndex)} is null.");
switch (MathList.AtomAt(_insertionIndex)) {
var currentAtom = MathList.AtomAt(_insertionIndex);
switch (currentAtom) {
case null: //After Count
var levelDown = _insertionIndex.LevelDown();
switch (_insertionIndex.FinalSubIndexType) {
Expand Down Expand Up @@ -300,6 +304,8 @@ void MoveCursorRight() {
}
if (_insertionIndex is null)
throw new InvalidOperationException($"{nameof(_insertionIndex)} is null.");
if (_insertionIndex.FinalSubIndexType is MathListSubIndexType.BetweenBaseAndScripts && currentAtom?.AtomType is MathAtomType.Placeholder)
MoveCursorRight();
}

void DeleteBackwards() {
Expand Down