Scite 清理空白行

lua-users home
wiki

以上的函式基於 SciteCleanDocWhitespace 函式。盡情享用!
function stripWhiteLines(reportNoMatch)
    local count = 0
    local fs,fe = editor:findtext("^$", SCFIND_REGEXP)
    if fe then
        repeat
            count = count + 1
            editor:remove(fs,fe)
            fs,fe = editor:findtext("^$", SCFIND_REGEXP, fs)
        until not fe
        print("Removed " .. count .. " line(s).")
    elseif reportNoMatch then
        print("Document was clean already; nothing to do.")
    end
    return count
end

WalterCruz


最新變更 · 偏好設定
編輯 · 歷程
最後編輯時間 2006 年 8 月 31 日下午 7:46 GMT (差異)