--▽▽UTF-8▽▽ --[[ copyleft by jinzhongjie(xjinzhongjie@hotmail.com).anyone who want change the code please tell writer. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. ]] scite_Command { 'BookMarkList|bookmarkLlist|Ctrl+F3', } ------------------------------------------------------------------- local my_path = lua_LoadPath() local mark_pos_start = -1 local mark_pos_end = -1 local markList = {} local markListStart = -1 local markListEnd = -1 local active_line = -1 local function remove_mark() if active_line>-1 then local base = output:LineFromPosition(markListStart) output:MarkerDelete(base+active_line, 11) active_line = -1 end outputRemove(output, mark_pos_start, mark_pos_end) mark_pos_start = -1 mark_pos_end = -1 end local function clearMarkParam() mark_pos_start = -1 mark_pos_end = -1 end local function MarkAdjust(diff) mark_pos_start = mark_pos_start + diff markListStart = markListStart + diff markListEnd = markListEnd + diff mark_pos_end = mark_pos_end + diff --funcLinestart=output:LineFromPosition(func_pos_start) end scite_outputChange(function(pane, bPos, length) --print('start:'..output.SelectionStart..',end:'..output.SelectionEnd) if pane == output then --print("---"..keyval) RoutineAdjustChange(bPos, length, mark_pos_start, mark_pos_end, MarkAdjust, clearMarkParam) end return false end) scite_OnInit(function(order1, order2) if order1 == 0 and order2 == 0 then local f = io.open(my_path.."/BookmarkList.cnf", "r") if not f then return false end for line in f:lines()do local field, Value = line:match('^([^=]+)=(.*)$') if field == 'mark_pos_start' then mark_pos_start = tonumber(Value) elseif field == 'mark_pos_end' then mark_pos_end = tonumber(Value) end end f:close() if mark_pos_start >-1 and mark_pos_end>-1 then remove_mark() end end return false end) scite_OnFinalise(function(level1, level2) if level1 == 1 then local f = io.open(my_path.."/BookmarkList.cnf", "w") if not f then return false end f:write('mark_pos_start='..mark_pos_start..'\n') f:write('mark_pos_end='..mark_pos_end..'\n') f:close() end return false end) function bookmarkLlist() if mark_pos_start >-1 and mark_pos_end>-1 then remove_mark() end output.CurrentPos = output.Length mark_pos_start = output.CurrentPos print("---------bookmark------------------") markListStart = output.CurrentPos local ind = 0 local linePos = editor:MarkerNext(0, 2) while linePos >-1 do local content = editor:GetLine(linePos):sub(1, -2) markList[ind] = {linePos, content} print(ind..":"..linePos+1 .."--"..content) linePos = editor:MarkerNext(linePos+1, 2) ind = ind+1 end markListEnd = output.CurrentPos print("---------------------------") mark_pos_end = output.CurrentPos end scite_OnDoubleClick(function() if output.Focus and output.CurrentPos >= markListStart and output.CurrentPos < markListEnd then local current = output:LineFromPosition(output.CurrentPos) local base = output:LineFromPosition(markListStart) local ind = current-base active_line = ind --print("line:"..ind) editor:GotoLine(markList[ind][1]) output:MarkerDeleteAll(11) output:MarkerDefine(11, SC_MARK_FULLRECT) output:MarkerSetBack(11, colour_parse('vYellow')) output:MarkerAdd(base+ind, 11) editor:MarkerDeleteAll(2) editor:MarkerDefine(2, SC_MARK_FULLRECT) editor:MarkerSetBack(2, colour_parse('yellow')) editor:MarkerAdd(markList[ind][1], 2) return true end return false end)