<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; SciTE: интеллектуальная замена TAB'ов на пробелы в выделенном тексте]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=837&amp;type=atom" />
	<updated>2007-11-14T13:41:09Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=837</id>
		<entry>
			<title type="html"><![CDATA[SciTE: интеллектуальная замена TAB'ов на пробелы в выделенном тексте]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=6019#p6019" />
			<content type="html"><![CDATA[<p>Скрипт для <a href="http://forum.script-coding.com/viewtopic.php?id=680">SciTE</a>, на языке lua.<br />Заменяет TAB&#039;ы на пробелы в выделенном тесксте, с учетом размера табуляции, так, чтобы текст не &quot;разъезжался&quot; после такой замены.<br /></p><div class="codebox"><pre><code>local sel_text = editor:GetSelText()
if sel_text == &quot;&quot; then print(&quot;Выделите текст для обработки!&quot;) end
local sel_start = editor.SelectionStart
local sel_end = editor.SelectionEnd

local text_out = &quot;&quot;
for i = sel_start, sel_end-1 do
    local char = editor:textrange(i, i+1)
    if char == &quot;\t&quot; then
        local space_count = editor.Column[i+1] - editor.Column[i]
        text_out = text_out..string.rep(&quot; &quot;, space_count)
    else
        text_out = text_out..char
    end
end

editor:ReplaceSel(text_out)</code></pre></div><p>Пример подключения в файле .properties:<br /></p><div class="quotebox"><blockquote><p>command.name.135.*=Заменить TAB-ы на пробелы<br />command.135.*=dofile $(SciteDefaultHome)\tools\TabToSpace.lua<br />command.mode.135.*=subsystem:lua,savebefore:no</p></blockquote></div><p>Автор скрипта - <strong>mozers</strong>.</p>]]></content>
			<author>
				<name><![CDATA[The gray Cardinal]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=2</uri>
			</author>
			<updated>2007-11-14T13:41:09Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=6019#p6019</id>
		</entry>
</feed>
