Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k 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 Reply

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"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...