microsoft / microsoft/terminal

`less` with -r option causes strange display behavior for input with ANSI control characters

Open
#9,176 8 comments 0 reactions 1 assignee View on GitHub

@DHowett is already working on this.

Since Feb 17, 2021.

Area-Output Issue-Bug Needs-Attention Priority-2 Product-Terminal
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

Environment

Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd]: 10.0.19041.0
Windows Terminal version (if applicable): 1.5.10411.0

Any other software?
Ubuntu on WSL 1

Steps to reproduce

Have a long file, in this case produced with git reflog. Examine with less. Notice that output does not include the first ~10 lines.

git reflog > reflog.out
head reflog.out
5240aea1 HEAD@{0}: checkout: moving from zachmu/windows to aaron/indexed-in-subquery-filter
56ac2928 HEAD@{1}: checkout: moving from aaron/indexed-in-subquery-filter to zachmu/windows
5240aea1 HEAD@{2}: checkout: moving from zachmu/windows to aaron/indexed-in-subquery-filter
56ac2928 HEAD@{3}: checkout: moving from aaron/indexed-in-subquery-filter to zachmu/windows
5240aea1 HEAD@{4}: checkout: moving from master to aaron/indexed-in-subquery-filter
1acb0aab HEAD@{5}: pull: Fast-forward
66627818 HEAD@{6}: checkout: moving from zachmu/windows to master
56ac2928 HEAD@{7}: commit: Added some more query tests for window funcs
cb14e839 HEAD@{8}: commit: Working row_number() function
5f08c885 HEAD@{9}: commit: Semi working sort order. Moved more functions and types around to avoid cycles.

less reflog presents me with a screen that starts like this:

rtField up to the sql package and gave it some more methods.
e9c3d6d8 HEAD@{11}: commit: Added window setting to function analysis
98044728 HEAD@{12}: commit: Chalked in outline of adding all rows to a window expression. Now need a way to get Window values into the functions.
d8fcf55e HEAD@{13}: commit: Sketched out an iter
000efaba HEAD@{14}: commit: Chalked out a window node. This involved moving some Sort related types out of the plan package to the expression package
66627818 HEAD@{15}: checkout: moving from master to zachmu/windows

As you can see, the first ~10 lines of the file are not there. If I press the up arrow, less does not respond (chimes the bell). If I press the down arrow key twice, then the up arrow key twice, I see this:

5240aea1 HEAD@{0}: checkout: moving from zachmu/windows to aaron/indexed-in-subquery-filter
56ac2928 HEAD@{1}: checkout: moving from aaron/indexed-in-subquery-filter to zachmu/windows
98044728 HEAD@{12}: commit: Chalked in outline of adding all rows to a window expression. Now need a way to get Window values into the functions.
d8fcf55e HEAD@{13}: commit: Sketched out an iter

Something very strange is happening with the display buffering here. I've noticed this on other invocations of less as well, not just when examining this particular file.

Expected behavior

When less is invoked the terminal should contain the first page of text from the input. Instead, it's starting about 10 lines in.

Actual behavior

As described above

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.