Skip to content

Commit

Permalink
Ignore clear screen action if terminal has foreground process
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Wootten authored and Jeremy Wootten committed Dec 16, 2024
1 parent 4e4ea8c commit c177232
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/Widgets/TerminalWidget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -529,14 +529,15 @@ namespace Terminal {
}

private void action_clear_screen () {
if (confirm_kill_fg_process (
_("Are you sure you want to clear the screen?"),
_("Clear Screen"))
) {
// Should we clear scrollback too?
// We know there is no foreground process so we can just feed the command in
feed_child ("clear -x\n".data);
if (has_foreground_process ()) {
// We cannot guarantee the terminal is left in sensible state if we
// kill foreground process so ignore clear screen request
return;
}

// We keep the scrollback history, just clear the screen
// We know there is no foreground process so we can just feed the command in
feed_child ("clear -x\n".data);
}

private void action_reset () {
Expand Down

0 comments on commit c177232

Please sign in to comment.