git-split-diffs
git-split-diffs copied to clipboard
Diff not using the full width of Git Bash
Hey there,
thanks for creating that amazing tool. However, I'm using the standard Git Bash that comes with the windows git installation and the diffs are not using the full window's width.
I'm starting the bash by default with a column count of 280 and did not resize it. I'll get a split diff up until a split-diffs.min-line-width
of 60 - after that it's only inline.
At first, I suspected it's because of my monitor's 150% scaling, but reverting that to 100% did not change anything. And in general it works: doing a git diff in window's cmd works perfectly and uses the console's full width.
And ideas why it's not working with the Git Bash?
Interesting, I use this library to figure out the terminal size in a cross platform manner: https://github.com/sindresorhus/term-size/blob/main/index.js. From reading the implementation, I'm guessing it's seeing a different value for process.platform
than win32
and ending up falling through to the default of 80.
If you're comfortable with debugging this on your end, find your global node_modules
(npm list -g
will show you), then within it navigate to git-split-diffs/node_modules/term-size/index.js
and add some console.log
statements. Then if you run git diff again, those statements should print and show you where it is going wrong. Then we can maybe file an issue with https://github.com/sindresorhus/term-size/ to handle that edge case.
A less ideal workaround that might work is setting the COLUMNS
and LINES
environment variables that this library seems to read from. It's also possible that your mingw shell is setting these incorrectly and causing this issue.
I did a little digging, and it seems like the library has a fallback (whatever this term-size.exe is doing) for windows if stderr.columns
& stderr.rows
is not filled. I opened an issue for Git Bash support with an implementation suggestion here https://github.com/sindresorhus/term-size/issues/22
Perfect, thanks!