-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Garbled contents when reloading file with DOS line endings #3303
Comments
Hi I noted this problem a while back (#2756), but could not make it reproducible. At that time I assumed it was due to my inferior OS! We should be careful not to confuse
Confusingly, settings.json includes an option named
I would be interested in a fix, so my spellchecking function (#2744) correctly reloads altered files. Kind Regards Gavin Holt |
FWIW I can easily reproduce it, with the newest micro from master.
It's clearly a bug, and hopefully easy to fix (just need to find free time to do that).
Yeah, they are doing completely different things.
Indeed, and it might be a good moment to document it.
Yep, it reloads plugins too.
The Yeah, it might be confusing that the |
Thanks for the pointer to
So the error seems to be that when |
Thank you for the great hint! micro/internal/util/unicode.go Line 90 in 35630aa
->
Most probably there is a more elegant and especially generic way, since this was just shot out of my hip. 😉 @scurest: |
echo -e 'Te\u0302st' > test.txt # COMBINING CIRCUMFLEX ACCENT
# Open in micro, shows 'Têst'
echo -e 'Test' > test.txt
# Reload in micro, still shows 'Têst' |
Hi,
Could Kind Regards Gavin Holt PS. I would also expect |
echo 'The bottle says DRINK ME' > test.txt
# Open in micro, 'The bottle says DRINK |ME' (| denotes cursor location)
echo 'The cake says EAT ME' > test.txt
# Reload in micro, 'The cake says EAT |ME' (cursor maintained at ME) Is this the only reason it's used? I would also be fine giving this up for correct Also the line-ending mode is not re-detected when |
No. The main purpose is to handle every insertion and/or deletion independent to track it inside the undo buffer. Furthermore the modifications can be visualized with the micro/internal/buffer/buffer.go Line 560 in e9bd1b3
So bypassing or removing Currently you broke it down to some minimal reproduction cases, which is good so far. |
Description of the problem
When reloading a DOS-mode file (CRLF line endings) that has changed on disk, the file contents are garbled.
Steps to reproduce
To help repro, here's a Python script that writes a random
test.txt
with DOS line endings.I run
python a.py 1
and then open the test file withmicro test.txt
.Then I run
python a.py 2
to change the file. Micro prompts me to reload:The file on disk has changed. Reload file? (y,n,esc)
. I hity
. I getNote that this is not a display issue, the actual contents are garbled. You can keep repeating this,
python a.py 3
and so on.Note that this does NOT happen if
a.py
is changed to write\n
line endings AND if micro initially opened the file in unix mode.Specifications
Commit hash: 68d88b5
OS: Arch Linux
Terminal: xterm 390-2
The text was updated successfully, but these errors were encountered: