{"thread":{"id":"14703","subject":"[PATCH (GIT-GUI) 1/2] git-gui: Fix the Remote menu separator.","startedAt":"2008-07-27T06:34:21Z","lastAt":"2008-07-27T06:35:38Z","messageCount":2,"participants":["Alexander Gavrilov"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"85154","messageId":"200807271034.21833.angavrilov@gmail.com","threadId":"14703","inReplyTo":null,"subject":"[PATCH (GIT-GUI) 1/2] git-gui: Fix the Remote menu separator.","fromName":"Alexander Gavrilov","fromEmail":"angavrilov@gmail.com","sentAt":"2008-07-27T06:34:21Z","receivedAt":"2008-07-27T06:34:21Z","isPatch":true,"sender":{"key":"angavrilov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42666?v=4"},"body":"It was positioned incorrectly (offset by one position)\nif the menu had a tear-off handle.\n\nSigned-off-by: Alexander Gavrilov <angavrilov@gmail.com>\n---\n\n\tA couple of random fixes.\n\n\t-- Alexander\n\n git-gui.sh |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 9d0627d..da903a1 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -2926,6 +2926,7 @@ if {[is_enabled transport]} {\n \tpopulate_fetch_menu\n \tset n [expr {[.mbar.remote index end] - $n}]\n \tif {$n > 0} {\n+\t\tif {[.mbar.remote type 0] eq \"tearoff\"} { incr n }\n \t\t.mbar.remote insert $n separator\n \t}\n \tunset n\n-- \n1.5.6.3.18.gfe82\n"},{"id":"85155","messageId":"200807271035.38347.angavrilov@gmail.com","threadId":"14703","inReplyTo":"200807271034.21833.angavrilov@gmail.com","subject":"[PATCH (GIT-GUI) 2/2] git-gui: Preserve scroll position on reshow_diff.","fromName":"Alexander Gavrilov","fromEmail":"angavrilov@gmail.com","sentAt":"2008-07-27T06:35:38Z","receivedAt":"2008-07-27T06:35:38Z","isPatch":true,"sender":{"key":"angavrilov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42666?v=4"},"body":"It is especially useful for Stage/Unstage Line, because\nthey invoke full state scan and diff reload, which originally\nwould reset the scroll position to the top of the file.\n\nSigned-off-by: Alexander Gavrilov <angavrilov@gmail.com>\n---\n lib/diff.tcl |   18 ++++++++++++++----\n 1 files changed, 14 insertions(+), 4 deletions(-)\n\ndiff --git a/lib/diff.tcl b/lib/diff.tcl\nindex 96ba949..1c1aa56 100644\n--- a/lib/diff.tcl\n+++ b/lib/diff.tcl\n@@ -19,6 +19,7 @@ proc clear_diff {} {\n proc reshow_diff {} {\n \tglobal file_states file_lists\n \tglobal current_diff_path current_diff_side\n+\tglobal ui_diff\n \n \tset p $current_diff_path\n \tif {$p eq {}} {\n@@ -28,7 +29,8 @@ proc reshow_diff {} {\n \t\t|| [lsearch -sorted -exact $file_lists($current_diff_side) $p] == -1} {\n \t\tclear_diff\n \t} else {\n-\t\tshow_diff $p $current_diff_side\n+\t\tset save_pos [lindex [$ui_diff yview] 0]\n+\t\tshow_diff $p $current_diff_side {} $save_pos\n \t}\n }\n \n@@ -52,7 +54,7 @@ A rescan will be automatically started to find other files which may have the sa\n \trescan ui_ready 0\n }\n \n-proc show_diff {path w {lno {}}} {\n+proc show_diff {path w {lno {}} {scroll_pos {}}} {\n \tglobal file_states file_lists\n \tglobal is_3way_diff diff_active repo_config\n \tglobal ui_diff ui_index ui_workdir\n@@ -151,6 +153,10 @@ proc show_diff {path w {lno {}}} {\n \t\t$ui_diff conf -state disabled\n \t\tset diff_active 0\n \t\tunlock_index\n+\t\tif {$scroll_pos ne {}} {\n+\t\t\tupdate\n+\t\t\t$ui_diff yview moveto $scroll_pos\n+\t\t}\n \t\tui_ready\n \t\treturn\n \t}\n@@ -190,10 +196,10 @@ proc show_diff {path w {lno {}}} {\n \t\t-blocking 0 \\\n \t\t-encoding binary \\\n \t\t-translation binary\n-\tfileevent $fd readable [list read_diff $fd]\n+\tfileevent $fd readable [list read_diff $fd $scroll_pos]\n }\n \n-proc read_diff {fd} {\n+proc read_diff {fd scroll_pos} {\n \tglobal ui_diff diff_active\n \tglobal is_3way_diff current_diff_header\n \n@@ -282,6 +288,10 @@ proc read_diff {fd} {\n \t\tclose $fd\n \t\tset diff_active 0\n \t\tunlock_index\n+\t\tif {$scroll_pos ne {}} {\n+\t\t\tupdate\n+\t\t\t$ui_diff yview moveto $scroll_pos\n+\t\t}\n \t\tui_ready\n \n \t\tif {[$ui_diff index end] eq {2.0}} {\n-- \n1.5.6.3.18.gfe82\n"}]}