Skip to content

Out-Host -Paging does not pause on long strings or clean up after itself #7851

@vexx32

Description

@vexx32

Per the comment on #4962, paging was at some point intended to be fixed by 6.1.0 -- this is not the case, as such.

Checking the contents of $function:help indicates that some effort was made for the help system specifically (it utilises less on Linux, and more.com on Windows), but Out-Host -Paging does... nothing, in those cases (long strings of text aren't interrupted to page, etc.)

It does work with lengthy sequences of objects, but even there the paging is... not at all pretty. Unlike how more or less function, it leaves... useless prompt strings in the host display after they've been skipped past, duplicates the prompt after the first full page, and overall doesn't make enough of an effort to distinguish itself from the rest of the output, in my opinion. Image is below; partial host output from a call to gci c:\ -recurse -depth 2 | out-host -paging

image

Out-Host -Paging should mimic the behaviour of more and less. As this unfortunate soul discovered more.com does have cases where it completely breaks non-Latin character encodings (though it is perfectly capable of reading them from a file).

And, arguably, the more function should return as a function that simply maps to Out-Host -Paging

Steps to reproduce

# windows
gci c:\ -recurse -depth 2 | out-host -Paging

Expected behavior

similar behaviour to more.com or less

Actual behavior



    Directory: C:\


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         7/1/2018  12:33 AM                8336500659725115574
da----        8/16/2016   4:57 PM                adb
d-----        9/16/2018   6:40 PM                AMD
da----         9/9/2016  11:27 AM                Android
d-----        9/24/2015   5:38 PM                EFI
d-----         4/7/2018   6:39 PM                ESD
d-----        3/16/2015   1:35 AM                Intel
d-----         5/3/2018   6:48 PM                Logs
d-----        9/27/2015  11:57 PM                My Backups
d-----         9/8/2018   5:23 AM                PerfLogs
d-r---        9/16/2018   6:39 PM                Program Files
d-r---        9/16/2018   6:39 PM                Program Files (x86)
d-----        3/17/2015   9:12 PM                Python34
d-----         9/4/2017   8:34 PM                Ruby24-x64
d-----         7/6/2018   1:23 PM                test
d-r---        9/16/2018   6:39 PM                Users
d-----       11/29/2016  12:32 AM                VIA_XHCI
d-----        9/16/2018   6:46 PM                Windows
d-----        9/16/2018   6:48 PM                Windows.old
d-----         6/1/2018  12:28 AM                Windows.old(1)
-a----        3/17/2015   5:49 AM        4194304 BIOS.17.03.15.bak
-a----         4/6/2018   6:05 PM          17005 PS5.1help.csv
-a----         4/6/2018   6:04 PM           5535 PSCoreHelp.csv
-a----         4/6/2018   6:22 PM            328 WinPSTopics.txt


    Directory: C:\adb


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        10/9/2015   5:58 PM         944128 adb.exe
-a----        10/9/2015   5:58 PM          96256 AdbWinApi.dll
-a----        10/9/2015   5:58 PM          60928 AdbWinUsbApi.dll
-a----        10/9/2015   5:58 PM         318464 fastboot.exe


    Directory: C:\AMD


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
<SPACE> next page; <CR> next line; Q quit
d-----         2/4/2018  11:12 AM                Packages
<SPACE> next page; <CR> next line; Q quit
d-----       12/12/2017   8:43 PM                PPC
<SPACE> next page; <CR> next line; Q quit
d-----         2/4/2018  11:12 AM                radeon-software-adrenalin-18.2.1-minimalsetup-180201_64bit
<SPACE> next page; <CR> next line; Q quit
d-----       12/12/2017   8:36 PM                Win10-64Bit-Radeon-Software-Adrenalin-Edition-17.12.1-Dec11
<SPACE> next page; <CR> next line; Q quit
d-----        9/16/2018   6:40 PM                WU-CCC2
<SPACE> next page; <CR> next line; Q quit
-a----         2/4/2018   9:20 AM           2647 atikmdag_dce.log
<SPACE> next page; <CR> next line; Q quit

<SPACE> next page; <CR> next line; Q quit

<SPACE> next page; <CR> next line; Q quit
    Directory: C:\AMD\Packages
<SPACE> next page; <CR> next line; Q quit

<SPACE> next page; <CR> next line; Q quit

<SPACE> next page; <CR> next line; Q quit

Lots of added clutter that does not clean up after itself.

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.1.0
PSEdition                      Core
GitCommitId                    6.1.0
OS                             Microsoft Windows 10.0.17758
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-No ActivityIssue has had no activity for 6 months or moreWG-Cmdletsgeneral cmdlet issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions