platformio / platformio-atom-ide-terminal

A terminal package for Atom, complete with themes, API and more for PlatformIO IDE
https://atom.io/packages/platformio-ide-terminal
MIT License
612 stars 162 forks source link

macOS (CTRL + L) does not work reliably to clear terminal content. #652

Open ghost opened 5 years ago

ghost commented 5 years ago

Steps to reproduce

  1. Type something in the command line whether get output or not.
  2. Press ctrl + l to clear the screen.
  3. Screen clear failed, cursor was removed.
  4. Press any key, the cursor show up and interact with the key just typed in, and the screen was cleared.

Expected behavior: ctrl + l should work for clearing the screen.

Actual behavior: ctrl + l did not clear the screen, just remove the cursor.

Reproduces how often: Every time.

Versions

> atom --version
Atom    : 1.34.0
Electron: 2.0.16
Chrome  : 61.0.3163.100
Node    : 8.9.3
> apm --version
apm  2.1.3
npm  6.2.0
node 8.9.3 x64
atom 1.34.0
python 2.7.15
git 2.17.2

OS name and version: macOS Mojave 10.14 Platformio-ide-terminal version: 2.9.0

the-j0k3r commented 5 years ago

Please clarify and fill in the template properly. You removed key sections from the issue template, Please fill in all areas. The whole information is required https://raw.githubusercontent.com/platformio/platformio-atom-ide-terminal/master/.github/ISSUE_TEMPLATE.md

ghost commented 5 years ago

Steps to reproduce

  1. Type something in the command line whether get output or not.
  2. Press ctrl + l to clear the screen.
  3. Screen clear failed, cursor was removed.
  4. Press any key, the cursor show up and interact with the key just typed in, and the screen was cleared.

Expected behavior: ctrl + l should work for clearing the screen.

Actual behavior: ctrl + l did not clear the screen, just remove the cursor.

Reproduces how often: Every time.

the-j0k3r commented 5 years ago

Thank you for filling in the information.

Seems weird though that in macOS you are mentioning ctrl and not cmd so Im unsure if this is a bug report or a feature request.

A look around doesnt show ctrl+l mapped to clear in platformio-ide-terminal,

I did find the command platformio-ide-terminal:clear but that destroys the terminal and recreates one https://github.com/platformio/platformio-atom-ide-terminal/blob/680b6e24787537b75bfdb376975e5ac178e0dde7/lib/status-bar.coffee#L329-L331

Also ctrl + l keymap is taken by Atom. capture

Some clarification needed below.

The ctrl + l doesn't work for me for it does not refresh the command line after clear, and need another type to make that shell refresh. It is the same to python in that shell, but not for ghci.

I also have no idea what you meant by It is the same to python in that shell or ghci,

Thx.

Edit: Related to #488

ghost commented 5 years ago

Sorry for my poor expression. ctrl + l is always the shortcut for clearing the screen (old contents move up from screen, pop up a new line, kinda like enter in normal terminal) in the terminals I've ever tried (which is equal to clear in usage), so I wonder if I can use that standard command in platformio-ide-terminal.

The problem is, platformio-ide-terminal seems to have some refreshing problem with that. That is, ctrl + l should do two things (I assume the two steps, I don't really know about the mechanism in terminal)

  1. Push old contents to upper space (out of window of terminal).
  2. Add a new line, new cursor shows up.

It seems that platformio-ide-terminal gets stuck before step 1, the cursor disappear entering ctrl + l. But when type any thing in, it just jumps to the point after step2. It would be easier to explain my problem if I can record a gif with my command.

I've searched #488 find it is just a brief expression of mine.

Then, python and ghci or ipython by my words are interpreters can be opened in platformio-ide-terminal which are also capable of using ctrl + l to clear screen in normal terminal (i.e iterm2). And I find these different interpreters perform differently in platformio-ide-terminal.

Note that this is a bug report though it may have nothing to do with platformio-ide-terminal(maybe I think).

Thanks.

the-j0k3r commented 5 years ago

Sorry for my poor expression. ctrl + l is always the shortcut for clearing the screen (old contents move up from screen,

In macOS there is no ctrl key which is part of my confusion shouldnt in your case be cmd + l?

Im going to test this in Windows 10 PRO 1803.

This is how ctrl + l it works on regular powershell.

ctrl lterm

So I think its working except it wont actually clear what you typed unless you press Enter after and then ctrl + l this works 100%.

In platformio-ide-terminal behaves exactly the same way.

ctrl lterm

So how does the command platformio-ide-terminal:clear work for you? Does it satisfy your need?

Related information

See #426

platformio-ide-terminal uses and depends on term.js which is a project thats has been abandoned now for 3/4 years, its bugged, and some of these bugs could be related to that. For instance newer terminals use xterm.js and are more robust and compatible with native shells and terminals.

ghost commented 5 years ago

Thanks for explaining.

It has nothing to do with platformio-ide-terminal:clear (this is a window close command) or macOS's cmd or ctrl (ctrl + l on unix also means clear). ctrl + l by my words is perhaps the cmd + l in your opinion. Ignoring that misleading word, I mean that there is a "ctrl + l-like" bug on my platformio-ide-terminal and it may be related to #426 .

I've recorded two gifs for explanation.

Above this the keyboard follows, there is a time period that cursor disappeared.

  1. pwd then enter
  2. ctrl + l (it got stuck)
  3. cd .. then enter(it seems to finish refreshing work on c)

And the second gif shows the behaviour the platformio-ide-terminal should have with a replacement of clear.

The clear mentioned above may not be a good example, since I use clear + enter to make it refresh that command line. But it do demonstrate the meaning as it refresh it successfully.

the-j0k3r commented 5 years ago

It has nothing to do with platformio-ide-terminal:clear

I know it not the same, but it exists and works. You have it in context menu and on command menu.

capture

(this is a window close command)

Its actually a destroy and recreate terminal command see the actual code.

https://github.com/platformio/platformio-atom-ide-terminal/blob/680b6e24787537b75bfdb376975e5ac178e0dde7/lib/status-bar.coffee#L329-L331

Basically, what I want to know is, will platformio-ide-terminal:clear work as a replacement for your immediate needs or not.

If it does Ill consider adding 'ctrl-alt-l': 'platformio-ide-terminal:clear'

If its a no answer, then this issue will remain open forever until someone updates term'js to xterm.js because #543 also which means any fixes/features are community generated,

In Windows however it works well enough, haven't tried Linux yet, but for me typing a clear command is faster than pressing some shortcut.

You have several alternatives.

1) use platformio-ide-terminal:clear 2) type clear and press Enter 3) use another terminal like the one in atom-ide-ui which is already xterm.js based. 4) implement xterm.js in this project.

ghost commented 5 years ago

If it does Ill consider adding 'ctrl-alt-l': 'platformio-ide-terminal:clear'

In response to that, clearly in the view of mine, destroy the old and create a new session is unacceptable. We use clear to do some screen scrolling in order to reach a greater visual effect and make it handy to type new things, sometimes may scroll down back again to check some ouput. But session destroy remove the content and may cause some temporary command session settings reset.

Thanks for friendly and warm response.

the-j0k3r commented 5 years ago

Yw =)

Sorry that doesnt suit your usage, I do see that 'platformio-ide-terminal:clear' is too evasive a method, If I ever come up with something else, I'll ping back.

the-j0k3r commented 5 years ago

I have tested this in actual macOS mojave 10.14.2 and works by pressing key combo twice, not ideal, but considering this is using old not maintained term.js, dont expect any fixes to this unless someone adds xterm.js support instead.

ghost commented 5 years ago

O(∩_∩)O~~

chornge commented 4 years ago

I have tested control + L on macOS catalina 10.15.2 and it works as expected.