git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git gui: visually wrap lines of commit message
@ 2008-08-09 16:05 Clemens Buchacher
  2008-08-09 21:44 ` Johannes Sixt
  0 siblings, 1 reply; 9+ messages in thread
From: Clemens Buchacher @ 2008-08-09 16:05 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git

Visually wrap lines in the commit message text box. That way we can avoid
a horizontal scroll bar (which was not available anyways).

Note: This does _not_ break lines in the actual commit message.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
---

I also tried to get automatic line breaks but was unable to do so. I managed
to implement a callback function triggered by the <<Modified>> event, and I
also managed to query the end position of the insertion using the 'insert'
index. So with this information it would be possible to implement automatic
line breaks. Unfortunately, this is not enough for pasting. If there is more
than one new character, the start position of the insertion is unknown.

I then tried to track cursor movement, but no luck there either. Any ideas
are welcome. For now I'll simply have to "git commit --amend<CR>gqG:x<CR>"
each time I use git gui.

Clemens

 git-gui/git-gui.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 14b2d9a..3949f7d 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -2528,6 +2528,7 @@ text $ui_comm -background white -foreground black \
 	-autoseparators true \
 	-relief sunken \
 	-width $repo_config(gui.commitmsgwidth) -height 9 -wrap none \
+	-wrap char \
 	-font font_diff \
 	-yscrollcommand {.vpane.lower.commarea.buffer.sby set}
 scrollbar .vpane.lower.commarea.buffer.sby \
-- 
1.5.6.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] git gui: visually wrap lines of commit message
  2008-08-09 16:05 [PATCH] git gui: visually wrap lines of commit message Clemens Buchacher
@ 2008-08-09 21:44 ` Johannes Sixt
  2008-08-09 22:06   ` Clemens Buchacher
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Sixt @ 2008-08-09 21:44 UTC (permalink / raw)
  To: Clemens Buchacher; +Cc: Shawn O. Pearce, git

On Samstag, 9. August 2008, Clemens Buchacher wrote:
> Visually wrap lines in the commit message text box. That way we can avoid
> a horizontal scroll bar (which was not available anyways).
>
> Note: This does _not_ break lines in the actual commit message.

Please don't do that. I want to get what I see.

-- Hannes

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] git gui: visually wrap lines of commit message
  2008-08-09 21:44 ` Johannes Sixt
@ 2008-08-09 22:06   ` Clemens Buchacher
  2008-08-09 22:14     ` Johannes Sixt
  0 siblings, 1 reply; 9+ messages in thread
From: Clemens Buchacher @ 2008-08-09 22:06 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Shawn O. Pearce, git

On Sat, Aug 09, 2008 at 11:44:33PM +0200, Johannes Sixt wrote:
> On Samstag, 9. August 2008, Clemens Buchacher wrote:
> > Visually wrap lines in the commit message text box. That way we can avoid
> > a horizontal scroll bar (which was not available anyways).
> >
> > Note: This does _not_ break lines in the actual commit message.
> 
> Please don't do that. I want to get what I see.

Currently you don't see the whole message anyways if the box is too small
for the text. I find that quite annoying, especially since there are neither
keys nor a scrollbar to scroll horizontally.

And if you break the lines manually, it really doesn't make a difference.
Unless you "forget" to do so, which is unlikely, because the virtual wrap
will wrap per-character and not per-word.

Clemens

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] git gui: visually wrap lines of commit message
  2008-08-09 22:06   ` Clemens Buchacher
@ 2008-08-09 22:14     ` Johannes Sixt
  2008-08-09 22:41       ` Clemens Buchacher
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Sixt @ 2008-08-09 22:14 UTC (permalink / raw)
  To: Clemens Buchacher; +Cc: git, Shawn O. Pearce

On Sonntag, 10. August 2008, Clemens Buchacher wrote:
> On Sat, Aug 09, 2008 at 11:44:33PM +0200, Johannes Sixt wrote:
> > On Samstag, 9. August 2008, Clemens Buchacher wrote:
> > > Visually wrap lines in the commit message text box. That way we can
> > > avoid a horizontal scroll bar (which was not available anyways).
> > >
> > > Note: This does _not_ break lines in the actual commit message.
> >
> > Please don't do that. I want to get what I see.
>
> Currently you don't see the whole message anyways if the box is too small
> for the text. I find that quite annoying, especially since there are
> neither keys nor a scrollbar to scroll horizontally.

In this case, I use the middle mouse button to pan around. And then I do see 
what I will get.

The width of the box was chosen wisely: It takes a bit less than 80 columns, 
to leave room for quoting in emails and to avoid wrapping of git log output.

-- Hannes

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] git gui: visually wrap lines of commit message
  2008-08-09 22:14     ` Johannes Sixt
@ 2008-08-09 22:41       ` Clemens Buchacher
  2008-08-10  2:25         ` Shawn O. Pearce
  0 siblings, 1 reply; 9+ messages in thread
From: Clemens Buchacher @ 2008-08-09 22:41 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git, Shawn O. Pearce

On Sun, Aug 10, 2008 at 12:14:13AM +0200, Johannes Sixt wrote:
> > Currently you don't see the whole message anyways if the box is too small
> > for the text. I find that quite annoying, especially since there are
> > neither keys nor a scrollbar to scroll horizontally.
> 
> In this case, I use the middle mouse button to pan around. And then I do
> see what I will get.

Ok, that's not bad. But nevertheless I think we should at least add a
scrollbar.

> The width of the box was chosen wisely: It takes a bit less than 80
> columns, to leave room for quoting in emails and to avoid wrapping of git
> log output.

Maybe I'm doing something wrong, but on my system (wish8.5) the box width
changes with the window size, and gui.commitmsgwidth appears to be ignored.
Even if I close and restart git gui, the old window size is kept.

