-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcclike.lua
40 lines (38 loc) · 1004 Bytes
/
cclike.lua
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
-----------------------------------------------------------------------------
-- raVen's c&c like input 20160913-01
-----------------------------------------------------------------------------
local cccolor = 0xcf;
local pattern = '[%a%d%p%w%s]';
local cx, cy = -1, -1;
Event {
group = 'EditorInput';
description = 'command and conquer like input';
action = function(param)
if(param.EventType ~= far.Flags.KEY_EVENT) then
return;
end;
if(param.UnicodeChar:match(pattern) == nil) then
return;
end;
local ei = editor.GetInfo();
if(param.KeyDown) then
cx = ei.CurPos;
cy = ei.CurLine;
else
editor.Redraw(ei.EditorID);
end;
end;
}
Event {
group = 'EditorEvent';
description = 'command and conquer like input';
action = function(eid, event)
if(
(event==far.Flags.EE_REDRAW) and
(cx ~= -1) and (cy ~= -1)
) then
editor.AddColor(eid, cy, cx, cx, far.Flags.ECF_AUTODELETE, cccolor);
cx, cy = -1, -1;
end;
end;
}