Border line in commit text boxes is shown 2 characters past the specified width
What steps will reproduce the problem?
- Open up TortoiseGit - Settings.
- Under "General", select "Dialogs 3".
- Set "Char position where to show a border line in commit text boxes" to 72.
- Open up TortoiseGit - Commit.
- Type 74 characters in a repeating pattern, e.g. "123456789 " (note space at end)
What is the expected output? What do you see instead?
There should be a border line after 72 characters. However, the border line is shown after 74 characters instead.
Please see attached screenshot.
What version of TortoiseGit and Git are you using? On what operating system?
- TortoiseGit 126.96.36.199
- git version 2.6.2.windows.1
- Windows 10 64-bit, also repros in Windows 7 64-bit
Please provide any additional information below.
In src/TortoiseProc/ProjectProperties.cpp, the code is intentionally adding 2:
nLogWidthMarker = _ttoi(val) + 2; // HACK, + 2 needed
The hack seems to be an attempt to work around a bug in automatic word-wrapping. You can see this by going back to a version of TortoiseGit from a year ago:
- Install TortoiseGit 188.8.131.52 in a VM.
- Set border to display at 72 characters.
- Open TortoiseGit - Commit.
- Enter 7 repetitions of "123456789 "
- Type "x yz"
- Notice that all of "x yz" gets moved to the next line. So it ends up wrapping after 70 characters instead of 72, even though it's displaying the line after 74 characters. The +2 didn't actually change the 70-character wrapping to 72.
Automatic word-wrapping is now off in TortoiseGit 184.108.40.206. I actually think this is better. If auto-wrapping is so buggy that it's not wrapping consistently, then it's better to display the border line and let the user wrap the commit message manually.
However, the hack is causing the border to be drawn in the wrong place. If the user wraps manually using the border as a guide, he now ends up with 2 extra characters.