Clemens

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] git gui: visually wrap lines of commit message
  2008-08-09 22:41       ` Clemens Buchacher
@ 2008-08-10  2:25         ` Shawn O. Pearce
  2008-08-10  7:56           ` Lars Noschinski
  0 siblings, 1 reply; 9+ messages in thread
From: Shawn O. Pearce @ 2008-08-10  2:25 UTC (permalink / raw)
  To: Clemens Buchacher; +Cc: Johannes Sixt, git

Clemens Buchacher <drizzd@aon.at> wrote:
> On Sun, Aug 10, 2008 at 12:14:13AM +0200, Johannes Sixt wrote:
> > > Currently you don't see the whole message anyways if the box is too small
> > > for the text. I find that quite annoying, especially since there are
> > > neither keys nor a scrollbar to scroll horizontally.
> > 
> > In this case, I use the middle mouse button to pan around. And then I do
> > see what I will get.
> 
> Ok, that's not bad. But nevertheless I think we should at least add a
> scrollbar.

I thought the scrollbar took up too much vertical space, so I did
not want to put in a horizontal scrollbar on a box that never should
require horizontal scrolling.  As Johannes points out...
 
> > The width of the box was chosen wisely: It takes a bit less than 80
> > columns, to leave room for quoting in emails and to avoid wrapping of git
> > log output.
> 
> Maybe I'm doing something wrong, but on my system (wish8.5) the box width
> changes with the window size, and gui.commitmsgwidth appears to be ignored.
> Even if I close and restart git gui, the old window size is kept.

That's a bug, and I now understand why you have a problem.  That box
should not be resizing itself.  Its supposed to be using a fixed
width font, and have a fixed number of columns, so you can format
a message including drawing ASCII art to explain yourself clearly
as you write a change.

I'll consider a patch that fixes the box so it doesn't resize under
8.5, but I won't apply one that applies virtual line wrapping as
then we lose the what-you-see-is-what-you-get property of the editor,
and that is a very important property for git-gui users.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] git gui: visually wrap lines of commit message
  2008-08-10  2:25         ` Shawn O. Pearce
@ 2008-08-10  7:56           ` Lars Noschinski
  2008-08-10  7:59             ` Shawn O. Pearce
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Noschinski @ 2008-08-10  7:56 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Clemens Buchacher, Johannes Sixt, git

* Shawn O. Pearce <spearce@spearce.org> [08-08-10 04:25]:
>> Maybe I'm doing something wrong, but on my system (wish8.5) the box width
>> changes with the window size, and gui.commitmsgwidth appears to be ignored.
>> Even if I close and restart git gui, the old window size is kept.
>
>That's a bug, and I now understand why you have a problem.  That box
>should not be resizing itself.  Its supposed to be using a fixed
>width font, and have a fixed number of columns, so you can format
>a message including drawing ASCII art to explain yourself clearly
>as you write a change.

The box always resizes, unless the window is wide enough. But I do not
see a good way to fix that.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] git gui: visually wrap lines of commit message
  2008-08-10  7:56           ` Lars Noschinski
@ 2008-08-10  7:59             ` Shawn O. Pearce
  2008-08-10  9:25               ` Clemens Buchacher
  0 siblings, 1 reply; 9+ messages in thread
From: Shawn O. Pearce @ 2008-08-10  7:59 UTC (permalink / raw)
  To: Lars Noschinski; +Cc: Clemens Buchacher, Johannes Sixt, git

Lars Noschinski <lars-2008-1@usenet.noschinski.de> wrote:
> * Shawn O. Pearce <spearce@spearce.org> [08-08-10 04:25]:
>>> Maybe I'm doing something wrong, but on my system (wish8.5) the box width
>>> changes with the window size, and gui.commitmsgwidth appears to be ignored.
>>> Even if I close and restart git gui, the old window size is kept.
>>
>> That's a bug, and I now understand why you have a problem.  That box
>> should not be resizing itself.  Its supposed to be using a fixed
>> width font, and have a fixed number of columns, so you can format
>> a message including drawing ASCII art to explain yourself clearly
>> as you write a change.
>
> The box always resizes, unless the window is wide enough. But I do not
> see a good way to fix that.

Oh, you mean the window isn't large enough to show the full column
width of the text area?  But if you make it large enough, the box
stops expanding?

-- 
Shawn.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] git gui: visually wrap lines of commit message
  2008-08-10  7:59             ` Shawn O. Pearce
@ 2008-08-10  9:25               ` Clemens Buchacher
  0 siblings, 0 replies; 9+ messages in thread
From: Clemens Buchacher @ 2008-08-10  9:25 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Lars Noschinski, Johannes Sixt, git

On Sun, Aug 10, 2008 at 12:59:13AM -0700, Shawn O. Pearce wrote:
> Oh, you mean the window isn't large enough to show the full column
> width of the text area?  But if you make it large enough, the box
> stops expanding?

Yes, that is indeed the case. Sorry I missed that.

Knowing the trick with the middle mouse button, I can also live without a
scrollbar. So this issue is resolved for me.

Clemens

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-08-10  9:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-09 16:05 [PATCH] git gui: visually wrap lines of commit message Clemens Buchacher
2008-08-09 21:44 ` Johannes Sixt
2008-08-09 22:06   ` Clemens Buchacher
2008-08-09 22:14     ` Johannes Sixt
2008-08-09 22:41       ` Clemens Buchacher
2008-08-10  2:25         ` Shawn O. Pearce
2008-08-10  7:56           ` Lars Noschinski
2008-08-10  7:59             ` Shawn O. Pearce
2008-08-10  9:25               ` Clemens Buchacher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).