Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hard wrap commit message text at the configured text width #7

Open
prati0100 opened this issue Oct 24, 2019 · 0 comments
Open

Hard wrap commit message text at the configured text width #7

prati0100 opened this issue Oct 24, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@prati0100
Copy link
Owner

Right now, all the gui.commitmsgwidth config variable does is set the size of the commit message window, so users get a visual hint on when to manually wrap their text. A much better quality-of-life feature would be to wrap the text for the user.

Also, allow disabling the line wrap for people who don't want it.

Wrapping the display text of the commit message text box is easy to do. The -wrap option of the text widget can wrap the displayed text. I haven't looked too much into the option, but AFAIK it only soft-wraps the text.

So, we need to hard-wrap the text before passing it to the commit machinery. The main challenge is to make sure our wrapping algorithm works exactly like the text widget's wrap, otherwise the users would see one thing and the commit would contain something else.

It would also probably be a good idea to allow not wrapping a line. Maybe we can do something like mbox subject lines where if the first character of the line is a space, it is considered a part of the previous line.

An alternate implementation to using -wrap would be to run the text wrapping logic every time the user types something (probably by using tags). This would remove the need to match Tcl's word wrap implementation, but might have a performance hit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant