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

The new terminal (v6.3.0) is destroying current process on Ctrl-L #820

Open
adayoung opened this issue Dec 13, 2024 · 7 comments · May be fixed by #823
Open

The new terminal (v6.3.0) is destroying current process on Ctrl-L #820

adayoung opened this issue Dec 13, 2024 · 7 comments · May be fixed by #823

Comments

@adayoung
Copy link

What Happened?

The elementary terminal (v6.2.0) used to work fine and pressing Ctrl-L in it would clear the screen as expected of a terminal. The new terminal released two days ago (v6.3.0) still clears the screen but kills the current process in doing so. So if I'm logged in with SSH to a remote machine, pressing Ctrl-L kill the SSH session and drops me in the / path on my local system.

Steps to Reproduce

  1. Open elementary terminal
  2. Type ls or any command. Heck, even switch to root with sudo su -. Or SSH into some remote machine
  3. Press Ctrl-L, watch the session die, watch the screen clear, watch the current working directory switch to /

Expected Behavior

Pressing Ctrl-L should clear the screen only and it should NOT kill the current process or change the current working directory.

OS Version

7.x (Horus)

Session Type

Classic Session (X11, This is the default)

Software Version

Latest release (I have run all updates)

Log Output

Using `G_MESSAGES_DEBUG=all io.elementary.terminal -n` does not produce any logs :-(

Hardware Info

No response

@adayoung
Copy link
Author

It looks like #778 is the culprit in this one too 🙂

@teamcons
Copy link
Contributor

Present in 8 with Wayland.

Sleep 20
Ctrl+L
resets the whole terminal, changes CWD to /

@adayoung
Copy link
Author

adayoung commented Dec 13, 2024

From the discussion here on askubuntu and the reference here in readline's manual, it looks like Ctrl-L is interpreted by bash and things like IPython (and whatever uses readline) to clear the screen. The latest release of elementary terminal overrides that and consequently breaks the existing functionality for everyone 🙁

@rezk2ll
Copy link

rezk2ll commented Dec 16, 2024

i have the same issue:

elementary OS 7.1 Horus
io.elementary.terminal: 6.3.0

I reverted back to 6.1.1

@jeremypw
Copy link
Collaborator

I think the problem is that the Clear Screen action uses the clear -x command which it runs in the current terminal. This stops any existing program from running. I'm not sure it is possible to clear the screen while keeping a program is running in it (except via that program). The easiest solution is to ignore or disable the clear (and reset) actions while there is a foreground process running. Another possible solution is to throw a confirmation dialog in a similar way to when an attempt to close a tab containing a running foreground process. The accelerators would still be consumed so not available for the foreground process so any clash with a popular terminal program needs to be flagged up.

@jeremypw jeremypw linked a pull request Dec 16, 2024 that will close this issue
4 tasks
@adayoung
Copy link
Author

The easiest solution is to ignore or disable the clear (and reset) actions while there is a foreground process running.

This will still break Bash's handling of Ctrl-L. The current implementation of Ctrl-L in the elementary terminal destroys background jobs as well. Here, try this to reproduce the case:

  1. Open elementary terminal (v6.3.0)
  2. Launch something in the background, like sleep 300 &
  3. Check background jobs with jobs
  4. Hit Ctrl-L, watch the session die, watch the current working directory change to /
  5. Check background jobs with jobs again, the list is empty. Our background process is gone!

The accelerators would still be consumed so not available for the foreground process so any clash with a popular terminal program needs to be flagged up.

Eep eep eating up the Ctrl-L combination and not letting it reach the foreground program isn't any better. It will break a lot of programs that use the readline library for handling input. This includes Bash, IPython, nano, Ruby shell, Scala shell, and possibly a lot of other repl environments that depend on it.

Please either let us disable or redefine the keyboard accelerators in terminal instead if possible.

The terminal is a most excellent (and beautiful) piece of work otherwise 🙂

@jeremypw
Copy link
Collaborator

I have now changed the hotkeys for the clear and reset actions to be <Shift><Control>K , <Shift><Control>L Hopefully this will prevent or minimise clashes with foreground processes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants