Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caret #13

Open
stefnotch opened this issue Oct 31, 2022 · 10 comments
Open

Caret #13

stefnotch opened this issue Oct 31, 2022 · 10 comments
Labels

Comments

@stefnotch
Copy link
Owner

stefnotch commented Oct 31, 2022

When one has a row of text, then the caret can be placed inbetween the individual characters.

The same logic applies here. A caret is

  • a zipper that points at a row
  • an offset, that tells you where in the row the caret is (based on myZipper.value.values.length or myTextZipper.value.value.length)
@stefnotch
Copy link
Owner Author

stefnotch commented Nov 1, 2022

Test cases

  1. Try out $\displaystyle \frac{a}{b^{c \color{blue}|\color{black} }}$ where $\color{blue}|$ is the caret and then press up
  2. $\displaystyle \frac{2+\sqrt{3_{2\color{blue}|\color{black}}+4}}{0\color{blue}|\color{black}+1\color{blue}|\color{black}+\color{blue}|\color{black}2}$ and place the caret in any of the locations and press up/down

@stefnotch
Copy link
Owner Author

Try using ts-pattern in the math-layout-caret code

@stefnotch
Copy link
Owner Author

Regarding the caret size w3c/mathml-core#38

@stefnotch
Copy link
Owner Author

firefox_2022-11-01-0269.webm

@stefnotch
Copy link
Owner Author

stefnotch commented Nov 2, 2022

image

A fun case regarding up-down movement. The caret is the thick blue line. When pressing up, where should the caret go?

The 3 options:

  1. Before the fraction, because you're moving up into the top part of the fraction. You don't care about nested stuff.
  2. After the x^2, because that's the physically closest valid location.
  3. Before the y, because you're only moving up a tiny bit.

(For the record: Mathlive does option 1, Mathquill does 2, MathType and MathCha do 3, Guppy does 4, and MathCad doesn't even let you do that)

There's also the alternative option 4:
image

@stefnotch
Copy link
Owner Author

More such cases
image
image

@stefnotch
Copy link
Owner Author

stefnotch commented Nov 2, 2022

A sample size of 4 users apparently prefers something like option 4. The absolutely simplest possible thing.

@stefnotch
Copy link
Owner Author

Another case: Imagine having typed exactly this and then immediately pressing up

image

@stefnotch
Copy link
Owner Author

Maybe there are papers that go into how a cursor should behave?

@stefnotch
Copy link
Owner Author

When clicking on the screen and then computing the closest caret point, remember that carets are lines. So point-line distance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant