@matheusbsbs / matheus-bagliano / commits / 6bdc929984
Fork 0

git-gui: Clear diff from viewer if the side changed.

If the user switches the currently shown file from one side of the UI to the other then how its diff is presented would be different. And leaving the old diff up is downright confusing. Since the diff is probably not interesting to the user after the switch we should just clear the diff viewer. This saves the user time, as they won't need to wait for us to reload the diff. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Jan 21, 2007 at 13:22 UTC 6bdc929984f84318783ef320115f46151fa4f0d6
1 file changed +7 -4
git-gui.sh
+7 -4
@@ -556,14 +556,17 @@ proc clear_diff {} {
556 }
557
558 proc reshow_diff {} {
559 - global ui_status_value file_states
559 + global ui_status_value file_states file_lists
560 global current_diff_path current_diff_side
561
562 - if {$current_diff_path eq {}
563 - || [catch {set s $file_states($current_diff_path)}]} {
562 + set p $current_diff_path
563 + if {$p eq {}
564 + || $current_diff_side eq {}
565 + || [catch {set s $file_states($p)}]
566 + || [lsearch -sorted $file_lists($current_diff_side) $p] == -1} {
567 clear_diff
568 } else {
566 - show_diff $current_diff_path $current_diff_side
569 + show_diff $p $current_diff_side
570 }
571 }
572