nail333
  Junior Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Добрый день, первым делом хочу сказать спасибо за огромную проделанную работу!        Столкнулся с не совсем корректной работой скрипта paired_tags.lua на таких xml-ках (минимальный пример):    Код:   Я никогда раньше не имел дела с lua, так что поправил функцию PairedTagsFinder() как смог, вроде теперь работает правильно       Код:    local function PairedTagsFinder()       local current_pos = editor.CurrentPos       if current_pos == old_current_pos then return end       old_current_pos = current_pos          EditorClearMarks(1)       EditorClearMarks(2)          t.tag_start = nil       t.tag_end = nil       t.paired_start = nil       t.paired_end = nil          local tag_start = editor:findtext("[<>]", SCFIND_REGEXP, current_pos, 0)       if tag_start == nil then return end       if editor.CharAt[tag_start] ~= 60 then return end       if editor.StyleAt[tag_start+1] ~= 1 then return end       if tag_start == t.tag_start then return end       t.tag_start = tag_start          t.tag_end = editor:findtext("[<>]", SCFIND_REGEXP, current_pos, editor.Length)       if t.tag_end == nil then return end       if editor.CharAt[t.tag_end] ~= 62 then t.tag_end = nil return end                  if editor.CharAt[t.tag_end-1] ~= 47 then                local dec, find_end           if editor.CharAt[t.tag_start+1] == 47 then               dec, find_end = -1, 0           else               dec, find_end =  1, editor.Length           end              -- Find paired tag           local tag = editor:textrange(editor:findtext("\\w+", SCFIND_REGEXP, t.tag_start, t.tag_end))           local count = 1           local find_start = t.tag_start+dec           repeat               t.paired_start, t.paired_end = editor:findtext("</*"..tag.."[^/>]*>", SCFIND_REGEXP, find_start, find_end)               if t.paired_start == nil then break end               if t.paired_end ~= nil then                    t.paired_end = t.paired_end-1                end               if editor.CharAt[t.paired_start+1] == 47 then                   count = count - dec               else                   count = count + dec               end               if count == 0 then break end               find_start = t.paired_start + dec           until false       end          if t.paired_start ~= nil then           -- paint in Blue           EditorMarkText(t.tag_start + 1, t.tag_end - t.tag_start - 1, 1)           EditorMarkText(t.paired_start + 1, t.paired_end - t.paired_start - 1, 1)       else           if props["find.mark.2"] ~= '' then               -- paint in Red               EditorMarkText(t.tag_start + 1, t.tag_end - t.tag_start - 1, 2)           end       end   end     |  
  |