Skip to content

Commit 61f1293

Browse files
^X364 mnemonics support, modified line erasing escape sequences
1 parent 892a960 commit 61f1293

3 files changed

Lines changed: 249 additions & 4 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"printableName": "Cache Web Terminal",
66
"description": "Web-based terminal emulator for Caché administering.",
77
"author": "ZitRo",
8-
"version": "4.1.3",
8+
"version": "4.2.0",
99
"gaID": "UA-83005064-2",
1010
"releaseNumber": 26,
1111
"scripts": {

src/client/js/output/esc.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import * as caret from "../input/caret";
55

66
let cursorHome,
77
savedCursorPosition = [],
8-
savedGraphicProperties = {};
8+
savedGraphicProperties = {},
9+
temp;
910

1011
/**
1112
* DO NOT use output.print function inside: it may bring unexpected results as print function uses
@@ -153,13 +154,14 @@ export default {
153154
output.GRAPHIC_PROPERTIES = JSON.parse(JSON.stringify(savedGraphicProperties));
154155
},
155156
// erasing text
156-
"\x1b[K": () => {
157+
"\x1b[K": temp = () => {
157158
let pos = output.getCursorX(),
158159
gp = output.GRAPHIC_PROPERTIES;
159160
output.resetGraphicProperties();
160161
output.getCurrentLine().print(new Array(output.WIDTH - pos + 2).join(" "), pos - 1);
161162
output.GRAPHIC_PROPERTIES = gp;
162163
},
164+
"\x1b[0K": temp,
163165
"\x1b[1K": () => {
164166
let pos = output.getCursorX(),
165167
gp = output.GRAPHIC_PROPERTIES;
@@ -170,12 +172,13 @@ export default {
170172
"\x1b[2K": () => {
171173
output.getCurrentLine().clear();
172174
},
173-
"\x1b[J": () => {
175+
"\x1b[J": temp = () => {
174176
let y = output.getCursorY();
175177
for (; y < output.HEIGHT + 1; y++) {
176178
output.getLineByCursorY(y).clear();
177179
}
178180
},
181+
"\x1b[0J": temp,
179182
"\x1b[1J": () => {
180183
let y = output.getCursorY();
181184
for (; y > 0; y--) {

src/cls/WebTerminal/Core.cls

Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,248 @@ rstr(length = 32656, timeout = 86400)
5252
rchr(timeout = 86400)
5353
do ##class(WebTerminal.Common).SendChunk($ZPARENT, "c", timeout)
5454
quit $LISTGET(##class(WebTerminal.Common).ReceiveChunk(), 2)
55+
56+
erdx s $x=0 q
57+
erdy s $y=0 q
58+
APC ; Application program command
59+
w $c(27)_"_"
60+
q
61+
BEL ; Ring the bell
62+
w $c(7)
63+
q
64+
CBT(%1) ; Cursor backward tabulation %1 tab stops
65+
s %1=+$g(%1,1) w $c(27,91)_%1_"Z" s $zt="erdx",$x=$x+7\8-%1*8
66+
q
67+
CCH ; Cancel character
68+
w $c(27)_"T"
69+
q
70+
CHA(%1) ; Cursor horizontal absolute (move to column %1)
71+
s %1=+$g(%1,1) w $c(27,91)_%1_"G" s $zt="erdx",$x=%1-1
72+
q
73+
CHT(%1) ; Cursor horizontal tabulation (forward %1 tab stops)
74+
s %1=+$g(%1,1) w $c(27,91)_%1_"I" s $zt="erdx",$x=$x\8+%1*8
75+
q
76+
CNL(%1) ; Cursor next line (cursor down %1 lines)
77+
s %1=+$g(%1,1) w $c(27,91)_%1_"E" s $zt="erdy",$y=$y+%1
78+
q
79+
CPL(%1) ; Cursor preceding line (cursor up %1 lines)
80+
s %1=+$g(%1,1) w $c(27,91)_%1_"F" s $zt="erdy",$y=$y-%1
81+
q
82+
CPR ; Cursor position report (return in $KEY)
83+
n %1 w $c(27,91)_"6n" r %1
84+
q
85+
CTC(%1,%2,%3,%4,%5,%6,%7,%8,%9) ; Cursor tabulation control
86+
n %i,%p s %p=""
87+
f %i=1:1:9 i $d(@("%"_%i)) s %p=%p_$e(";",%p'="")_@("%"_%i)
88+
w $c(27,91)_%p_"W"
89+
q
90+
CUB(%1) ; Cursor backward %1 columns
91+
s %1=+$g(%1,1) w $c(27,91)_%1_"D" s $zt="erdx",$x=$x-%1
92+
q
93+
CUD(%1) ; Cursor down %1 lines
94+
s %1=+$g(%1,1) w $c(27,91)_%1_"B" s $zt="erdy",$y=$y+%1
95+
q
96+
CUF(%1) ; Cursor forward %1 columns
97+
s %1=+$g(%1,1) w $c(27,91)_%1_"C" s $zt="erdx",$x=$x+%1
98+
q
99+
CUP(%2,%1) ; Cursor position (column %1, line %2)
100+
s %1=+$g(%1,1),%2=+$g(%2,1) w $c(27,91)_%2_";"_%1_"H"
101+
s $zt="ecup",$x=%1-1,$zt="erdy",$y=%2-1 q
102+
ecup s $x=0,$zt="erdy",$y=%2-1
103+
q
104+
CUU(%1) ; Cursor up %1 lines
105+
s %1=+$g(%1,1) w $c(27,91)_%1_"A" s $zt="erdy",$y=$y-%1
106+
q
107+
CVT(%1) ; Cursor vertical tabulation
108+
w $c(27,91)_+$g(%1,1)_"Y"
109+
q
110+
DA ; Device attributes - return in $KEY
111+
n %1,%2,%3 s %3="" u $i:("":"+S")
112+
w $c(27,91)_"c" r %1 s %2=$k f r *%1 s %3=%3_$c(%1) q:%1=99
113+
s $k=%2_%3 u $i:("":"-S")
114+
q
115+
DAQ(%1,%2,%3,%4,%5,%6,%7,%8,%9) ; Define area qualification
116+
n %i,%p s %p=""
117+
f %i=1:1:9 i $d(@("%"_%i)) s %p=%p_$e(";",%p'="")_@("%"_i)
118+
w $c(27,91)_%p_"o"
119+
q
120+
DCH(%1) ; Delete %1 characters
121+
w $c(27,91)_+$g(%1,1)_"P"
122+
q
123+
DCS ; Device control string
124+
w $c(27)_"P"
125+
q
126+
DL(%1) ; Delete %1 lines
127+
w $c(27,91)_+$g(%1,1)_"M"
128+
q
129+
DMI ; Disable manual input
130+
q
131+
DSR(%1) ; Device status report - type %1 - return in $KEY
132+
n %2 w $c(27,91)_+$g(%1,5)_"n" r %2
133+
q
134+
EA(%1) ; Erase in area
135+
w $c(27,91)_+$g(%1,1)_"O"
136+
q
137+
ECH(%1) ; Erase %1 characters
138+
w $c(27,91)_+$g(%1,1)_"X"
139+
q
140+
ED(%1) ; Erase in display (%1=0 cursor-to-end,1 begin-to-cursor,2 entire scr)
141+
w $c(27,91)_+$g(%1)_"J"
142+
q
143+
EF(%1) ; Erase in field
144+
w $c(27,91)_+$g(%1,1)_"N"
145+
q
146+
EL(%1) ; Erase in line (%1=0 cursor-to-end, 1 begin-to-cursor, 2 entire line)
147+
w $c(27,91)_+$g(%1)_"K"
148+
q
149+
EMI ; Enable manual input
150+
q
151+
EPA ; End of protected area
152+
w $c(27)_"W"
153+
q
154+
ESA ; End of selected area
155+
w $c(27)_"G"
156+
q
157+
FNT ; Font selection
158+
q
159+
GSM ; Graphic size modification
160+
q
161+
GSS ; Graphic size selection
162+
q
163+
HPA(%1) ; Horizontal position attribute (cursor to column %1)
164+
s %1=+$g(%1,1) w $c(27,91)_%1_"`" s $zt="erdx",$x=%1-1
165+
q
166+
HPR(%1) ; Horizontal position relative (cursor forward %1 columns)
167+
s %1=+$g(%1,1) w $c(27,91)_%1_"a" s $zt="erdx",$x=$x+%1
168+
q
169+
HTJ ; Horizontal tab with justify
170+
w $c(27)_"I"
171+
q
172+
HTS ; Horizontal tabulation set
173+
w $c(27)_"H"
174+
q
175+
HVP(%1,%2) ; Horizontal and vertical position (column %1, line %2)
176+
s %1=+$g(%1,1),%2=+$g(%2,1) w $c(27,91)_%2_";"_%1_"f"
177+
s $zt="ehvp",$x=%1-1,$zt="erdy",$y=%2-1 q
178+
ehvp s $x=0,$zt="erdy",$y=%2-1
179+
q
180+
ICH(%1) ; Insert %1 characters
181+
w $c(27,91)_+$g(%1,1)_"@"
182+
q
183+
IL(%1) ; Insert %1 lines
184+
w $c(27,91)_+$g(%1,1),"L"
185+
q
186+
IND ; Index
187+
w $c(27)_"D" s $y=$y+1
188+
q
189+
INT ; Interrupt
190+
w $c(27,91)_"a"
191+
q
192+
JFY ; Justify
193+
q
194+
MC ; Media copy
195+
w $c(27,91)_"i"
196+
q
197+
MW ; Message waiting
198+
w $c(27)_"U"
199+
q
200+
NEL ; Next line
201+
w $c(27)_"E" s $x=0,$y=$y+1
202+
q
203+
NP(%1) ; Next page (advance %1 pages of terminal display memory)
204+
w $c(27,91)_+$g(%1,1)_"U"
205+
q
206+
OSC ; Operating system command
207+
w $c(27)_"]"
208+
q
209+
PLD ; Partial line down
210+
w $c(27)_"K"
211+
q
212+
PLU ; Partial line up
213+
w $c(27)_"L"
214+
q
215+
PM ; Privacy message
216+
w $c(27)_"^"
217+
q
218+
PP(%1) ; Preceding page (backup %1 pages of terminal display memory)
219+
w $c(27,91)_+$g(%1,1)_"V"
220+
q
221+
PU1 ; Private use one
222+
w $c(27)_"Q"
223+
q
224+
PU2 ; Private use two
225+
w $c(27)_"R"
226+
q
227+
QUAD ; QUAD
228+
q
229+
REP ; Repeat
230+
w $c(27,91)_"b"
231+
q
232+
RI ; Reverse index
233+
w $c(27)_"M" s $zt="erdy",$y=$y-1
234+
q
235+
RIS ; Reset to initial state
236+
w $c(27)_"c" s $x=0,$y=0
237+
q
238+
RM(%1,%2,%3,%4,%5,%6,%7,%8,%9) ; Reset mode
239+
n %i,%p s %p=""
240+
f %i=1:1:9 i $d(@("%"_%i)) s %p=%p_$e(";",%p'="")_@("%"_%i)
241+
w $c(27,91)_%p_"l"
242+
q
243+
SEM ; Select editing extent mode
244+
w $c(27,91)_"Q"
245+
q
246+
SGR(%1,%2,%3,%4,%5,%6,%7,%8,%9) ; Select graphic rendition %1 thru %9
247+
n %i,%p s %p=""
248+
f %i=1:1:9 i $d(@("%"_%i)) s %p=%p_$e(";",%p'="")_@("%"_%i)
249+
w $c(27,91)_%p_"m"
250+
q
251+
SL ; Scroll left
252+
q
253+
SM(%1,%2,%3,%4,%5,%6,%7,%8,%9) ; Set mode
254+
n %i,%p s %p=""
255+
f %i=1:1:9 i $d(@("%"_%i)) s %p=%p_$e(";",%p'="")_@("%"_%i)
256+
w $c(27,91)_%p_"h"
257+
q
258+
SPA ; Start of protected area
259+
w $c(27)_"V"
260+
q
261+
SPI ; Spacing increment
262+
q
263+
SR ; Scroll right
264+
q
265+
SS2 ; Single shift two
266+
w $c(27)_"N"
267+
q
268+
SS3 ; Single shift three
269+
w $c(27)_"O"
270+
q
271+
SSA ; Start of selected area
272+
w $c(27)_"F"
273+
q
274+
ST ; String terminator
275+
w $c(27)_"\"
276+
q
277+
STS ; Set transmit state
278+
w $c(27)_"S"
279+
q
280+
SU ; Scroll up
281+
w $c(27,91)_"S"
282+
q
283+
TBC ; Tabulation clear
284+
w $c(27,91)_"g"
285+
q
286+
TSS ; Thin space specification
287+
q
288+
VPA(%1) ; Vertical position attribute (move to row %1 at same column)
289+
s %1=+$g(%1,1) w $c(27,91)_%1_"d" s $zt="erdy",$y=%1-1
290+
q
291+
VPR(%1) ; Vertical position relative (move down %1 lines at same column)
292+
s %1=+$g(%1,1) w $c(27,91)_%1_"e" s $zt="erdy",$y=$y+%1
293+
q
294+
VTS ; Vertical tabulation sets
295+
w $c(27)_"J"
296+
q
55297
}
56298

57299
ClassMethod VarList() As %String [ ProcedureBlock = 1 ]

0 commit comments

Comments
 (0)