Skip to content

Commit

Permalink
git-gui: compensate the additional diff marker at line start
Browse files Browse the repository at this point in the history
Let apply_tab_size increase the size of the first tab by 1, or by 2
if a 3 way diff is detected. This compensates for the additional diff
marker at the line start.
  • Loading branch information
mlandres committed Sep 1, 2017
1 parent 5ab7227 commit 57abff3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/diff.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ proc apply_tab_size {{firsttab {}}} {

set w [font measure font_diff "0"]
if {$have_tk85 && $firsttab != 0} {
$ui_diff configure -tabs [list [expr {$firsttab * $w}] [expr {($firsttab + $repo_config(gui.tabsize)) * $w}]]
$ui_diff configure -tabs [list [expr {($firsttab + $repo_config(gui.tabsize)) * $w}] [expr {($firsttab + 2*$repo_config(gui.tabsize)) * $w}]]
} elseif {$have_tk85 || $repo_config(gui.tabsize) != 8} {
$ui_diff configure -tabs [expr {$repo_config(gui.tabsize) * $w}]
} else {
Expand Down Expand Up @@ -118,7 +118,7 @@ proc show_diff {path w {lno {}} {scroll_pos {}} {callback {}}} {

set cont_info [list $scroll_pos $callback]

apply_tab_size 0
apply_tab_size 1

if {[string first {U} $m] >= 0} {
merge_load_stages $path [list show_unmerged_diff $cont_info]
Expand Down Expand Up @@ -420,7 +420,7 @@ proc read_diff {fd conflict_size cont_info} {
#
if {[string match {@@@ *} $line]} {
set is_3way_diff 1
apply_tab_size 1
apply_tab_size 2
}

if {$::current_diff_inheader} {
Expand Down

0 comments on commit 57abff3

Please sign in to comment.