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

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

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

Maz (23-11-2017 18:57): FAR Manager (часть 5)  Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

   

Alexyz21



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

Код:
-- Автор zg, соавтор AleXH.
-- Страница скрипта: http://forum.ru-board.com/topic.cgi?forum=5&topic=48136&start=960#17
-- прототип: http://forum.farmanager.com/viewtopic.php?f=60&t=8674
 
F=far.Flags
editors={}
Colors={
  regex.new "/(\\s+?)(\\S|$)/"
  {Flags:bit64.bor F.FCF_FG_4BIT,F.FCF_BG_4BIT
  ForegroundColor:0x9
  BackgroundColor:0x1}
  regex.new "/([а-яёА-ЯЁ]+?)([^а-яёА-ЯЁ]|$)/"
  {Flags:bit64.bor F.FCF_FG_4BIT,F.FCF_BG_4BIT
  ForegroundColor:0xe
  BackgroundColor:0xc}
--  regex.new [[/([-+*:.,;!?~@#$%^&\\\/]+?)([-+*:.,;!?~@#$%^&\\\/]|$)/]]
--  {Flags:bit64.bor F.FCF_FG_4BIT,F.FCF_BG_4BIT
--  ForegroundColor:0xf
--  BackgroundColor:0x1}
}
colorguid=win.Uuid "F4B5E624-16F6-4243-9A3D-763097C72EAA"
 
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
 
count,ttime0,ttime1=0,0,0
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
      ttime=far.FarClock!
      count=count+1
      if ttime-ttime1>8000 --block other redraw events
        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
            RealLeftPos=editor.TabToReal(ei.EditorID,ii,ei.LeftPos)-1
            gsw=editor.GetStringW(ei.EditorID,ii)
            line=gsw.StringText
            length=gsw.StringLength
            if RealLeftPos<=length
              RightBorder=RealLeftPos+ei.WindowSizeX
              if RightBorder>length
                editor.AddColor ei.EditorID,ii,length+1,length+2,0,Colors[2],190,colorguid
              for i=1,#Colors/2
                sEnd=RealLeftPos
                while sEnd<RightBorder
                  sBegin,sEnd,_,s2=Colors[i*2-1]\findW line,sEnd+1
                  if sEnd
                    if s2~=""
                      sEnd=sEnd-1
                    sEnd=math.min sEnd,RightBorder
                    editor.AddColor ei.EditorID,ii,sBegin,sEnd,0,Colors[i*2],190,colorguid
                  else
                    break
        ttime0=ttime0+far.FarClock!-ttime
      ttime1=far.FarClock!
 
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]
      count,ttime0=0,0
      editors[id]=
        start:0
        finish:0
--      editor.Redraw!
      Editor.Set 20,1
      msgbox "count: "..count,"time: "..ttime0
    else
      ProcessColors id,(data)->
        data.start=1
        data.finish=1
      editors[id]=nil
--      editor.Redraw!
      Editor.Set 20,0
      msgbox "count: "..count,"time: "..ttime0
 

Всего записей: 3471 | Зарегистр. 16-06-2007 | Отправлено: 09:59 30-03-2016 | Исправлено: Alexyz21, 10:02 30-03-2016
   

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

Компьютерный форум Ru.Board » Компьютеры » Программы » FAR Manager (часть 4)
Maz (23-11-2017 18:57): FAR Manager (часть 5)


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

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

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru