vscode-matlab-interactive-terminal icon indicating copy to clipboard operation
vscode-matlab-interactive-terminal copied to clipboard

When type direction key"↑","↓", "→","←", it will show "^[[A", "^[[B", "^[[D", "^[[C"

Open ycliu2020 opened this issue 4 years ago • 8 comments

As is title show, type Backspace and Tab key are ok, direction key and Esc will show symbol like "[*". Let me clear, my platform is ubuntu, and other shell/temeriels are all normal. only in matlab-interactive-terminal problem happened.

ycliu2020 avatar Sep 27 '20 07:09 ycliu2020

Thank you for your feedback. I cannot reproduce it however. As I use the VS Code API for Terminal, I am afraid I have little control over this behavior. I had something in the work using pseudo-terminal, but I have been quite busy lately.

apommel avatar Oct 11 '20 07:10 apommel

The same error also happened on my ubuntu. However, I tried to create a new normal terminal, and run matlab -nojvm -nodesktop -nodisplay -r <MatlabScriptName>. When the script run over, the terminal turned to MATLAB, and there was no strange sysmbol when typing direction keys. Maybe this method help debug, or just temporarily replace the Matlab REPL Terminal before bug fixed?

WigarWang avatar Feb 20 '21 14:02 WigarWang

Yes, this method works on Linux system but I deliberately did not use it because it is not compatible with Windows. I believe other extensions for VS Code use this to create a REPL however.

apommel avatar Feb 20 '21 17:02 apommel

I had the same problem on my macOS.

Matlab 2017b macOS 10.12.6 vs code 1.60.1 Matlab Interactive Terminal 0.4.0

newxiumu avatar Sep 16 '21 05:09 newxiumu

This is the problem with Python shell. Simply add this line at the top of ml_terminal.py can solve it

import readline

If you don't have readline, pip install it.

Two ml_terminal.pys are located at ~/.vscode/extensions/apommel.matlab-interactive-terminal-0.4.0/interfaces/standard/ml_terminal.py and /Users/ce/.vscode/extensions/apommel.matlab-interactive-terminal-0.4.0/interfaces/unicode/ml_terminal.py

zcysxy avatar Apr 04 '22 08:04 zcysxy

This is the problem with Python shell. Simply add this line at the top of ml_terminal.py can solve it

import readline

If you don't readline, pip install it.

Two ml_terminal.pys are located at ~/.vscode/extensions/apommel.matlab-interactive-terminal-0.4.0/interfaces/standard/ml_terminal.py and /Users/ce/.vscode/extensions/apommel.matlab-interactive-terminal-0.4.0/interfaces/unicode/ml_terminal.py

Hi @apommel, I believe this can solve the problem on macOS and Linux, but I don't know if it's compatible with Windows. If it is, we can make a pull request on this.

zcysxy avatar Apr 04 '22 08:04 zcysxy

From the feedback I had and my experience, this issue does not exist on Windows. @zcysxy In this case, you may implement this change in a PR and import the module only if the user is on MacOS or Linux system. You can also add a check so that if the module is not installed it still works as it does currently, and I believe we could then consider this issue as solved.

Thank you very much!

apommel avatar Apr 04 '22 09:04 apommel

This is the problem with Python shell. Simply add this line at the top of ml_terminal.py can solve it

import readline

If you don't have readline, pip install it.

Two ml_terminal.pys are located at ~/.vscode/extensions/apommel.matlab-interactive-terminal-0.4.0/interfaces/standard/ml_terminal.py and /Users/ce/.vscode/extensions/apommel.matlab-interactive-terminal-0.4.0/interfaces/unicode/ml_terminal.py

Add these file that need import readline to be appended for Linux/Macos, ~/.vscode/extensions/apommel.matlab-interactive-terminal-0.4.0/interfaces/standard/ml_terminal.py ~/.vscode/extensions/apommel.matlab-interactive-terminal-0.4.0/interfaces/unicode/ml_terminal.py ~/.vscode/extensions/apommel.matlab-interactive-terminal-0.4.0/interfaces/standard/ml_script.py ~/.vscode/extensions/apommel.matlab-interactive-terminal-0.4.0/interfaces/unicode/ml_script.py ~/.vscode/extensions/apommel.matlab-interactive-terminal-0.4.0/interfaces/standard/ml_selection.py ~/.vscode/extensions/apommel.matlab-interactive-terminal-0.4.0/interfaces/unicode/ml_selection.py This insures that all the matlab termials that are open in vscode, will accept the arrow inputs

James712346 avatar Jun 02 '22 23:06 James712346