TextDocument: auto-indentation issues
Symptoms:
- In an empty line writing only
spaceand thannew-line(with cursor after space), the space will be moved to next line. Thespacein next line seems like auto-indentation at work (and thus correct), but thespacein previous line should remain there. - In an empty line writing only
spaceand placing the cursor back to the start of the line and than pressingnew-line, there will be 2spaces in next line. By placing the cursor again at start of line and pressingnew-lineit will double again thespaces in next line. Again, the doubling ofspaces is auto-indentation working, but in this case I believe it to be wrong. Auto-indent should not trigger if cursor is placed at start of line.
This seems like an issue in auto-indentation implementation or it is getting confused in which order the space and new-line characters are. Maybe some array/vector that has reversed order?
It is difficult to explain the above with words (and I am not sure that I succeeded), so I made short video.
https://user-images.githubusercontent.com/33322918/123124189-c05cb600-d447-11eb-91fd-934de3e07e82.mp4
-
I cannot reproduce (2) currently, maybe it's fixed already?
-
(1) seems to be intentional, see https://github.com/SerenityOS/serenity/blob/c2e2b9d2ae4f5f20600e20f627199fa57365b5ca/Userland/Libraries/LibGUI/TextEditor.cpp#L1548-L1564
this could be a use case for that?
so the empty line doesn't have only spaces but you can keep writing the indented block?