Skip to content

Commit

Permalink
Working on fixing Issue xtermjs#3293
Browse files Browse the repository at this point in the history
Signed-off-by: Arup Chauhan <[email protected]>
  • Loading branch information
Arup-Chauhan committed Aug 25, 2024
1 parent f186475 commit e77eb04
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .hintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": [
"development"
],
"hints": {
"no-inline-styles": "off"
}
}
5 changes: 5 additions & 0 deletions src/browser/public/Terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export class Terminal extends Disposable implements ITerminalApi {
this._core = this._register(new TerminalCore(options));
this._addonManager = this._register(new AddonManager());

// Store user's cursor style
this._core.options.userCursorStyle = this._core.options.cursorStyle;



this._publicOptions = { ... this._core.options };
const getter = (propName: string): any => {
return this._core.options[propName];
Expand Down
4 changes: 4 additions & 0 deletions src/common/InputHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2734,6 +2734,10 @@ export class InputHandler extends Disposable implements IInputHandler {
public setCursorStyle(params: IParams): boolean {
const param = params.params[0] || 1;
switch (param) {
case 0:
console.log('Case 0 triggerd');
this._optionsService.options.cursorStyle = this._optionsService.options.userCursorStyle || 'block';
break;
case 1:
case 2:
this._optionsService.options.cursorStyle = 'block';
Expand Down
38 changes: 38 additions & 0 deletions test_file.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>xterm.js Test</title>
<script src="./node_modules/@xterm/xterm/lib/xterm.js"></script>
<link rel="stylesheet" href="./css/xterm.css">
<script>
console.log('Script is running');
const terminal = new Terminal({
cursorStyle: 'underline', // Custom user-defined cursor style
});

const userCursorStyle = terminal.options.cursorStyle;
console.log('User Cursor Style:', userCursorStyle); // Print the value of userCursorStyle

document.addEventListener('DOMContentLoaded', function() {
console.log('DOM fully loaded and parsed');
terminal.open(document.getElementById('terminal'));
console.log('Sending control sequence as given 1');
terminal.write('\x1b[5 q');
console.log('User Cursor Style:', userCursorStyle);
console.log('Current Style:', terminal.options.cursorStyle);

terminal.focus();
console.log('Sending control sequence as given 2');
terminal.write('\x1b[0 q');
console.log('User Cursor Style:', userCursorStyle);
console.log('Current cursor style', terminal.options.cursorStyle)
terminal.focus();
});
</script>
</head>
<body>
<div id="terminal" style="height: 100%; width: 100%;"></div>
</body>
</html>

0 comments on commit e77eb04

Please sign in to comment.