Что нового

scite - рекурсивное сворачивание блоков

ildary

Новичок
Сообщения
49
Репутация
0
Уважаемые специалисты, скажите пожалуйста, возможно ли научить scite для autoit научить сворачивать блоки рекурсивно? сейчас он свернет процедуру, но внутренние блоки в ней (циклы, условия, #region) - не сворачивает.
 

InnI

AutoIT Гуру
Сообщения
4,922
Репутация
1,432
ildary [?]
сворачивать блоки рекурсивно
SciTE Documentation
[box title=Folding]SciTE supports folding for many languages (see the list of languages understood by SciTE for more information.) Fold points are based upon indentation for Python and on counting braces for the other languages.

The fold point markers (in the fold margin) can be clicked to expand and contract folds. Normal clicking does not alter the fold state of child fold points; naturally the children are hidden when the parent fold is contracted, but when the parent is expanded again, each child is still folded or not, as before.

Ctrl+Click on a fold point toggles it and performs the same operation on all children.

Shift+Click on a fold point does not toggle that fold, it expands all the child folds.

Ctrl+Shift+Click in the fold margin expands or contracts all the top level folds. "Toggle all folds" in the View menu does the same; it toggles only top-level folds.

Tip: To open a large code block with all its children folded, fold it with Ctrl+Click, then open it with a normal click. Then on opening a child fold, you will see that the grandchild folds are still closed; if you want those 'grandchild' folds open, Shift+Click the child fold.
[/box]


Добавлено:
Сообщение автоматически объединено:

Русская версия
 
Автор
I

ildary

Новичок
Сообщения
49
Репутация
0
Спасибо за совет, но это не то: руками бегать по всем процедурам, сворачивая каждую - не вариант. Я нашел почти работающее решение:

Создаем файл .\AutoIt\SciTe\FoldSome.lua:

function FoldSome()
-- CONFIG
local FOLDSTART = 0 -- level to start folding (from 0)
local FOLDDEPTH = 5 -- fold depth; comment out if no limit
-- SCRIPT
FOLDSTART = FOLDSTART + 1024 -- internal counting from 1024
local FOLDEND = FOLDSTART + (FOLDDEPTH or 9999)
if FOLDEND <= FOLDSTART or FOLDEND > 4096 then
FOLDEND = 4096 end
local start, ending, hide
editor:Colourise(0, -1) -- update doc's folding info
for ln = 0, editor.LineCount - 1 do
local foldRaw = editor.FoldLevel[ln]
local foldLvl = math.mod(foldRaw, 4096)
local foldHdr = math.mod(math.floor(foldRaw / 8192), 2) == 1
--~ if ln < 28 then
--~ print(ln+1, "FL", foldRaw, foldLvl, foldHdr) end
-- fold if within limits and is a fold header
if foldHdr and foldLvl >= FOLDSTART and foldLvl < FOLDEND then
local expanded = editor.FoldExpanded[ln]
if foldLvl == FOLDSTART and not start then
-- start fold block
-- fix a hide/show setting for whole doc, for consistency
if hide == nil then hide = expanded end
start = ln + 1 -- remember range
ending = editor:GetLastChild(ln, foldLvl)
end
editor.FoldExpanded[ln] = not hide
end
-- if end of block, perform hide or show operation
if start and ln == ending then
if hide then
editor:HideLines(start, ending)
else
editor:ShowLines(start, ending)
end
start, ending = nil, nil
end
end --for
end

FoldSome()

********** Конец ***************

находим файл .\AutoIt\SciTe\properties\au3.properties и перед строкой

# Commands to for Help F1


вставляем текст:

command.name.35.*=FoldSome
command.subsystem.35.*=3
command.35.*=FoldSome
command.35.*=dofile $(SciteDefaultHome)/Lua/FoldAll.lua
command.mode.35.*=savebefore:no
command.shortcut.35.*=Ctrl+B

только почему-то хоткей Ctrl+B не работает...





Добавлено:
Сообщение автоматически объединено:

Вдогонку - не нашел, кто не дает использовать хоткей Ctrl+B и забрал неиспользуемый Ctrl+1 у SciTe Config (в том же файле .\AutoIt\SciTe\properties\au3.properties)
 
Автор
I

ildary

Новичок
Сообщения
49
Репутация
0
Спасибо за подсказку, но мне странно - почему автор полного сворачивания взял уже использованный хоткей?
 
Верх