jmacdonald / scribe

Text editor components
MIT License
173 stars 7 forks source link

about CR and LF #22

Open fitso-2120 opened 1 year ago

fitso-2120 commented 1 year ago

Sorry for the machine translation.

environment:

result: Line breaks were not recognized correctly.

investigation: The line feed code in Windows is "0x0d0x0a" On Mac/Linux, the line feed code is "0x0a"

The 'read_to_string()' used inside 'from_file()' reads the newline code as it is.

'line_count()' counts correctly because it counts '\n'. 'move_toXXX' recognizes it as a one-line string.

I tried changing "\n" in 'move_to_last_line()' but it didn't work.

first aid: It is supported by reading line by line and adding a line feed code.

Is it possible to read 'from_file()' and recognize it correctly even if the line feed code is different?

fitso-2120 commented 1 year ago

The source 'amp' does not support Windows. So I take it off.