@ -253,6 +253,19 @@ proc show_other_diff {path w m cont_info} {
@@ -253,6 +253,19 @@ proc show_other_diff {path w m cont_info} {
}
}
proc get_conflict_marker_size {path} {
set size 7
catch {
set fd_rc [eval [list git_read check-attr "conflict-marker-size" -- $path]]
set ret [gets $fd_rc line]
close $fd_rc
if {$ret > 0} {
regexp {.*: conflict-marker-size: (\d+)$} $line line size
}
}
return $size
}
proc start_show_diff {cont_info {add_opts {}}} {
global file_states file_lists
global is_3way_diff is_submodule_diff diff_active repo_config
@ -268,6 +281,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
@@ -268,6 +281,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
set is_submodule_diff 0
set diff_active 1
set current_diff_header {}
set conflict_size [get_conflict_marker_size $path]
set cmd [list]
if {$w eq $ui_index} {
@ -329,7 +343,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
@@ -329,7 +343,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
-blocking 0 \
-encoding [get_path_encoding $path] \
-translation lf
fileevent $fd readable [list read_diff $fd $cont_info]
fileevent $fd readable [list read_diff $fd $conflict_size $cont_info]
}
proc parse_color_line {line} {
@ -357,7 +371,7 @@ proc parse_color_line {line} {
@@ -357,7 +371,7 @@ proc parse_color_line {line} {
return [list $result $markup]
}
proc read_diff {fd cont_info} {
proc read_diff {fd conflict_size cont_info} {
global ui_diff diff_active is_submodule_diff
global is_3way_diff is_conflict_diff current_diff_header
global current_diff_queue
@ -410,7 +424,9 @@ proc read_diff {fd cont_info} {
@@ -410,7 +424,9 @@ proc read_diff {fd cont_info} {
{- } {set tags d_-s}
{--} {set tags d_--}
{++} {
if {[regexp {^\+\+([<>]{7} |={7})} $line _g op]} {
set regexp [string map [list %conflict_size $conflict_size]\
{^\+\+([<>=]){%conflict_size}(?: |$)}]
if {[regexp $regexp $line _g op]} {
set is_conflict_diff 1
set line [string replace $line 0 1 { }]
set tags d$op
@ -449,7 +465,9 @@ proc read_diff {fd cont_info} {
@@ -449,7 +465,9 @@ proc read_diff {fd cont_info} {
{@} {set tags d_@}
{-} {set tags d_-}
{+} {
if {[regexp {^\+([<>]{7} |={7})} $line _g op]} {
set regexp [string map [list %conflict_size $conflict_size]\
{^\+([<>=]){%conflict_size}(?: |$)}]
if {[regexp $regexp $line _g op]} {
set is_conflict_diff 1
set tags d$op
} else {