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

Re: [PATCH] git-gui: support core.whitespace rules in diff view

From
Tor Arvid Lund <torarvid@gmail.com>
Date
Oct 22, 2010, 12:00 UTC
Message-ID
<AANLkTimSrQ07pPKJ=4H+JL=TpGd7vJD63eea=waATiru@mail.gmail.com>
In-Reply-To
<8762wve5k2.fsf@fox.patthoyts.tk>

On Thu, Oct 21, 2010 at 8:58 PM, Pat Thoyts <patthoyts@users.sourceforge.net> wrote:

> Tor Arvid Lund <torarvid@gmail.com> writes:
<snip>
Show 24 quoted lines
>>I did a quick test (with core.whitespace unset, so the defaults should
>>be used). I wonder if there is a little bug somewhere else in git-gui.
>>If I have committed a line like this:
>>
>>............Hello world
>>
>>and change it to:
>>
>>........*Hello world
>>
>>I used '.' to indicate Space, and '*' to indicate Tab, so I changed 4
>>spaces to one tab character. As I understand space-before-tab, this
>>should render 8 red spaces, 1 white Tab, and then "Hello world". But
>>instead I get 9 white spaces... So the tab gets converted to a space
>>(I verified that it was not my editor that converted it - it really is
>>8 SP and 1 TAB).
>
> This is caused by the tabstyle being defaulted to 'tabular'. This means
> the first tab on a line extends to the first tab position and if that
> lies to the left then the width of a single space is added. Looks like
> this widget should be using -tabstyle wordprocessor which would do what
> you expect and move to the next tab position.
>
> It is still a tab - just the display width looks wrong.
<snap>
Ok. I tried this, which seems to make it better:
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 31ca47d..65d5f2a 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -3283,6 +3283,7 @@ text $ui_diff -background white -foreground black \
        -borderwidth 0 \
        -width 80 -height 5 -wrap none \
        -font font_diff \
+       -tabstyle wordprocessor \
        -xscrollcommand {.vpane.lower.diff.body.sbx set} \
        -yscrollcommand {.vpane.lower.diff.body.sby set} \
        -state disabled

(this goes on top of your most recent patch from an hour ago)

-Tor Arvid-
Previous: Pat ThoytsNext: Pat Thoyts
Message 8 of 14 in “Colored whitespace in git gui”
  1. Tor Arvid LundOct 18, 2010
  2. git-gui: highlight trailing whitespace in diff viewPat Thoyts, Oct 19, 2010
  3. Tor Arvid LundOct 20, 2010
  4. git-gui: support core.whitespace rules in diff viewPat Thoyts, Oct 20, 2010
  5. Junio C HamanoOct 20, 2010
  6. Tor Arvid LundOct 21, 2010
  7. Pat ThoytsOct 21, 2010
  8. Tor Arvid LundOct 22, 2010
  9. Pat ThoytsOct 22, 2010
  10. git-gui: apply color information from git diffPat Thoyts, Oct 21, 2010
  11. Kevin BallardOct 21, 2010
  12. Pat ThoytsOct 21, 2010
  13. git-gui: apply color information from git diff outputPat Thoyts, Oct 22, 2010
  14. Tor Arvid LundOct 22, 2010

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.