Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

windows 10 - In git bash how to increase less's screen width?

I am using git bash 2.32 on Windows 10.

In git bash after updating to 2.32 I see strange behavior of the command I used for displaying log:

git -c core.pager='less -S -F' log --all --decorate --oneline --graph

As you can see I try to use "a dog" command with less pager configured to quit on EOF and to cut lines whose length exceed the current screen width. But after I updated to 2.32 the output appears to be truncated after 80 symbols which is usually much less than the actual screen width (as shown on the image below).

I am trying to understand how to increase that limit so that less truncates lines that are longer than say 160 symbols or rather the lines that just don't fit the current screen.

Note: I changed the width to 160 and now echo $COLUMNS returns 160 but that didn't help a bit.

Note: I also enabled checkwinsize option for the current session. Also no luck. As can be seen the lines are truncated way too early

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is a relatively recent Git-for-Windows bug, with discussion and patches found here in the archives for the Git mailing list. There is a lot of further discussion in this GitHub issue. The bug is to be fixed in the next update of Git-for-Windows.

In the meantime, consider this workaround from KalleOlaviNiemitalo:

git config --global core.pager "env -u COLUMNS less"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...