AppFlowy-IO / AppFlowy-IO/appflowy-editor

[Bug] Cursor movement in nested (todo) blocks has various issues

Aperta
#1,085 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Dart
Stelle
684
Fork
329
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Bug Description

Sorry if this is a plain duplicate; I did try to find related issues, but most seem closed or just related. Here's the ones I found:

* https://github.com/AppFlowy-IO/AppFlowy/issues/4478
* https://github.com/AppFlowy-IO/AppFlowy/issues/4923
* https://github.com/AppFlowy-IO/appflowy-editor/issues/745
* https://github.com/AppFlowy-IO/appflowy-editor/issues/53

### How to Reproduce

I use this simple example snippet to try out navigation:

```markdown
- [ ] `1` OK: ➡️ & ⬇️ go to `2` as expected
- [ ] `2` ERROR: ⬅️ & ⬆️ go to `1`, ⬇️ goes to `3`, but ➡️ at the end of the line goes to `5`.
- [ ] `3` OK: ⬅️ & ⬆️ go to `2`, ➡️ & ⬇️ go to `4`
- [ ] `4` ERROR: ⬅️ & ⬆️ go to `2`, ⬇️ goes to `5`, but ➡️ doesn't work
- [ ] `5` ERROR: ⬅️ goes to `4`, but ⬆️ behaves differently depending on cursor position and line content
_Sometimes_ it jumps to `2` but it's not quite clear when.
```

Visually, that's this:

![Image](https://github.com/user-attachments/assets/51a54b95-d7df-475e-8d51-4a4c4836fc00)

Try navigating between adjacent (next/previous) lines with all four arrow keys, while the cursor is at the beginning of a line, in the middle, or at the end.

Especially the last line is confusing to me. It *sometimes* works as expected, but not always. I haven't figured out how to reliably reproduce this, but it seems to be related to the line content?!

### Expected Behavior

Essentially, navigation should be...

* Unsurprising
Pressing ⬅️ at the beginning of a line should take me to the preceding (visual) line.
Pressing ➡️ at the end of a line should take me to the next (visual) line
Pressing ⬆️ or ⬇️ while the cursor is anywhere on the line (incl start and end) should do the same.
* Symmetric
Pressing ⬅️➡️ in sequence should always put my cursor back where it started.
Pressing ⬆️⬇️ in sequence should always put my cursor back on the same (visual) line. I'd be willing to have it end up in a different *position* on that line though, if e.g. I navigate from a very long line to a short one and back.

When I say "visual line" I mean that it should take soft linebreaks into account.

### Operating System

Linux (debian unstable)

### AppFlowy Editor Version(s)

AppFlowy desktop 0.8.7, so... not entirely sure how that translates to an editor version. 🙂

### Screenshots

_No response_

### Additional Context

_No response_

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.