xtermjs / xterm.js

A terminal for the web
https://xtermjs.org/
MIT License
17.52k stars 1.62k forks source link

Working on fixing Issue #3293 #5137

Open Arup-Chauhan opened 1 month ago

Arup-Chauhan commented 1 month ago

@Tyriar Hi, I was working on #3293 and for that I have done the following things and created this draft PR to discuss.

Here are some changes I made:

  1. Terminal.ts:

    • I added logic to save the custom cursor style (userCursorStyle) when the terminal initializes. This ensures that the terminal keeps my preferred cursor style even when control sequences are sent.
  2. InputHandler.ts:

    • I adjusted the setCursorStyle function to apply userCursorStyle when handling the reset cursor style sequence (\x1b[0 q). I also included some console log statements to help debug the cursor style changes.

Possible Issue with Control Sequences:

While testing, I noticed something off with how the control sequences are being processed. Specifically, the output logs don't match the expected behavior.

Current Log Outputs:

Script is running
User Cursor Style: underline
DOM fully loaded and parsed
Sending control sequence as given 1
User Cursor Style: underline
Current Style: underline
Sending control sequence as given 2
User Cursor Style: underline
Current cursor style: underline

Expected Log Outputs:

Script is running
User Cursor Style: underline
DOM fully loaded and parsed
Sending control sequence as given 1
User Cursor Style: underline
Current Style: bar
Sending control sequence as given 2
User Cursor Style: underline
Current cursor style: underline

Am I testing / emulating the xterm terminal properly? The current output suggests that the control sequences may not be applied correctly, particularly when resetting the cursor style. This might need a closer look to figure out what's going on.

Help would be appreciated.