some docs cleanup
This commit is contained in:
@@ -1239,5 +1239,5 @@ describe('EscapeSequenceParser', function (): void {
|
|||||||
chai.expect(errorState).eql(null);
|
chai.expect(errorState).eql(null);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// TODO: error conditions
|
// TODO: error conditions and error recovery (not implemented yet in parser)
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -205,6 +205,7 @@ class DcsDummy implements IDcsHandler {
|
|||||||
* the optional `transitions` contructor argument and
|
* the optional `transitions` contructor argument and
|
||||||
* reimplement the `parse` method.
|
* reimplement the `parse` method.
|
||||||
* NOTE: The parameter element notation is currently not supported.
|
* NOTE: The parameter element notation is currently not supported.
|
||||||
|
* TODO: implement error recovery hook via error handler return values
|
||||||
*/
|
*/
|
||||||
export class EscapeSequenceParser implements IEscapeSequenceParser {
|
export class EscapeSequenceParser implements IEscapeSequenceParser {
|
||||||
public initialState: number;
|
public initialState: number;
|
||||||
@@ -433,7 +434,7 @@ export class EscapeSequenceParser implements IEscapeSequenceParser {
|
|||||||
abort: false
|
abort: false
|
||||||
});
|
});
|
||||||
if (inject.abort) return;
|
if (inject.abort) return;
|
||||||
// FIXME: inject return values
|
// TODO: inject return values
|
||||||
error = false;
|
error = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -500,7 +501,10 @@ export class EscapeSequenceParser implements IEscapeSequenceParser {
|
|||||||
if (idx === -1) {
|
if (idx === -1) {
|
||||||
this._oscHandlerFb(-1, osc); // this is an error (malformed OSC)
|
this._oscHandlerFb(-1, osc); // this is an error (malformed OSC)
|
||||||
} else {
|
} else {
|
||||||
let identifier = parseInt(osc.substring(0, idx)); // NaN not handled here
|
// Note: NaN is not handled here
|
||||||
|
// either catch it with the fallback handler
|
||||||
|
// or with an explicit NaN OSC handler
|
||||||
|
let identifier = parseInt(osc.substring(0, idx));
|
||||||
let content = osc.substring(idx + 1);
|
let content = osc.substring(idx + 1);
|
||||||
callback = this._oscHandlers[identifier];
|
callback = this._oscHandlers[identifier];
|
||||||
if (callback) callback(content);
|
if (callback) callback(content);
|
||||||
|
|||||||
+14
-10
@@ -51,14 +51,18 @@ class RequestTerminfo implements IDcsHandler {
|
|||||||
*/
|
*/
|
||||||
class DECRQSS implements IDcsHandler {
|
class DECRQSS implements IDcsHandler {
|
||||||
private _data: string;
|
private _data: string;
|
||||||
|
|
||||||
constructor(private _terminal: any) { }
|
constructor(private _terminal: any) { }
|
||||||
|
|
||||||
hook(collect: string, params: number[], flag: number): void {
|
hook(collect: string, params: number[], flag: number): void {
|
||||||
// reset data
|
// reset data
|
||||||
this._data = '';
|
this._data = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
put(data: string, start: number, end: number): void {
|
put(data: string, start: number, end: number): void {
|
||||||
this._data += data.substring(start, end);
|
this._data += data.substring(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
unhook(): void {
|
unhook(): void {
|
||||||
switch (this._data) {
|
switch (this._data) {
|
||||||
// valid: DCS 1 $ r Pt ST (xterm)
|
// valid: DCS 1 $ r Pt ST (xterm)
|
||||||
@@ -71,7 +75,7 @@ class DECRQSS implements IDcsHandler {
|
|||||||
';' + (this._terminal.buffer.scrollBottom + 1) + 'r';
|
';' + (this._terminal.buffer.scrollBottom + 1) + 'r';
|
||||||
return this._terminal.send(C0.ESC + 'P1' + '$r' + pt + C0.ESC + '\\');
|
return this._terminal.send(C0.ESC + 'P1' + '$r' + pt + C0.ESC + '\\');
|
||||||
case 'm': // SGR
|
case 'm': // SGR
|
||||||
// FIXME: report real settings instead of 0m
|
// TODO: report real settings instead of 0m
|
||||||
return this._terminal.send(C0.ESC + 'P1' + '$r' + '0m' + C0.ESC + '\\');
|
return this._terminal.send(C0.ESC + 'P1' + '$r' + '0m' + C0.ESC + '\\');
|
||||||
case ' q': // DECSCUSR
|
case ' q': // DECSCUSR
|
||||||
const STYLES = {'block': 2, 'underline': 4, 'bar': 6};
|
const STYLES = {'block': 2, 'underline': 4, 'bar': 6};
|
||||||
@@ -189,8 +193,7 @@ export class InputHandler implements IInputHandler {
|
|||||||
this._parser.setExecuteHandler(C0.HT, () => this.tab());
|
this._parser.setExecuteHandler(C0.HT, () => this.tab());
|
||||||
this._parser.setExecuteHandler(C0.SO, () => this.shiftOut());
|
this._parser.setExecuteHandler(C0.SO, () => this.shiftOut());
|
||||||
this._parser.setExecuteHandler(C0.SI, () => this.shiftIn());
|
this._parser.setExecuteHandler(C0.SI, () => this.shiftIn());
|
||||||
// FIXME: What do to with missing? Old code just added those to print, but that's wrong
|
// FIXME: What do to with missing? Old code just added those to print.
|
||||||
// behavior for most control codes.
|
|
||||||
|
|
||||||
// some C1 control codes - FIXME: should those be enabled by default?
|
// some C1 control codes - FIXME: should those be enabled by default?
|
||||||
this._parser.setExecuteHandler(C1.IND, () => this.index());
|
this._parser.setExecuteHandler(C1.IND, () => this.index());
|
||||||
@@ -264,7 +267,7 @@ export class InputHandler implements IInputHandler {
|
|||||||
this._parser.setEscHandler('+' + flag, () => this.selectCharset('+' + flag));
|
this._parser.setEscHandler('+' + flag, () => this.selectCharset('+' + flag));
|
||||||
this._parser.setEscHandler('-' + flag, () => this.selectCharset('-' + flag));
|
this._parser.setEscHandler('-' + flag, () => this.selectCharset('-' + flag));
|
||||||
this._parser.setEscHandler('.' + flag, () => this.selectCharset('.' + flag));
|
this._parser.setEscHandler('.' + flag, () => this.selectCharset('.' + flag));
|
||||||
this._parser.setEscHandler('/' + flag, () => this.selectCharset('/' + flag)); // FIXME: supported?
|
this._parser.setEscHandler('/' + flag, () => this.selectCharset('/' + flag)); // TODO: supported?
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1889,7 +1892,7 @@ export class InputHandler implements IInputHandler {
|
|||||||
*/
|
*/
|
||||||
public selectCharset(collectAndFlag: string): void {
|
public selectCharset(collectAndFlag: string): void {
|
||||||
if (collectAndFlag.length !== 2) return this.selectDefaultCharset();
|
if (collectAndFlag.length !== 2) return this.selectDefaultCharset();
|
||||||
if (collectAndFlag[0] === '/') return; // FIXME: Is this supported?
|
if (collectAndFlag[0] === '/') return; // TODO: Is this supported?
|
||||||
this._terminal.setgCharset(GLEVEL[collectAndFlag[0]], CHARSETS[collectAndFlag[1]] || DEFAULT_CHARSET);
|
this._terminal.setgCharset(GLEVEL[collectAndFlag[0]], CHARSETS[collectAndFlag[1]] || DEFAULT_CHARSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1900,7 +1903,7 @@ export class InputHandler implements IInputHandler {
|
|||||||
* Moves the cursor down one line in the same column.
|
* Moves the cursor down one line in the same column.
|
||||||
*/
|
*/
|
||||||
public index(): void {
|
public index(): void {
|
||||||
this._terminal.index(); // FIXME: save to move the implementation from terminal?
|
this._terminal.index(); // TODO: save to move from terminal?
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1911,7 +1914,7 @@ export class InputHandler implements IInputHandler {
|
|||||||
* the value of the active column when the terminal receives an HTS.
|
* the value of the active column when the terminal receives an HTS.
|
||||||
*/
|
*/
|
||||||
public tabSet(): void {
|
public tabSet(): void {
|
||||||
this._terminal.tabSet(); // FIXME: save to move the implementation from terminal?
|
this._terminal.tabSet(); // TODO: save to move from terminal?
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1922,7 +1925,7 @@ export class InputHandler implements IInputHandler {
|
|||||||
* the page scrolls down.
|
* the page scrolls down.
|
||||||
*/
|
*/
|
||||||
public reverseIndex(): void {
|
public reverseIndex(): void {
|
||||||
this._terminal.reverseIndex(); // FIXME: save to move the implementation from terminal?
|
this._terminal.reverseIndex(); // TODO: save to move from terminal?
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1931,7 +1934,8 @@ export class InputHandler implements IInputHandler {
|
|||||||
* Reset to initial state.
|
* Reset to initial state.
|
||||||
*/
|
*/
|
||||||
public reset(): void {
|
public reset(): void {
|
||||||
this._terminal.reset(); // FIXME: save to move the implementation from terminal?
|
this._parser.reset();
|
||||||
|
this._terminal.reset(); // TODO: save to move from terminal?
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1945,6 +1949,6 @@ export class InputHandler implements IInputHandler {
|
|||||||
* you use another locking shift. (partly supported)
|
* you use another locking shift. (partly supported)
|
||||||
*/
|
*/
|
||||||
public setgLevel(level: number): void {
|
public setgLevel(level: number): void {
|
||||||
this._terminal.setgLevel(level); // FIXME: save to move the implementation from terminal?
|
this._terminal.setgLevel(level); // TODO: save to move from terminal?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -422,7 +422,7 @@ export const enum ParserAction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal state of EscapeSequenceParser.
|
* Internal state of EscapeSequenceParser.
|
||||||
* Used as argument to the error handler to allow
|
* Used as argument of the error handler to allow
|
||||||
* introspection at runtime on parse errors.
|
* introspection at runtime on parse errors.
|
||||||
* Return it with altered values to recover from
|
* Return it with altered values to recover from
|
||||||
* faulty states (not yet supported).
|
* faulty states (not yet supported).
|
||||||
|
|||||||
Reference in New Issue
Block a user