mirror of
https://github.com/urbit/shrub.git
synced 2024-12-20 17:32:11 +03:00
webterm: more idiomatic array type definitions
This commit is contained in:
parent
288c2121d1
commit
8cc8139243
@ -10,22 +10,22 @@ export type Tint =
|
||||
export type Deco = null | 'br' | 'un' | 'bl';
|
||||
|
||||
export type Stye = {
|
||||
deco: Array<Deco>,
|
||||
deco: Deco[],
|
||||
back: Tint,
|
||||
fore: Tint
|
||||
};
|
||||
|
||||
export type Stub = {
|
||||
stye: Stye,
|
||||
text: Array<string>
|
||||
text: string[]
|
||||
}
|
||||
|
||||
export type Blit =
|
||||
| { bel: null } // make a noise
|
||||
| { clr: null } // clear the screen
|
||||
| { hop: number | { r: number, c: number } } // set cursor col/pos
|
||||
| { klr: Array<Stub> } // put styled
|
||||
| { put: Array<string> } // put text at cursor
|
||||
| { klr: Stub[] } // put styled
|
||||
| { put: string[] } // put text at cursor
|
||||
| { nel: null } // newline
|
||||
| { sag: { path: string, file: string } } // save to jamfile
|
||||
| { sav: { path: string, file: string } } // save to file
|
||||
|
@ -67,7 +67,7 @@ const termConfig: ITerminalOptions = {
|
||||
macOptionClickForcesSelection: true,
|
||||
}
|
||||
|
||||
const csi = (cmd: string, ...args: Array<number>) => {
|
||||
const csi = (cmd: string, ...args: number[]) => {
|
||||
return '\x1b[' + args.join(';') + cmd;
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ const stye = (s: Stye) => {
|
||||
// text decorations
|
||||
//
|
||||
if (s.deco.length > 0) {
|
||||
out += s.deco.reduce((decs: Array<number>, deco: Deco) => {
|
||||
out += s.deco.reduce((decs: number[], deco: Deco) => {
|
||||
switch (deco) {
|
||||
case null: decs.push(0); return decs;
|
||||
case 'br': decs.push(1); return decs;
|
||||
@ -258,7 +258,7 @@ export default function TermApp(props: TermAppProps) {
|
||||
|
||||
const onInput = useCallback((ses: string, e: string) => {
|
||||
const term = useTermState.getState().sessions[ses].term;
|
||||
let belts: Array<Belt> = [];
|
||||
let belts: Belt[] = [];
|
||||
let strap = '';
|
||||
|
||||
while (e.length > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user