Skip to content

Commit c265af7

Browse files
javier-godoypaodb
authored andcommitted
refactor: move onData callback to method
1 parent c51f377 commit c265af7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main/resources/META-INF/frontend/fc-xterm/xterm-element.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,19 @@ export class XTermElement extends LitElement implements TerminalMixin {
161161
this.bellStyle = 'none';
162162
}
163163

164+
_onData(e:string) : void {
165+
//<N CSI is handled by console-feature
166+
this.terminal.write(e.replace(/\r/g,'\x1b[<N\n'));
167+
}
168+
164169
connectedCallback() {
165170
super.connectedCallback();
166171

167172
let term = this.terminal;
168173
term.options.convertEol = true;
169174

170175
//onLineFeed doesn't distinguish lines from user input and lines from terminal.write
171-
//<N CSI is handled by console-feature
172-
term.onData(e => {
173-
term.write(e.replace(/\r/g,'\x1b[<N\n'));
174-
});
176+
term.onData(e=>this._onData(e));
175177

176178
term.onBell(() => {
177179
if (this.bellStyle == 'sound') {

0 commit comments

Comments
 (0)