2. Also, I am wondering if I can use a reg-ex to ?fix? some files I was editing in Zeus and damaged in this way? If I could locate lines containing nothing but a CRLF, I could replace them with a <tab>CRLF. That would fix damaged files?
Zeus wiping out my tabs!
-
DrLechter
Zeus wiping out my tabs!
1. I was wondering if there is a way to stop Zeus from eliminating tab chars from my .sql files? Zeus eliminates tabs if the tab is the only thing on a line (other than CRLF). I had intentionally included a tab char on blank lines to stop a problem with the SQL query analyer. Namely, if a .sql file with the tabs removed is executed in the SQL query analyzer, it will ignore lines containing only a CRLF. This causes any created stored procedures to have all blank lines eliminated. Trying to read a piece of code that has had every blank line eliminated is not a fun thing!
2. Also, I am wondering if I can use a reg-ex to ?fix? some files I was editing in Zeus and damaged in this way? If I could locate lines containing nothing but a CRLF, I could replace them with a <tab>CRLF. That would fix damaged files?
2. Also, I am wondering if I can use a reg-ex to ?fix? some files I was editing in Zeus and damaged in this way? If I could locate lines containing nothing but a CRLF, I could replace them with a <tab>CRLF. That would fix damaged files?
1. I was wondering if there is a way to stop Zeus from eliminating tab chars from my .sql files?
Yes indeed there is
Unfortuantely there is no way to fix this using a search and replace, but the macro shown below will restore these missing tabs. Save the macro to the zScript\AddTab.lua file and then use the Macros, Execute Script menu and type in AddTab.lua to run the macro. It will restore the tabs to the currently active file.2. Also, I am wondering if I can use a reg-ex to ?fix? some files
I was editing in Zeus and damaged in this way?
Code: Select all
function key_macro()
-- macro only works for documents
local document = is_document()
if document == 0 then
message("This macro only works for document files!")
beep()
return
end
-- macro only works for read/write documents
local locked = is_read_only()
if locked == 1 then
message("The current document is marked as read only!")
beep()
return
end
-- disable screen updates
screen_update_disable()
-- save the current cursor
cursor_save()
-- total number of lines
local lines = get_line_count();
-- move to the fist line
set_line_pos(0)
for i = 1, lines, 1 do
-- get the line text
local line_text = get_line_text();
local length = string.len(line_text)
if length == 0 then
-- add the missing tab
print("\t")
MoveLineHome()
end
MoveLineDown()
end
-- restore original cursor
cursor_restore()
-- restore screen updates
screen_update_enable()
end
key_macro() -- run the macro