Title: Make Clear-Host clear the scrollback buffer too on all platforms · Issue #8606 · PowerShell/PowerShell · GitHub
Open Graph Title: Make Clear-Host clear the scrollback buffer too on all platforms · Issue #8606 · PowerShell/PowerShell
X Title: Make Clear-Host clear the scrollback buffer too on all platforms · Issue #8606 · PowerShell/PowerShell
Description: Update: The decision in #8603 to rely on Console.Clear() amounts to inconsistent behavior across platforms, for no good reason (there's no native behavior that needs to be emulated; native behavior, if desired, is accessible via the exte...
Open Graph Description: Update: The decision in #8603 to rely on Console.Clear() amounts to inconsistent behavior across platforms, for no good reason (there's no native behavior that needs to be emulated; native behavior...
X Description: Update: The decision in #8603 to rely on Console.Clear() amounts to inconsistent behavior across platforms, for no good reason (there's no native behavior that needs to be emulated; native beha...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/8606
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Make Clear-Host clear the scrollback buffer too on all platforms ","articleBody":"_Update_:\r\n\r\nThe decision in #8603 to rely on `Console.Clear()` amounts to inconsistent behavior across platforms, for no good reason (there's no native behavior that needs to be emulated; native behavior, if desired, is accessible via the external `clear` utility).\r\n\r\nIf there's consensus that the desired behavior is to consistently clear the screen _and_ the scrollback buffer on all platforms, we have two options:\r\n\r\n* Wait for `Console.Clear()` to be fixed, if ever - see https://github.com/dotnet/corefx/issues/34463\r\n\r\n* Roll our own solution in PowerShell [in the meantime].\r\n\r\nThe original proposal below was written under the assumption that platform-dependent behavior was intended, and therefore suggested an opt-in mechanism.\r\n\r\n# Summary of the new feature/enhancement\r\n\r\nImplement a switch named `-All` to direct `Clear-Host` to clear not only the current screen of terminal (console) hosts but to clear the scrollback buffer (the output history) as well.\r\n\r\n`Clear-Host` now uses `[Console]::Clear()` (see #8603), which results in platform-specific behavior:\r\n\r\n* Unix-like platforms: clears the current screen (terminal-window content) only.\r\n* Windows: clears the current screen _and_ the scroll-back buffer.\r\n\r\nThat is, also clearing the scrollback buffer is invariably implied on Windows, whereas it is currently unavailable on Unix-like platforms.\r\n\r\nImplementing `-All` would allow users to at least opt into a consistent cross-platform experience, e.g. via a user-defined function such as `function clsa { Clear-Host -All }`.\r\n\r\nNote: As before, this means that in the Windows console you do not have the option to selectively clear the current screen only, without erasing the scrollback buffer.\r\n\r\n# Proposed technical implementation details (optional)\r\n\r\nIf `-All` is specified:\r\n\r\n* on Windows: do nothing, because clearing the scrollback buffer is _invariably_ performed anyway.\r\n* on Unix-like platforms, execute ``$host.ui.Write(\"`e[3J\")`` after `[Console]::Clear()` to also clear the scrollback buffer.\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2019-01-08T11:30:46Z","url":"https://github.com/PowerShell/PowerShell/issues/8606"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ff99b523-e700-8989-02b3-1ca3bb459477 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CDC8:31E3B3:1E0304:28CD39:6AFD4FEE |
| html-safe-nonce | 2d77ff48fa6214c628ae9265c308fbc110aec3ee97f579fefa6165eae1e92e09 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDREM4OjMxRTNCMzoxRTAzMDQ6MjhDRDM5OjZBRkQ0RkVFIiwidmlzaXRvcl9pZCI6IjYzMTAxNjA3NjA0NjI3MjUxMDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 008d16cf59c3b57c5c79850f248e046d9f42404863c3aea04252bf16b39cbe8e |
| hovercard-subject-tag | issue:396865797 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/8606/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f1a303df09e79c8cc8408c940ea8a9de9c8cd5650f7488571811368cbc9f51d6/PowerShell/PowerShell/issues/8606 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f1a303df09e79c8cc8408c940ea8a9de9c8cd5650f7488571811368cbc9f51d6/PowerShell/PowerShell/issues/8606 |
| og:image:alt | Update: The decision in #8603 to rely on Console.Clear() amounts to inconsistent behavior across platforms, for no good reason (there's no native behavior that needs to be emulated; native behavior... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mklement0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b6f01f7cb9f35f8c09949773241a3d49dd04b340 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width