Page 1 of 1
Adaptable EOL?
Posted: Sun May 14, 2006 7:18 pm
by nedbatchelder
I'd like Zeus to adapt the line endings to whatever is already in the file. Is this possible?
So if I opened a file with 0x0a line endings, and I entered some more lines, they'd end with 0x0a. If I opened a file with 0x0d0x0a line endings, and entered more lines, they'd end with Windows-style line endings.
Thanks.
Posted: Sun May 14, 2006 11:15 pm
by jussij
Hi Ned,
I'd like Zeus to adapt the line endings to whatever is already in the file. Is this possible?
I was sure Zeus already had this feature, but after some testing I found it was no longer working
I take a look at why it is no longer working.
Cheers Jussi
Is scripting this a possibility?
Posted: Fri May 26, 2006 12:45 pm
by nedbatchelder
This issue is really starting to bother me. Is there a script I could use to set the line ending based on what is found in the file?
Posted: Thu Jun 01, 2006 11:51 pm
by jussij
Is there a script I could use to set the line ending based on what is found in the file?
It is possible to control the state of the UNIX write option via a script. Below is some Lua code that shows how this is done:
Code: Select all
function key_macro()
original = get_editor_option("UnixWrite")
message_box(1, "UnixWrite " .. original)
set_editor_option("UnixWrite", 1)
value = get_editor_option("UnixWrite")
message_box(1, "UnixWrite " .. value)
value = set_editor_option("UnixWrite ", original)
value = get_editor_option("UnixWrite")
message_box(1, "UnixWrite " .. value)
end
key_macro() -- run the macro
Cheers Jussi