Skip to content

Commit

Permalink
update functions using csi with some unimplemented functions
Browse files Browse the repository at this point in the history
  • Loading branch information
qwefgh90 committed Dec 21, 2023
1 parent ed2a498 commit 4b35b5a
Showing 1 changed file with 94 additions and 22 deletions.
116 changes: 94 additions & 22 deletions projects/ng-terminal/src/lib/functions-using-csi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class FunctionsUsingCSI {
* CSI Ps SP @ */
/**
* CSI Ps A Cursor Up Ps Times (default = 1) (CUU).
* \x9b3A*/
* \x9b3A */
static cursorUp(count: number) {
return `${CSI}${count}A`;
}
Expand Down Expand Up @@ -170,48 +170,102 @@ export class FunctionsUsingCSI {
return `${CSI}${count}X`;
}
/**
* CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT). */
/**
* CSI Ps ^ Scroll down Ps lines (default = 1) (SD), ECMA-48. */
/**
* CSI Pm ` Character Position Absolute [column] (default = [row,1]) */
/**
* CSI Pm a Character Position Relative [columns] (default = [row,col+1]) */
* CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).
* \x9b2Z
* */
static cursorBackwardTabulationPstabstops(count: number) {
return `${CSI}${count}Z`;
}
/**
* CSI Ps b Repeat the preceding graphic character Ps times (REP). */
* CSI Ps ^ Scroll down Ps lines (default = 1) (SD), ECMA-48.
* \x9b2^
* */
static scrolldownPslines(count: number) {
return `${CSI}${count}^`;
}
/**
* CSI Ps c Send Device Attributes (Primary DA). */
* CSI Ps ` Character Position Absolute [column] (default = [row,1])
* \x9b1` */
static characterPositionAbsolute(count: number) {
return `${CSI}${count}\``;
}
/**
* CSI = Ps c */
* CSI Ps a Character Position Relative [columns] (default = [row,col+1])
* \x9b1a */
static characterPositionRelative(count: number) {
return `${CSI}${count}a`;
}
/**
* CSI > Ps c */
* CSI Ps b Repeat the preceding graphic character Ps times (REP).
* \x9b1b
* */
static repeatThePrecedingGraphicCharacter(count: number) {
return `${CSI}${count}b`;
}
/**
* CSI Pm d Line Position Absolute [row] (default = [1,column]) (VPA). */
* CSI Pm d Line Position Absolute [row] (default = [1,column]) (VPA).
* \x9b4d
* */
static linePositionAbsolute(count: number) {
return `${CSI}${count}d`;
}
/**
* CSI Pm e Line Position Relative [rows] (default = [row+1,column]) */
* CSI Pm e Line Position Relative [rows] (default = [row+1,column])
* \x9b1e
* */
static linePositionRelative(count: number) {
return `${CSI}${count}e`;
}
/**
* CSI Ps ; Ps f */
* CSI Ps ; Ps f Horizontal and Vertical Position [row;column] (default =
* [1,1])
* \x9b3;5f
* */
static horizontalandVerticalPosition(row: number, column: number) {
return `${CSI}${row};${column}f`;
}

/**
* CSI Ps g Tab Clear (TBC). */
* CSI Ps g Tab Clear (TBC).
* \x9b3g
* */
/**
* CSI Pm h Set Mode (SM). */
* CSI Pm h Set Mode (SM).
* \x9b4h
* */
static setMode(mode: KindOfSetMode, ...additionalModes: KindOfSetMode[]) {
const modes = [mode, ...(additionalModes ?? [])];
return `${CSI}${modes.join(";")}h`;
}
/**
* CSI ? Pm h */
* CSI ? Pm h DEC Private Mode Set (DECSET).
* */
/**
* CSI Pm i Media Copy (MC). */
/**
* CSI ? Pm i */
/**
* CSI Pm l Reset Mode (RM). */
* CSI Pm l Reset Mode (RM).
* \x9b4l
* */
static resetMode(mode: KindOfResetMode, ...additionalModes: KindOfResetMode[]) {
const modes = [mode, ...(additionalModes ?? [])];
return `${CSI}${modes.join(";")}l`;
}
/**
* CSI ? Pm l */
/**
* CSI Pm m Character Attributes (SGR). */
* CSI Pm m Character Attributes (SGR).
* \x9b31m
* */
static characterAttributes(
firstAttribute: KindOfCharacterAttributes,
...additionalAttributes: (KindOfCharacterAttributes)[]
...additionalAttributes: KindOfCharacterAttributes[]
) {
const chars: (KindOfCharacterAttributes)[] = [firstAttribute, ...(additionalAttributes ?? [])];
const chars: KindOfCharacterAttributes[] = [
firstAttribute,
...(additionalAttributes ?? []),
];
return `${CSI}${chars.join(';')}m`;
}
/**
Expand Down Expand Up @@ -323,6 +377,24 @@ export enum KindOfEraseInLine {
All = 2,
}

export enum KindOfTabClear{
ClearCurrentColumn = 0,
ClearAll = 3
}


export enum KindOfSetMode{
KeyboardActionMode = 2,
InsertMode = 4,
SendReceive = 12,
AutomaticNewline = 20
}
export enum KindOfResetMode{
KeyboardActionMode = 2,
ReplaceMode = 4,
SendReceive = 12,
NormalNewline = 20
}
export enum KindOfCharacterAttributes {
Normal = 0,
Bold = 1,
Expand Down

0 comments on commit 4b35b5a

Please sign in to comment.