After staging, next unstaged change is janky
- Lenguaje dominante
- Rust
- Estrellas
- 22.5k
- Forks
- 774
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
The logic that chooses the next unstaged change after staging a change is kind of janky and breaks my flow. I'll call this a bug, call it what you want. I _believe_ the logic is basically nothing. It just tries to keep the vertical _visual_ position in the tree of unstaged changes. Since that is a _tree_ though, it feels weird. Everything is fine if you have a flat list of files, but I usually don't.
Here's the set up:
```
mkdir -p /tmp/treebug
cd /tmp/treebug
git init
echo hunk > f
mkdir g
echo hunk > g/g
echo hunk > g/h
echo hunk > i
echo hunk > j
```
Then enter `gitui`...
## Moving into directories
Ok, let's stage `f`.
Hm, I did not move to the next file. Instead, I moved to the directory g. So just pressing enter repeatedly will not stage file by file, but sometimes stage directories. I don't like this, but whatever. The big issue arises when I am staging from the diff view. This is my initial diff view:
Now, when I stage this hunk, my next screen is the following:
I am seeing the diff of nothing, and I can't do anything in this view. I am forced to return to the tree and navigate to the next file. So staging hunk-by-hunk by repeatedly pressing enter does not work either.
## Moving out of directories
Okay, `f` has been staged. We navigated to the next file manually:
Let's stage `g`:
Good, let's stage `h`:
We just skipped `i`. That is frustrating. Again, in the file tree view, I can correct this. In the diff view, I cannot.
## The fix
Not sure, one would have to experiment. Maybe this would already work:
- After staging a _file_, move to the next _file_.
- After staging a _directory_, keep the vertical position in the GUI.
Guía de contribución
Línea de trabajo
Reproduce el comportamiento en gitui usando la configuración /tmp/treebug y las vistas del árbol de archivos y de diferencias descritas anteriormente. Rastrea cómo se selecciona el siguiente cambio no preparado después de preparar un archivo, directorio o hunk. Se considera terminado cuando el staging repetido avanza al siguiente archivo y no muestra un diff vacío ni omite archivos.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- git, rust
- Área
- cli
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 42/100