Skip to content

Commit

Permalink
fix: fixed #2116
Browse files Browse the repository at this point in the history
  • Loading branch information
arnog committed Aug 29, 2023
1 parent 0822c75 commit b2f2585
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- A closing parenthesis following a function application would be ignored,
i.e. `(f(x))` would be parsed as `(f(x)`.
- **#2116** Pressing the "/" key after an expression ending with a superscript would
not recognize the left argument as a numerator.

### Improvements

Expand Down
4 changes: 2 additions & 2 deletions src/editor-model/commands-move.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function moveToSuperscript(model: ModelPrivate): boolean {

if (target.subsupPlacement === undefined) {
// This atom can't have a superscript/subscript:
// add an adjacent `msubsup` atom instead.
// add an adjacent `subsup` atom instead.
if (target.rightSibling?.type !== 'subsup') {
target.parent!.addChildAfter(
new SubsupAtom({ style: target.computedStyle }),
Expand Down Expand Up @@ -112,7 +112,7 @@ function moveToSubscript(model: ModelPrivate): boolean {

if (target.subsupPlacement === undefined) {
// This atom can't have a superscript/subscript:
// add an adjacent `msubsup` atom instead.
// add an adjacent `subsup` atom instead.
if (model.at(model.position + 1)?.type !== 'subsup') {
target.parent!.addChildAfter(
new SubsupAtom({ style: model.at(model.position).computedStyle }),
Expand Down
2 changes: 1 addition & 1 deletion src/editor-model/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ function onDelete(
if (branch && atom.hasEmptyBranch(branch)) atom.removeBranch(branch);

if (!atom.hasChildren) {
// We've removed the last branch of a msubsup
// We've removed the last branch of a subsup
const pos =
direction === 'forward'
? model.offsetOf(atom)
Expand Down
2 changes: 1 addition & 1 deletion src/editor/shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function validateShortcut(
// Find first sibling left which is not a placeholder or subsup
let sibling = siblings[0]; // sibling immediately left
let index = 0;
while (sibling?.type && /msubsup|placeholder/.test(sibling.type)) {
while (sibling?.type && /^(subsup|placeholder)$/.test(sibling.type)) {
index += 1;
sibling = siblings[index];
}
Expand Down

0 comments on commit b2f2585

Please sign in to comment.