-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions-keys.reb
53 lines (47 loc) · 1 KB
/
functions-keys.reb
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
41
42
43
44
45
46
47
48
49
50
51
52
53
rebol []
super-on-key: func [face arg] [do-actor/style face 'on-key arg face/style]
insertText-moveCursor-updateFace: func [
face
string
n-move
][
insert-text-face face string
move-cursor face 'left n-move false
update-text-caret face
see-caret face
show-later face
]
i-m-u: :insertText-moveCursor-updateFace
count-ch: func [
string
char
/local i
][
i: 0
parse string [some [char (++ i)]]
i
]
count-tab: func [string] [count-ch find-newline string tab]
find-newline: func [string /local ris] [
either
ris: find/reverse string newline
[next ris]
[head string] ;first line
]
string-tab: funct [string] [
n: count-tab string
str: make string! add n 1; newline + tabs
append str newline
loop n [append str #"^-"]
str
]
eval-line: func [
face
/local text-eval result text-loaded
][
text-eval: copy/part
find-newline face/state/cursor
face/state/cursor
text-loaded: load text-eval
either error? result: try text-loaded ["error"] [to-string result]
]