Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Компьютеры » Программы » Far Manager (часть 3)

Модерирует : gyra, Maz

articlebot (06-10-2016 09:08): Far Manager  Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

   

Alexyz21



Silver Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору

Код:
F=far.Flags
editors={}
color=
  Flags:bit64.bor F.FCF_FG_4BIT,F.FCF_BG_4BIT
  ForegroundColor:0xe
  BackgroundColor:0xc
colorguid=win.Uuid "A1811CF8-C7AA-4474-A204-F8306028C7A7"
 
word=regex.new "/\\b(\\w+?)\\b/"
rus=
  match:regex.new "/((?<=[a-zA-Z0-9])[а-яёА-ЯЁ]+|[а-яёА-ЯЁ]+(?=[a-zA-Z0-9]))/"
  find:regex.new "/([аеорсхуАВЕЗКМНОРСТХ]+)/"
 
GetEditorData=(id)->
  data=editors[id]
  if not data
    editors[id]=
      start:0
      finish:0
    data=editors[id]
  data
 
RemoveColors=(id,data)->
  for ii=data.start,data.finish
    editor.DelColor id,ii,0,colorguid
 
ProcessColors=(id,update)->
  data=GetEditorData id
  RemoveColors id,data
  update data
 
Event
  group:"EditorEvent"
  condition:(id,event,param)->
    return editors[id]
  action:(id,event,param)->
    if event==F.EE_CLOSE
      editors[id]=nil
    if event==F.EE_REDRAW then
      ei=editor.GetInfo!
      ProcessColors ei.EditorID,(data)->
        data.start=ei.TopScreenLine
        data.finish=math.min ei.TopScreenLine+ei.WindowSizeY,ei.TotalLines
        for ii=data.start,data.finish
          line=editor.GetStringW(-1,ii).StringText
          posl=1
          while true
            lbegin,lend,curr=word\findW line,posl
            if lbegin==nil then break
            if rus.match\matchW curr
              posw=1
              while true
                wbegin,wend=rus.find\findW curr,posw
                if not wbegin then break
                editor.AddColor ei.EditorID,ii,lbegin+wbegin-1,lbegin+wend-1,0,color,190,colorguid
                posw=wend+1
            posl=lend+1
 
Event
  group:"ExitFAR"
  action:->
    wincount=far.AdvControl F.ACTL_GETWINDOWCOUNT,0,0
    for ii=1,wincount
      info=far.AdvControl F.ACTL_GETWINDOWINFO,ii,0
      if info and F.WTYPE_EDITOR==info.Type
        ProcessColors info.Id,(data)->
          data.start=0
          data.finish=0
 
Macro
  description:"Подсветка кириллицы похожей на латиницу в смешанных словах"
  area:"Editor"
  key:"F3"
  action:->
    id = editor.GetInfo(-1).EditorID
    if not editors[id]
      editors[id] =
        start:0
        finish:0
      editor.Redraw!
    else
      ProcessColors id,(data)->
        data.start=1
        data.finish=1
      editors[id] = nil
 

Всего записей: 3483 | Зарегистр. 16-06-2007 | Отправлено: 18:10 09-01-2015 | Исправлено: Alexyz21, 20:48 09-02-2015
   

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Компьютеры » Программы » Far Manager (часть 3)
articlebot (06-10-2016 09:08): Far Manager


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru