forked from dail8859/LuaScript
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelectionAddNext.lua
More file actions
Latest commit
26 lines (25 loc) · 1.13 KB
/
Copy pathSelectionAddNext.lua
File metadata and controls
26 lines (25 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
-- Select the next occurrence of the current word
npp.AddShortcut("Selection Add Next", "Ctrl+D", function()
-- From SciTEBase.cxx
localflags=SCFIND_MATCHCASE-- can use 0
editor:SetTargetRange(0, editor.TextLength)
editor.SearchFlags=flags
-- From Editor.cxx
ifeditor.SelectionEmptyornoteditor.MultipleSelectionthen
localstartWord=editor:WordStartPosition(editor.CurrentPos, true)
localendWord=editor:WordEndPosition(startWord, true)
editor:SetSelection(startWord, endWord)
else
locali=editor.MainSelection
locals=editor:textrange(editor.SelectionNStart[i], editor.SelectionNEnd[i])
localsearchRanges= {{editor.SelectionNEnd[i], editor.TargetEnd}, {editor.TargetStart, editor.SelectionNStart[i]}}
for_, rangeinpairs(searchRanges) do
editor:SetTargetRange(range[1], range[2])
ifeditor:SearchInTarget(s) ~=-1then
editor:AddSelection(editor.TargetStart, editor.TargetEnd)
editor:ScrollRange(editor.TargetStart, editor.TargetEnd)
break
end
end
end
end)