git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-gui: Long lines in commit message gets hidden, no scrollbar appears

From
Bert Wesarg <bert.wesarg@googlemail.com>
Date
Sep 2, 2019, 12:05 UTC
Message-ID
<CAKPyHN1LJa8Zq6rZbOMZ-KxkqQYauQcvjv+rTrHt1_zwPZLZ-A@mail.gmail.com>
In-Reply-To
<CAGr--=+ThYVyZUiU1wnt0yL+MzF1RXvHnbwo9NWyh95cLyhNRQ@mail.gmail.com>
Hi Birger,

On Mon, Sep 2, 2019 at 11:13 AM Birger Skogeng Pedersen <birger.sp@gmail.com> wrote:

Show 9 quoted lines
>
> Hi,
>
> I just noticed that long lines in the commit message widget does in
> fact not show a horizontal scrollbar.
> So if a line in the commit message is more than 75 characters, it gets
> a bit confusing.
> Should it not have a scrollbar?
> Example shown here: https://i.imgur.com/I3d6nBJ.png

the old reasoning was, that you should not create commit messages which are too wide. While I can follow this reasoning, hiding content is also not a good idea. Thus I tried a different aproach. Instead of not showing the content, I pop up a dialog, if the commit message contains too long lines and add you requested scrollbar.

As I'm currently unable to send patches per mail, I pushed it to GitHub:
https://github.com/bertwesarg/git-gui/tree/bw/commit-scrollbuffer
And I will paste the scrollbuffer commit below.

Best, Bert

Author: Bert Wesarg <bert.wesarg@googlemail.com>
Date:   Mon Sep 2 13:57:24 2019 +0200
    git-gui: add horizontal scrollbar to commit buffer
    Sugestted-by: Birger Skogeng Pedersen <birger.sp@gmail.com>
    Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
diff --git a/git-gui.sh b/git-gui.sh
index a491085..919d1e9 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -3363,14 +3363,20 @@ ttext $ui_comm -background white -foreground black \
        -relief sunken \
        -width $repo_config(gui.commitmsgwidth) -height 9 -wrap none \
        -font font_diff \
-       -yscrollcommand {.vpane.lower.commarea.buffer.frame.sby set}
+       -yscrollcommand {.vpane.lower.commarea.buffer.frame.sby set} \
+       -xscrollcommand {.vpane.lower.commarea.buffer.sbx set}
 ${NS}::scrollbar .vpane.lower.commarea.buffer.frame.sby \
+       -orient vertical \
        -command [list $ui_comm yview]
+${NS}::scrollbar .vpane.lower.commarea.buffer.sbx \
+       -orient horizontal \
+       -command [list $ui_comm xview]

 pack .vpane.lower.commarea.buffer.frame.sby -side right -fill y
 pack $ui_comm -side left -fill y
+pack .vpane.lower.commarea.buffer.sbx -side bottom -fill x
 pack .vpane.lower.commarea.buffer.header -side top -fill x
-pack .vpane.lower.commarea.buffer.frame -side left -fill y
+pack .vpane.lower.commarea.buffer.frame -side top -fill x
 pack .vpane.lower.commarea.buffer -side left -fill y

 # -- Commit Message Buffer Context Menu
Previous: Birger Skogeng PedersenNext: Birger Skogeng Pedersen
Message 2 of 18 in “git-gui: Long lines in commit message gets hidden, no scrollbar appears”
  1. Birger Skogeng PedersenSep 2, 2019
  2. Bert WesargSep 2, 2019
  3. Birger Skogeng PedersenSep 2, 2019
  4. Pratyush YadavSep 2, 2019
  5. Birger Skogeng PedersenSep 2, 2019
  6. Pratyush YadavSep 2, 2019
  7. Pratyush YadavSep 2, 2019
  8. Bert WesargSep 2, 2019
  9. Bert WesargSep 2, 2019
  10. Birger Skogeng PedersenSep 2, 2019
  11. Pratyush YadavSep 3, 2019
  12. Bert WesargSep 4, 2019
  13. Pratyush YadavSep 4, 2019
  14. Birger Skogeng PedersenSep 4, 2019
  15. Pratyush YadavSep 4, 2019
  16. Junio C HamanoSep 2, 2019
  17. Bert WesargSep 2, 2019
  18. Birger Skogeng PedersenSep 2, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.