ClearScreen should clear scrollback buffer as well, or PSReadLine should implement ClearDisplay

Open
#4,626 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp, powershell
Domain
cli

Research direction

Start by locating the existing ClearScreen entry point and the terminal-handling code in PSReadLine. Compare the requested clear-display behavior with the current screen-only behavior, then verify that the screen and scrollback are cleared or that an equivalent ClearDisplay command is available.

Written by the indexing model from the issue text.

Description

Issue-Enhancement Needs-Triage :mag:
Prerequisites
  • Write a descriptive title.
Description of the new feature/enhancement

The GNU readline has clear-display command since version 8.1, about four years.

clear-display (M-C-l)

Clear the screen and, if possible, the terminal’s scrollback buffer, then redraw the current line, leaving the current line at the top of the screen.

clear-screen (C-l)

Clear the screen, then redraw the current line, leaving the current line at the top of the screen.

Clearing only screen without scrollback is rather useless, as it is garbled with old junk from previous commands.

There is a question on Super User, with answer suggesting to rebind Ctrl-L to a script executing cls command. This is very inefficient, if not say more.

So, PSReadLine ClearScreen should clear scrollback too, or it should implement ClearDisplay as well.

Proposed technical implementation details (optional)

Please don't do it the way libvte does - there is no excuse for them to do it that way.

Dominant language
C#
Stars
4.4k
Forks
341
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PowerShell/PSReadLine

All issues in PowerShell/PSReadLine

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.