Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.5.15 display problem in webstorm terminal #522

Closed
oroz-vip opened this issue Nov 21, 2023 · 16 comments
Closed

v1.5.15 display problem in webstorm terminal #522

oroz-vip opened this issue Nov 21, 2023 · 16 comments
Labels
bug Something isn't working

Comments

@oroz-vip
Copy link

os: windows 10
clink version: v1.5.15

description:
I use cmder as my local terminal client. It provide a method to intergate to webstorm/vscode,see official link.

Before clink update to v1.5.15,it is normal.Clink version is v1.5.13.Everytime i update clink, i make a git commit and tag,so i'm sure v1.5.13 is ok.

After updating from version 1.5.13 to 1.5.15, I encountered an issue where there is a discrepancy between the displayed content and the input.

look at the gif
clink-issue

@chrisant996
Copy link
Owner

@oroz-vip Thanks for reporting this.

When reporting an issue, please include the following which saves time by answering in advance the usual questions:

  • Please describe what was expected to happen.
  • Please describe what actually happened.
  • Please include the output from clink info and clink set.
  • Please include the clink.log file (the location is reported by clink info).

In the meantime, I'll try to see if I can reverse engineer what combination of settings experiences the problem.

@chrisant996 chrisant996 added the bug Something isn't working label Nov 21, 2023
@chrisant996
Copy link
Owner

@oroz-vip In addition to uploading output from clink set and clink info, can you also please run clink set debug.log_terminal true, then reproduce the problem, then upload the clink.log file here?

I'm not able to find what combination of settings leads to the problem. The debug.log_terminal setting will capture the exact output so that I can both replay it and inspect it.

@alibutt30
Copy link

Hello @chrisant996
I was also getting the same problem after clink update to the newest version.

I upload all the files you requested. The only difference is : I am using IntelliJ (which is basically the IDE similar to Webstrom , both developed by JetBrains).

One small thing I noticed was : for me only git commands are producing the error. If you need any more logs please feel free to ping me.

clink_info.txt
clink_set.txt
clink.log

@bariod
Copy link

bariod commented Nov 21, 2023

Something similarly odd happens in VSCode (using cmder):
image
Input was git status.

@chrisant996
Copy link
Owner

@oroz-vip @alibutt30 @bariod Thanks for the debugging help!

Can you try two things?

  1. Does the problem stop if you run clink set color.suggestion sgr 38;5;239?
  2. If not, then does the problem stop if you run clink set color.suggestion sgr 90?

I think the terminal that you're using doesn't support 24 bit color escape sequences. It's fine to not support them. I made a mistake by making Clink try to use modern escape sequences.

But the terminal you're using also has a bug in its escape code interpreter, and the terminal itself is malfunctioning when it encounters an escape sequence it doesn't recognize -- that's why the input display becomes garbled. That's definitely a bug in the terminal, because the ECMA 48 spec on escape sequences is very clear about how to correctly handle even unrecognized escape sequences.

But even if the terminal correctly ignored unrecognized escape sequences, the colors would be wrong because the terminal doesn't support modern color escape sequences -- and it's perfectly reasonable for a terminal to omit support for those.

I have to revert the feature where Clink auto-detects whether the console is using a Light or Dark color theme, and automatically chooses an appropriate muted color for the auto-suggestions.

@bariod
Copy link

bariod commented Nov 21, 2023

Only the latter seems to work.
sgr 38;5;239:
1
sgr 90:
2

@chrisant996
Copy link
Owner

@bariod Thanks, then the garbling is definitely due to a bug in the WebStorm terminal. But it's still Clink's fault, because on any terminal that correctly ignored codes the terminal doesn't support then the color just wouldn't get set at all.

A fix is coming soon.

@chrisant996
Copy link
Owner

chrisant996 commented Nov 21, 2023

@bariod @oroz-vip @alibutt30 Some additional questions:

  • What version of Cmder are you using?
  • What version of Windows are you using?
  • What version of VSCode are you using?
  • Are you using ANSICON as well? (ANSICON should not be used in Windows 10 or higher; I can explain further if needed.)

I am unable to reproduce the problem in VSCode or Cmder or ConEmu, even with the provided clink settings, on Windows 10. The log file shows that the output is all correct, so the terminal itself is garbling the display.

@alibutt30 The clink set output you shared has autosuggest.enable turned off. Can you share more details about what you do and what happens? Can you share a screenshot of what error you see when using git commands? What's a specific git command that experiences a problem? Since you don't have the autosuggest feature turned on, I'm not sure that what you're experiencing is the same as what others are experiencing. There may be additional troubleshooting needed.

UPDATE: Sigh. There was already a clink.set.txt file in my Downloads folder. I accidentally used that instead of the clink_set.txt file that you uploaded. But, even after using the correct settings file, I still can't reproduce the problem.

@alibutt30
Copy link

@chrisant996

The setting you told really solved my problem too. clink set color.suggestion sgr 90.
cmder version: 1.3.24.236
windows version: 10.0.19045
intellij version: IntelliJ IDEA 2023.2.5
ANSICON -- I do not know about that.

Some insights to my problem were that whenever I wrote git pull the cmder automatically substituted it with ;;t pull and if i press enter the command executed successfully even after this 😄 All git commands were doing like this. I unfortunately cannot share the screenshot. Could you please guide me how to revert the settings back if you need a screenshot ? and also if you need more logs please feel free to ask me and I can provide you with those.

@chrisant996
Copy link
Owner

chrisant996 commented Nov 21, 2023

@alibutt30 Thanks, yes, I want to figure out how it's happening for you. You have autosuggest.enable turned off, but it's trying to use a color that's only used in that feature. That smells like there's a bug somewhere there... 🙃

UPDATE: Sigh. There was already a clink.set.txt file in my Downloads folder. I accidentally used that instead of the clink_set.txt file that you uploaded. But, even after using the correct settings file, I still can't reproduce the problem.

To revert the setting, you can run clink set color.suggestion clear.

@bariod
Copy link

bariod commented Nov 22, 2023

@bariod @oroz-vip @alibutt30 Some additional questions:

* What version of Cmder are you using?

* What version of Windows are you using?

* What version of VSCode are you using?

* Are you using ANSICON as well?  (ANSICON should not be used in Windows 10 or higher; I can explain further if needed.)

I am unable to reproduce the problem in VSCode or Cmder or ConEmu, even with the provided clink settings, on Windows 10. The log file shows that the output is all correct, so the terminal itself is garbling the display.

@alibutt30 The clink set output you shared has autosuggest.enable turned off. Can you share more details about what you do and what happens? Can you share a screenshot of what error you see when using git commands? What's a specific git command that experiences a problem? Since you don't have the autosuggest feature turned on, I'm not sure that what you're experiencing is the same as what others are experiencing. There may be additional troubleshooting needed.

VS Code: 1.84.2
Win: 10 (19045.3693)
Cmder: 1.3.20.1282 (might need to update ^^) // ConEmu is already 230724 (latest)
ANSICON: N/A

@alibutt30
Copy link

@chrisant996

thanks, This is how it looks when i set the color off. If you need more log files please let me know which ones?
image

@chrisant996
Copy link
Owner

chrisant996 commented Nov 22, 2023

@bariod @alibutt30 @oroz-vip Thanks for continuing to help investigate this.

I'm using:

  • Clink 1.5.15.2528fa
  • Win 10 19045.3693
  • VSCode 1.84.2
  • Cmder 1.3.24
  • Freshly installed IntelliJ IDEA 2023.2.5 build #IU-232.10227.8
  • The clink settings from the clink_set.txt file that was uploaded
  • No .inputrc file
  • Current directory is c:\repos\clink, which is my local copy of the Clink repo

I cannot reproduce any of the problems.

Note: earlier I had accidentally used a clink.set.txt file already in my Downloads folder, instead of the clink_set.txt that you uploaded. But, even after using the correct clink_set.txt file, I still cannot reproduce the problems. The colors and etc match your screenshot.

image

Would you be willing to capture a Time Travel Debugging trace of the problem, upload it somewhere (e.g. in a password protected .zip file), and send a link to the file to sparrowhawk996 at gmail.com?

A Time Travel Debugging trace will capture everything that's happening, and make it easy to find out how Clink is showing (garbled) auto-suggestions even when the auto-suggestions feature is disabled. (Or maybe it's really enabled, and the clink_set.txt file was from a different profile or something.)

  1. Download and install WinDbg Preview
  2. Start the terminal window with Cmder and Clink
  3. Make sure the problem can still be reproduced (if not, downgrade to Clink v1.5.15 and run clink set color.suggestion clear, and close the terminal window, and go back to step 2)
  4. Press Ctrl-XCtrl-Z and note the "session" number
  5. Follow the directions at Time Travel Debugging - Record a trace - Attach to a process and attach to the cmd.exe process ID that matches the "session" number from earlier
  6. Do the steps to reproduce the problem where the display glitches
  7. End the Time Travel Debugging trace and upload it somewhere, and send me a link to the file.

@alibutt30
Copy link

@chrisant996

Not to keep you hanging. I would provide you with the logs from Travel Debugging. Please give me some time. maybe in 1-2 days. I hope that is fine.

Thank,

@chrisant996
Copy link
Owner

#524 has interesting new info -- the problem may be related to either the pixel width of the terminal, or may be related to the character width of the terminal. If the terminal's output buffers aren't big enough, then they may accidentally split escape codes. Since the hyperlink escape code is naturally long, it is statistically more likely for a buffer boundary to split that escape code.

@oroz-vip
Copy link
Author

oroz-vip commented Dec 6, 2023

Sorry, I haven't been using the computer during this time. When I came online and saw the messages, you had already resolved the issue. That's really great! Thumbs up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants