Code: Select all
local cyclic = true -- поменять на false чтобы выключить циклический перебор
local function JumpToSelected(dir)
for pos = APanel.CurPos+dir,(dir>0 and APanel.ItemCount or 1),dir do
if Panel.Item(0,pos,8) then Panel.SetPosIdx(0,pos) return end
end
if cyclic then Panel.SetPosIdx(0,(dir>0 and 1 or APanel.SelCount),1) end
end
-- Переместиться к следующему выделенному
Macro { description="Jump to the next selected file";
area="Shell Search"; key="CtrlShiftDown"; flags="Selection";
action=function() JumpToSelected(1) end;
}
-- Переместиться к предыдущему выделенному
Macro { description="Jump to the previous selected file";
area="Shell Search"; key="CtrlShiftUp"; flags="Selection";
action=function() JumpToSelected(-1) end;
}
-- Переместиться к последнему выделенному
Macro { description="Jump to the last selected file";
area="Shell Search"; key="CtrlShiftEnd CtrlShiftNum1"; flags="Selection";
action=function() Panel.SetPosIdx(0,APanel.SelCount,1) end;
}
-- Переместиться к первому выделенному
Macro { description="Jump to the first selected file";
area="Shell Search"; key="CtrlShiftHome CtrlShiftNum7"; flags="Selection";
action=function() Panel.SetPosIdx(0,1,1) end;
}
автор Smitis:
http://forum.farmanager.com/viewtopic.p ... 76#p106376
Или вот
Code: Select all
local cyclic = true -- set false to disable cyclic jump
local is_selected = 8
local function JumpToSelected (from, to)
for pos=from,to,from<to and 1 or -1 do
if Panel.Item(0,pos,is_selected) then return Panel.SetPosIdx(0,pos) end
end
if cyclic then JumpToSelected(APanel.ItemCount-to,to) end
end
Macro {description="Jump to the next selected file";
area="Shell Search"; key="CtrlShiftDown"; flags="Selection";
action = function() JumpToSelected(APanel.CurPos+1,APanel.ItemCount) end;
}
Macro {description="Jump to the previous selected file";
area="Shell Search"; key="CtrlShiftUp"; flags="Selection";
action = function() JumpToSelected(APanel.CurPos-1,1) end;
}
Macro {description="Jump to the first selected file";
area="Shell Search"; key="CtrlShiftHome CtrlShiftNum7"; flags="Selection";
action = function() JumpToSelected(1,APanel.ItemCount) end;
}
Macro {description="Jump to the last selected file";
area="Shell Search"; key="CtrlShiftEnd CtrlShiftNum1"; flags="Selection";
action = function() JumpToSelected(APanel.ItemCount,1) end;
}
(с) народ