{"thread":{"id":"54220","subject":"[PATCH 0/2] gitk: fix mix of tabs and spaces in indentation","startedAt":"2020-09-10T08:29:01Z","lastAt":"2020-10-03T09:14:29Z","messageCount":9,"participants":["Denton Liu","Paul Mackerras"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"405321","messageId":"cover.1599726439.git.liu.denton@gmail.com","threadId":"54220","inReplyTo":null,"subject":"[PATCH 0/2] gitk: fix mix of tabs and spaces in indentation","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2020-09-10T08:27:40Z","receivedAt":"2020-09-10T08:29:01Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The source code of gitk has some funny indentation. It uses four spaces\nper level indent but uses tabs every other level (eight spaces).\nReindent gitk to just use tabs instead.\n\nThis series should be empty with `--ignore-all-space`.\n\nDenton Liu (2):\n  gitk: replace spaces with tabs\n  gitk: manually fix whitespace errors\n\n gitk | 20404 ++++++++++++++++++++++++++++-----------------------------\n 1 file changed, 10202 insertions(+), 10202 deletions(-)\n\n-- \n2.28.0.618.gf4bc123cb7\n\n"},{"id":"405322","messageId":"1b577821168c824f81bb0229efeea2e28536254c.1599726439.git.liu.denton@gmail.com","threadId":"54220","inReplyTo":"cover.1599726439.git.liu.denton@gmail.com","subject":"[PATCH 2/2] gitk: manually fix whitespace errors","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2020-09-10T08:27:42Z","receivedAt":"2020-09-10T08:29:27Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The previous commit mechanically converted four-space indents into tabs,\nintroducing many whitespace errors. Manually fix these whitespace\nerrors. This was done by finding offending lines using a Python\nscript[0] and manually correcting them by comparing to the original\nversion.\n\nIf the lines were originally aligned with the line above, keep the\nalignment. Otherwise, if it's a line continuation, default to two\ntabs.\n\nThis patch should be empty with `--ignore-all-space`.\n\n[0]:\n\timport sys\n\n\ttab_level = 0\n\tfor lineno, line in enumerate(sys.stdin, 1):\n\t    line = line.rstrip()\n\t    if not line:\n\t\tcontinue\n\t    tab_stripped = line.lstrip('\\t')\n\t    new_tab_level = len(line) - len(tab_stripped)\n\t    if new_tab_level - tab_level > 1:\n\t\tprint('more than one tab:', lineno)\n\t\tcontinue\n\t    tab_level = new_tab_level\n\t    space_stripped = tab_stripped.lstrip(' ')\n\t    if len(tab_stripped) > len(space_stripped):\n\t\tprint('tabs and spaces mixed:', lineno)\n\t\tcontinue\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n gitk | 274 +++++++++++++++++++++++++++++------------------------------\n 1 file changed, 137 insertions(+), 137 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 7efb106e52..60c1e45325 100755\n--- a/gitk\n+++ b/gitk\n@@ -11,7 +11,7 @@ package require Tk\n \n proc hasworktree {} {\n \treturn [expr {[exec git rev-parse --is-bare-repository] == \"false\" &&\n-\t\t\t\t  [exec git rev-parse --is-inside-git-dir] == \"false\"}]\n+\t\t      [exec git rev-parse --is-inside-git-dir] == \"false\"}]\n }\n \n proc reponame {} {\n@@ -391,10 +391,10 @@ proc start_rev_list {view} {\n \t\t\tglobal nr_unmerged\n \t\t\tif {$nr_unmerged == 0} {\n \t\t\t\terror_popup [mc \"No files selected: --merge specified but\\\n-\t\t\t\t\t\t\t no files are unmerged.\"]\n+\t\t\t\t\t     no files are unmerged.\"]\n \t\t\t} else {\n \t\t\t\terror_popup [mc \"No files selected: --merge specified but\\\n-\t\t\t\t\t\t\t no unmerged files are within file limit.\"]\n+\t\t\t\t\t     no unmerged files are within file limit.\"]\n \t\t\t}\n \t\t\treturn 0\n \t\t}\n@@ -413,7 +413,7 @@ proc start_rev_list {view} {\n \n \tif {[catch {\n \t\tset fd [open [concat | git log --no-color -z --pretty=raw $show_notes \\\n-\t\t\t\t\t\t--parents --boundary $args \"--\" $files] r]\n+\t\t\t\t--parents --boundary $args \"--\" $files] r]\n \t} err]} {\n \t\terror_popup \"[mc \"Error executing git log:\"] $err\"\n \t\treturn 0\n@@ -561,7 +561,7 @@ proc updatecommits {} {\n \t}\n \tif {[catch {\n \t\tset fd [open [concat | git log --no-color -z --pretty=raw $show_notes \\\n-\t\t\t\t\t\t--parents --boundary $args \"--\" $vfilelimit($view)] r]\n+\t\t\t\t--parents --boundary $args \"--\" $vfilelimit($view)] r]\n \t} err]} {\n \t\terror_popup \"[mc \"Error executing git log:\"] $err\"\n \t\treturn\n@@ -834,7 +834,7 @@ proc renumbervarc {a v} {\n \t\tset id [lindex $varcstart($v) $a]\n \t\tif {[llength $children($v,$id)] > 1} {\n \t\t\tset children($v,$id) [lsort -command [list vtokcmp $v] \\\n-\t\t\t\t\t\t\t\t\t  $children($v,$id)]\n+\t\t\t\t\t$children($v,$id)]\n \t\t}\n \t\tset oldtok [lindex $varctok($v) $a]\n \t\tif {!$vdatemode($v)} {\n@@ -900,7 +900,7 @@ proc renumbervarc {a v} {\n \t\t\t\tset b [lindex $vleftptr($v) $c]\n \t\t\t}\n \t\t\twhile {$b != 0 && \\\n-\t\t\t\t\t  [string compare $tok [lindex $varctok($v) $b]] >= 0} {\n+\t\t\t\t\t[string compare $tok [lindex $varctok($v) $b]] >= 0} {\n \t\t\t\tset c $b\n \t\t\t\tset b [lindex $vleftptr($v) $c]\n \t\t\t}\n@@ -921,7 +921,7 @@ proc renumbervarc {a v} {\n \tforeach id [array names sortkids] {\n \t\tif {[llength $children($v,$id)] > 1} {\n \t\t\tset children($v,$id) [lsort -command [list vtokcmp $v] \\\n-\t\t\t\t\t\t\t\t\t  $children($v,$id)]\n+\t\t\t\t\t$children($v,$id)]\n \t\t}\n \t}\n \tset t2 [clock clicks -milliseconds]\n@@ -941,8 +941,8 @@ proc fix_reversal {p a v} {\n \t}\n \t# seeds always need to be renumbered\n \tif {[lindex $vupptr($v) $pa] == 0 ||\n-\t\t[string compare [lindex $varctok($v) $a] \\\n-\t\t\t [lindex $varctok($v) $pa]] > 0} {\n+\t\t\t[string compare [lindex $varctok($v) $a] \\\n+\t\t\t[lindex $varctok($v) $pa]] > 0} {\n \t\trenumbervarc $pa $v\n \t}\n }\n@@ -1090,7 +1090,7 @@ proc vtokcmp {v a b} {\n \tglobal varctok varcid\n \n \treturn [string compare [lindex $varctok($v) $varcid($v,$a)] \\\n-\t\t\t\t[lindex $varctok($v) $varcid($v,$b)]]\n+\t\t\t[lindex $varctok($v) $varcid($v,$b)]]\n }\n \n # This assumes that if lim is not given, the caller has checked that\n@@ -1237,7 +1237,7 @@ proc comes_before {a b} {\n \t}\n \tif {$varcid($v,$a) != $varcid($v,$b)} {\n \t\treturn [expr {[string compare [lindex $varctok($v) $varcid($v,$a)] \\\n-\t\t\t\t\t\t   [lindex $varctok($v) $varcid($v,$b)]] < 0}]\n+\t\t\t\t[lindex $varctok($v) $varcid($v,$b)]] < 0}]\n \t}\n \treturn [expr {[rowofcommit $a] < [rowofcommit $b]}]\n }\n@@ -1369,7 +1369,7 @@ proc rewrite_commit {v id rwid} {\n \t\t# add $ch to $rwid's children and sort the list if necessary\n \t\tif {[llength [lappend children($v,$rwid) $ch]] > 1} {\n \t\t\tset children($v,$rwid) [lsort -command [list vtokcmp $v] \\\n-\t\t\t\t\t\t\t\t\t\t$children($v,$rwid)]\n+\t\t\t\t\t$children($v,$rwid)]\n \t\t}\n \t\t# fix the graph after joining $id to $rwid\n \t\tset a $varcid($v,$ch)\n@@ -1445,7 +1445,7 @@ proc getcommitlines {fd inst view updating}  {\n \t\t\t}\n \t\t\tif {[string range $err 0 4] == \"usage\"} {\n \t\t\t\tset err \"Gitk: error reading commits$fv:\\\n-\t\t\t\t\t\tbad arguments to git log.\"\n+\t\t\t\t\tbad arguments to git log.\"\n \t\t\t\tif {$viewname($view) eq [mc \"Command line\"]} {\n \t\t\t\t\tappend err \\\n \t\t\t\t\t\t\"  (Note: arguments to gitk are passed to git log\\\n@@ -1529,7 +1529,7 @@ proc getcommitlines {fd inst view updating}  {\n \t\t\t# parent as a substitute parent for $id's children.\n \t\t\tif {![catch {\n \t\t\t\tset rwid [exec git rev-list --first-parent --max-count=1 \\\n-\t\t\t\t\t\t\t  $id -- $vfilelimit($view)]\n+\t\t\t\t\t\t$id -- $vfilelimit($view)]\n \t\t\t}]} {\n \t\t\t\tif {$rwid ne {} && [info exists varcid($view,$rwid)]} {\n \t\t\t\t\t# use $rwid in place of $id\n@@ -1582,7 +1582,7 @@ proc getcommitlines {fd inst view updating}  {\n \t\t\t\tif {[llength [lappend children($vp) $id]] > 1 &&\n \t\t\t\t\t[vtokcmp $view [lindex $children($vp) end-1] $id] > 0} {\n \t\t\t\t\tset children($vp) [lsort -command [list vtokcmp $view] \\\n-\t\t\t\t\t\t\t\t\t\t   $children($vp)]\n+\t\t\t\t\t\t\t$children($vp)]\n \t\t\t\t\tunset -nocomplain ordertok\n \t\t\t\t}\n \t\t\t\tif {[info exists varcid($view,$p)]} {\n@@ -1730,7 +1730,7 @@ proc parsecommit {id contents listed} {\n \t\tset comment [string range $comment 0 $i-1]\n \t}\n \tset commitinfo($id) [list $headline $auname $audate \\\n-\t\t\t\t\t\t\t $comname $comdate $comment $hasnote $diff]\n+\t\t\t$comname $comdate $comment $hasnote $diff]\n }\n \n proc getcommit {id} {\n@@ -2053,8 +2053,8 @@ proc makedroplist {w varname args} {\n \t\t\tif {$cx > $width} {set width $cx}\n \t\t}\n \t\tset gm [ttk::combobox $w -width $width -state readonly\\\n-\t\t\t\t\t-textvariable $varname -values $args \\\n-\t\t\t\t\t-exportselection false]\n+\t\t\t\t-textvariable $varname -values $args \\\n+\t\t\t\t-exportselection false]\n \t\tbind $gm <<ComboboxSelected>> [list $gm selection clear]\n \t} else {\n \t\tset gm [eval [linsert $args 0 tk_optionMenu $w $varname]]\n@@ -2320,10 +2320,10 @@ proc makewindow {} {\n \t\t-side left -fill y\n \tset gdttype [mc \"containing:\"]\n \tset gm [makedroplist .tf.lbar.gdttype gdttype \\\n-\t\t\t\t[mc \"containing:\"] \\\n-\t\t\t\t[mc \"touching paths:\"] \\\n-\t\t\t\t[mc \"adding/removing string:\"] \\\n-\t\t\t\t[mc \"changing lines matching:\"]]\n+\t\t\t[mc \"containing:\"] \\\n+\t\t\t[mc \"touching paths:\"] \\\n+\t\t\t[mc \"adding/removing string:\"] \\\n+\t\t\t[mc \"changing lines matching:\"]]\n \ttrace add variable gdttype write gdttype_change\n \tpack .tf.lbar.gdttype -side left -fill y\n \n@@ -2334,7 +2334,7 @@ proc makewindow {} {\n \ttrace add variable findstring write find_change\n \tset findtype [mc \"Exact\"]\n \tset findtypemenu [makedroplist .tf.lbar.findtype \\\n-\t\t\t\t\t\t  findtype [mc \"Exact\"] [mc \"IgnCase\"] [mc \"Regexp\"]]\n+\t\t\tfindtype [mc \"Exact\"] [mc \"IgnCase\"] [mc \"Regexp\"]]\n \ttrace add variable findtype write findcom_change\n \tset findloc [mc \"All fields\"]\n \tmakedroplist .tf.lbar.findloc findloc [mc \"All fields\"] [mc \"Headline\"] \\\n@@ -3112,7 +3112,7 @@ proc keys {} {\n [mc \"<%s-minus> Decrease font size\" $M1T]\n [mc \"<F5>\t\t\t\tUpdate\"]\n \" \\\n-\t\t\t-justify left -bg $bgcolor -border 2 -relief groove\n+\t\t-justify left -bg $bgcolor -border 2 -relief groove\n \tpack $w.m -side top -fill both -padx 2 -pady 2\n \t${NS}::button $w.ok -text [mc \"Close\"] -command \"destroy $w\" -default active\n \tbind $w <Key-Escape> [list destroy $w]\n@@ -3352,59 +3352,59 @@ image create bitmap tri-rt -background black -foreground blue -data {\n \t#define tri-rt_width 13\n \t#define tri-rt_height 13\n \tstatic unsigned char tri-rt_bits[] = {\n-\t   0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x00, 0x70, 0x00, 0xf0, 0x00,\n-\t   0xf0, 0x01, 0xf0, 0x00, 0x70, 0x00, 0x30, 0x00, 0x10, 0x00, 0x00, 0x00,\n-\t   0x00, 0x00};\n+\t\t0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x00, 0x70, 0x00, 0xf0, 0x00,\n+\t\t0xf0, 0x01, 0xf0, 0x00, 0x70, 0x00, 0x30, 0x00, 0x10, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00};\n } -maskdata {\n \t#define tri-rt-mask_width 13\n \t#define tri-rt-mask_height 13\n \tstatic unsigned char tri-rt-mask_bits[] = {\n-\t   0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, 0x00, 0xf8, 0x01,\n-\t   0xf8, 0x03, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0x38, 0x00, 0x18, 0x00,\n-\t   0x08, 0x00};\n+\t\t0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, 0x00, 0xf8, 0x01,\n+\t\t0xf8, 0x03, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0x38, 0x00, 0x18, 0x00,\n+\t\t0x08, 0x00};\n }\n image create bitmap tri-dn -background black -foreground blue -data {\n \t#define tri-dn_width 13\n \t#define tri-dn_height 13\n \tstatic unsigned char tri-dn_bits[] = {\n-\t   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xf8, 0x03,\n-\t   0xf0, 0x01, 0xe0, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n-\t   0x00, 0x00};\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xf8, 0x03,\n+\t\t0xf0, 0x01, 0xe0, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00};\n } -maskdata {\n \t#define tri-dn-mask_width 13\n \t#define tri-dn-mask_height 13\n \tstatic unsigned char tri-dn-mask_bits[] = {\n-\t   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0xfe, 0x0f, 0xfc, 0x07,\n-\t   0xf8, 0x03, 0xf0, 0x01, 0xe0, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,\n-\t   0x00, 0x00};\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0xfe, 0x0f, 0xfc, 0x07,\n+\t\t0xf8, 0x03, 0xf0, 0x01, 0xe0, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00};\n }\n \n image create bitmap reficon-T -background black -foreground yellow -data {\n \t#define tagicon_width 13\n \t#define tagicon_height 9\n \tstatic unsigned char tagicon_bits[] = {\n-\t   0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x07,\n-\t   0xfc, 0x07, 0xf8, 0x07, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00};\n+\t\t0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x07,\n+\t\t0xfc, 0x07, 0xf8, 0x07, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00};\n } -maskdata {\n \t#define tagicon-mask_width 13\n \t#define tagicon-mask_height 9\n \tstatic unsigned char tagicon-mask_bits[] = {\n-\t   0x00, 0x00, 0xf0, 0x0f, 0xf8, 0x0f, 0xfc, 0x0f,\n-\t   0xfe, 0x0f, 0xfc, 0x0f, 0xf8, 0x0f, 0xf0, 0x0f, 0x00, 0x00};\n+\t\t0x00, 0x00, 0xf0, 0x0f, 0xf8, 0x0f, 0xfc, 0x0f,\n+\t\t0xfe, 0x0f, 0xfc, 0x0f, 0xf8, 0x0f, 0xf0, 0x0f, 0x00, 0x00};\n }\n set rectdata {\n \t#define headicon_width 13\n \t#define headicon_height 9\n \tstatic unsigned char headicon_bits[] = {\n-\t   0x00, 0x00, 0x00, 0x00, 0xf8, 0x07, 0xf8, 0x07,\n-\t   0xf8, 0x07, 0xf8, 0x07, 0xf8, 0x07, 0x00, 0x00, 0x00, 0x00};\n+\t\t0x00, 0x00, 0x00, 0x00, 0xf8, 0x07, 0xf8, 0x07,\n+\t\t0xf8, 0x07, 0xf8, 0x07, 0xf8, 0x07, 0x00, 0x00, 0x00, 0x00};\n }\n set rectmask {\n \t#define headicon-mask_width 13\n \t#define headicon-mask_height 9\n \tstatic unsigned char headicon-mask_bits[] = {\n-\t   0x00, 0x00, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f,\n-\t   0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0x00, 0x00};\n+\t\t0x00, 0x00, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f,\n+\t\t0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0x00, 0x00};\n }\n image create bitmap reficon-H -background black -foreground \"#00ff00\" \\\n \t-data $rectdata -maskdata $rectmask\n@@ -3622,7 +3622,7 @@ proc external_diff_get_one_file {diffid filename diffdir} {\n \t}\n \tset difffile [file join $diffdir \"\\[$diffid\\] [file tail $filename]\"]\n \treturn [save_file_from_commit $diffid:$filename $difffile \\\n-\t\t\t   \"revision $diffid\"]\n+\t\t\t\"revision $diffid\"]\n }\n \n proc external_diff {} {\n@@ -3953,7 +3953,7 @@ proc read_line_source {fd inst} {\n \t\t\tselectline [rowofcommit $id] 1 [list $fname $lnum] 1\n \t\t} else {\n \t\t\terror_popup [mc \"That line comes from commit %s, \\\n-\t\t\t\t\t\t\t which is not in this view\" [shortids $id]]\n+\t\t\t\t\t which is not in this view\" [shortids $id]]\n \t\t}\n \t} else {\n \t\tputs \"oops couldn't parse git blame output\"\n@@ -4590,8 +4590,8 @@ proc bolden {id font} {\n \tif {[info exists currentid] && $id eq $currentid} {\n \t\t$canv delete secsel\n \t\tset t [eval $canv create rect [$canv bbox $linehtag($id)] \\\n-\t\t\t\t   -outline {{}} -tags secsel \\\n-\t\t\t\t   -fill [$canv cget -selectbackground]]\n+\t\t\t\t-outline {{}} -tags secsel \\\n+\t\t\t\t-fill [$canv cget -selectbackground]]\n \t\t$canv lower $t\n \t}\n \tif {[info exists markedid] && $id eq $markedid} {\n@@ -4608,8 +4608,8 @@ proc bolden_name {id font} {\n \tif {[info exists currentid] && $id eq $currentid} {\n \t\t$canv2 delete secsel\n \t\tset t [eval $canv2 create rect [$canv2 bbox $linentag($id)] \\\n-\t\t\t\t   -outline {{}} -tags secsel \\\n-\t\t\t\t   -fill [$canv2 cget -selectbackground]]\n+\t\t\t\t-outline {{}} -tags secsel \\\n+\t\t\t\t-fill [$canv2 cget -selectbackground]]\n \t\t$canv2 lower $t\n \t}\n }\n@@ -4767,7 +4767,7 @@ proc findcom_change args {\n \t\tset findpattern $findstring\n \t} else {\n \t\tset e [string map {\"*\" \"\\\\*\" \"?\" \"\\\\?\" \"\\[\" \"\\\\\\[\" \"\\\\\" \"\\\\\\\\\"} \\\n-\t\t\t\t   $findstring]\n+\t\t\t\t$findstring]\n \t\tset findpattern \"*$e*\"\n \t}\n }\n@@ -5057,7 +5057,7 @@ proc askrelhighlight {row id} {\n \t\t\tset isbold 1\n \t\t}\n \t} elseif {$highlight_related eq [mc \"Ancestor\"] ||\n-\t\t\t  $highlight_related eq [mc \"Not ancestor\"]} {\n+\t\t  $highlight_related eq [mc \"Not ancestor\"]} {\n \t\tif {![info exists ancestor($id)]} {\n \t\t\tis_ancestor $id\n \t\t}\n@@ -5162,7 +5162,7 @@ proc idcol {idlist id {i 0}} {\n \t} else {\n \t\tif {$t > [ordertoken [lindex $idlist $i]]} {\n \t\t\twhile {[incr i] < [llength $idlist] &&\n-\t\t\t\t   $t >= [ordertoken [lindex $idlist $i]]} {}\n+\t\t\t       $t >= [ordertoken [lindex $idlist $i]]} {}\n \t\t}\n \t}\n \treturn $i\n@@ -5243,7 +5243,7 @@ proc get_viewmainhead {view} {\n \n \tcatch {\n \t\tset rfd [open [concat | git rev-list -1 $mainheadid \\\n-\t\t\t\t\t\t   -- $vfilelimit($view)] r]\n+\t\t\t\t-- $vfilelimit($view)] r]\n \t\tset j [reg_instance $rfd]\n \t\tlappend viewinstances($view) $j\n \t\tfconfigure $rfd -blocking 0\n@@ -5838,15 +5838,15 @@ proc rowranges {id} {\n \t\t\t# see if the line extends the whole way from prevrow to row\n \t\t\tif {$row > $prevrow + $uparrowlen + $downarrowlen &&\n \t\t\t\t[lsearch -exact [lindex $rowidlist \\\n-\t\t\t\t\t\t\t[expr {int(($row + $prevrow) / 2)}]] $id] < 0} {\n+\t\t\t\t\t\t[expr {int(($row + $prevrow) / 2)}]] $id] < 0} {\n \t\t\t\t# it doesn't, see where it ends\n \t\t\t\tset r [expr {$prevrow + $downarrowlen}]\n \t\t\t\tif {[lsearch -exact [lindex $rowidlist $r] $id] < 0} {\n \t\t\t\t\twhile {[incr r -1] > $prevrow &&\n-\t\t\t\t\t\t   [lsearch -exact [lindex $rowidlist $r] $id] < 0} {}\n+\t\t\t\t\t       [lsearch -exact [lindex $rowidlist $r] $id] < 0} {}\n \t\t\t\t} else {\n \t\t\t\t\twhile {[incr r] <= $row &&\n-\t\t\t\t\t\t   [lsearch -exact [lindex $rowidlist $r] $id] >= 0} {}\n+\t\t\t\t\t       [lsearch -exact [lindex $rowidlist $r] $id] >= 0} {}\n \t\t\t\t\tincr r -1\n \t\t\t\t}\n \t\t\t\tlappend ret $r\n@@ -5854,10 +5854,10 @@ proc rowranges {id} {\n \t\t\t\tset r [expr {$row - $uparrowlen}]\n \t\t\t\tif {[lsearch -exact [lindex $rowidlist $r] $id] < 0} {\n \t\t\t\t\twhile {[incr r] < $row &&\n-\t\t\t\t\t\t   [lsearch -exact [lindex $rowidlist $r] $id] < 0} {}\n+\t\t\t\t\t       [lsearch -exact [lindex $rowidlist $r] $id] < 0} {}\n \t\t\t\t} else {\n \t\t\t\t\twhile {[incr r -1] >= $prevrow &&\n-\t\t\t\t\t\t   [lsearch -exact [lindex $rowidlist $r] $id] >= 0} {}\n+\t\t\t\t\t       [lsearch -exact [lindex $rowidlist $r] $id] >= 0} {}\n \t\t\t\t\tincr r\n \t\t\t\t}\n \t\t\t\tlappend ret $r\n@@ -6000,7 +6000,7 @@ proc drawlineseg {id row endrow arrowlow} {\n \t\tif {!$joinhigh} {\n \t\t\tassigncolor $id\n \t\t\tset t [$canv create line $coords -width [linewidth $id] \\\n-\t\t\t\t\t   -fill $colormap($id) -tags lines.$id -arrow $arrow]\n+\t\t\t\t\t-fill $colormap($id) -tags lines.$id -arrow $arrow]\n \t\t\t$canv lower $t\n \t\t\tbindline $t $id\n \t\t\tset lines [linsert $lines $i [list $row $le $t]]\n@@ -6097,7 +6097,7 @@ proc drawparentlinks {id row} {\n \t\t\tlappend coords $x2 $y2\n \t\t}\n \t\tset t [$canv create line $coords -width [linewidth $p] \\\n-\t\t\t\t   -fill $colormap($p) -tags lines.$p]\n+\t\t\t\t-fill $colormap($p) -tags lines.$p]\n \t\t$canv lower $t\n \t\tbindline $t $p\n \t}\n@@ -6139,22 +6139,22 @@ proc drawcmittext {id row col} {\n \tset orad [expr {$linespc / 3}]\n \tif {$listed <= 2} {\n \t\tset t [$canv create oval [expr {$x - $orad}] [expr {$y - $orad}] \\\n-\t\t\t\t   [expr {$x + $orad - 1}] [expr {$y + $orad - 1}] \\\n-\t\t\t\t   -fill $ofill -outline $circleoutlinecolor -width 1 -tags circle]\n+\t\t\t\t[expr {$x + $orad - 1}] [expr {$y + $orad - 1}] \\\n+\t\t\t\t-fill $ofill -outline $circleoutlinecolor -width 1 -tags circle]\n \t} elseif {$listed == 3} {\n \t\t# triangle pointing left for left-side commits\n \t\tset t [$canv create polygon \\\n-\t\t\t\t   [expr {$x - $orad}] $y \\\n-\t\t\t\t   [expr {$x + $orad - 1}] [expr {$y - $orad}] \\\n-\t\t\t\t   [expr {$x + $orad - 1}] [expr {$y + $orad - 1}] \\\n-\t\t\t\t   -fill $ofill -outline $circleoutlinecolor -width 1 -tags circle]\n+\t\t\t\t[expr {$x - $orad}] $y \\\n+\t\t\t\t[expr {$x + $orad - 1}] [expr {$y - $orad}] \\\n+\t\t\t\t[expr {$x + $orad - 1}] [expr {$y + $orad - 1}] \\\n+\t\t\t\t-fill $ofill -outline $circleoutlinecolor -width 1 -tags circle]\n \t} else {\n \t\t# triangle pointing right for right-side commits\n \t\tset t [$canv create polygon \\\n-\t\t\t\t   [expr {$x + $orad - 1}] $y \\\n-\t\t\t\t   [expr {$x - $orad}] [expr {$y - $orad}] \\\n-\t\t\t\t   [expr {$x - $orad}] [expr {$y + $orad - 1}] \\\n-\t\t\t\t   -fill $ofill -outline $circleoutlinecolor -width 1 -tags circle]\n+\t\t\t\t[expr {$x + $orad - 1}] $y \\\n+\t\t\t\t[expr {$x - $orad}] [expr {$y - $orad}] \\\n+\t\t\t\t[expr {$x - $orad}] [expr {$y + $orad - 1}] \\\n+\t\t\t\t-fill $ofill -outline $circleoutlinecolor -width 1 -tags circle]\n \t}\n \tset circleitem($row) $t\n \t$canv raise $t\n@@ -6196,12 +6196,12 @@ proc drawcmittext {id row col} {\n \t\t}\n \t}\n \tset linehtag($id) [$canv create text $xt $y -anchor w -fill $fgcolor \\\n-\t\t\t\t\t\t   -text $headline -font $font -tags text]\n+\t\t\t-text $headline -font $font -tags text]\n \t$canv bind $linehtag($id) $ctxbut \"rowmenu %X %Y $id\"\n \tset linentag($id) [$canv2 create text 3 $y -anchor w -fill $fgcolor \\\n-\t\t\t\t\t\t   -text $name -font $nfont -tags text]\n+\t\t\t-text $name -font $nfont -tags text]\n \tset linedtag($id) [$canv3 create text 3 $y -anchor w -fill $fgcolor \\\n-\t\t\t\t\t\t   -text $date -font mainfont -tags text]\n+\t\t\t-text $date -font mainfont -tags text]\n \tif {$selectedline == $row} {\n \t\tmake_secsel $id\n \t}\n@@ -6618,7 +6618,7 @@ proc drawtags {id x xt y1} {\n \t\tset xt [expr {$xt + $wid + $extra}]\n \t}\n \tset t [$canv create line $x $y1 [lindex $xvals end] $y1 \\\n-\t\t\t   -width $lthickness -fill $reflinecolor -tags tag.$id]\n+\t\t\t-width $lthickness -fill $reflinecolor -tags tag.$id]\n \t$canv lower $t\n \tforeach tag $marks x $xvals wid $wvals {\n \t\tset tag_quoted [string map {% %%} $tag]\n@@ -6628,9 +6628,9 @@ proc drawtags {id x xt y1} {\n \t\tif {[incr ntags -1] >= 0} {\n \t\t\t# draw a tag\n \t\t\tset t [$canv create polygon $x [expr {$yt + $delta}] $xl $yt \\\n-\t\t\t\t\t   $xr $yt $xr $yb $xl $yb $x [expr {$yb - $delta}] \\\n-\t\t\t\t\t   -width 1 -outline $tagoutlinecolor -fill $tagbgcolor \\\n-\t\t\t\t\t   -tags tag.$id]\n+\t\t\t\t\t$xr $yt $xr $yb $xl $yb $x [expr {$yb - $delta}] \\\n+\t\t\t\t\t-width 1 -outline $tagoutlinecolor -fill $tagbgcolor \\\n+\t\t\t\t\t-tags tag.$id]\n \t\t\tif {$singletag} {\n \t\t\t\tset tagclick [list showtags $id 1]\n \t\t\t} else {\n@@ -6661,7 +6661,7 @@ proc drawtags {id x xt y1} {\n \t\t\t}\n \t\t}\n \t\tset t [$canv create text $xl $y1 -anchor w -text $tag -fill $headfgcolor \\\n-\t\t\t\t   -font $font -tags [list tag.$id text]]\n+\t\t\t\t-font $font -tags [list tag.$id text]]\n \t\tif {$ntags >= 0} {\n \t\t\t$canv bind $t <1> $tagclick\n \t\t} elseif {$nheads >= 0} {\n@@ -6676,8 +6676,8 @@ proc drawnotesign {xt y} {\n \n \tset orad [expr {$linespc / 3}]\n \tset t [$canv create rectangle [expr {$xt - $orad}] [expr {$y - $orad}] \\\n-\t\t\t   [expr {$xt + $orad - 1}] [expr {$y + $orad - 1}] \\\n-\t\t\t   -fill yellow -outline $fgcolor -width 1 -tags circle]\n+\t\t\t[expr {$xt + $orad - 1}] [expr {$y + $orad - 1}] \\\n+\t\t\t-fill yellow -outline $fgcolor -width 1 -tags circle]\n \tset xt [expr {$xt + $orad * 3}]\n \treturn $xt\n }\n@@ -6971,8 +6971,8 @@ proc markmatches {canv l str tag matches font row} {\n \t\tset xoff [font measure $font [string range $str 0 [expr {$start-1}]]]\n \t\tset xlen [font measure $font [string range $str 0 [expr {$end}]]]\n \t\tset t [$canv create rect [expr {$x0+$xoff}] $y0 \\\n-\t\t\t\t   [expr {$x0+$xlen+2}] $y1 \\\n-\t\t\t\t   -outline {} -tags [list match$l matches] -fill yellow]\n+\t\t\t\t[expr {$x0+$xlen+2}] $y1 \\\n+\t\t\t\t-outline {} -tags [list match$l matches] -fill yellow]\n \t\t$canv lower $t\n \t\tif {$row == $selectedline} {\n \t\t\t$canv raise $t secsel\n@@ -7040,7 +7040,7 @@ proc appendwithlinks {text tags} {\n \t\tincr linknum\n \t}\n \tset wlinks [regexp -indices -all -inline -line \\\n-\t\t\t\t\t{https?://[^[:space:]]+} $text]\n+\t\t\t{https?://[^[:space:]]+} $text]\n \tforeach l $wlinks {\n \t\tset s2 [lindex $l 0]\n \t\tset e2 [lindex $l 1]\n@@ -7058,7 +7058,7 @@ proc setlink {id lk} {\n \tglobal linkfgcolor\n \n \tif {[string range $id 0 1] eq \"-g\"} {\n-\t  set id [string range $id 2 end]\n+\t\tset id [string range $id 2 end]\n \t}\n \n \tset known 0\n@@ -7277,15 +7277,15 @@ proc make_secsel {id} {\n \tif {![info exists linehtag($id)]} return\n \t$canv delete secsel\n \tset t [eval $canv create rect [$canv bbox $linehtag($id)] -outline {{}} \\\n-\t\t\t   -tags secsel -fill [$canv cget -selectbackground]]\n+\t\t\t-tags secsel -fill [$canv cget -selectbackground]]\n \t$canv lower $t\n \t$canv2 delete secsel\n \tset t [eval $canv2 create rect [$canv2 bbox $linentag($id)] -outline {{}} \\\n-\t\t\t   -tags secsel -fill [$canv2 cget -selectbackground]]\n+\t\t\t-tags secsel -fill [$canv2 cget -selectbackground]]\n \t$canv2 lower $t\n \t$canv3 delete secsel\n \tset t [eval $canv3 create rect [$canv3 bbox $linedtag($id)] -outline {{}} \\\n-\t\t\t   -tags secsel -fill [$canv3 cget -selectbackground]]\n+\t\t\t-tags secsel -fill [$canv3 cget -selectbackground]]\n \t$canv3 lower $t\n }\n \n@@ -7295,7 +7295,7 @@ proc make_idmark {id} {\n \tif {![info exists linehtag($id)]} return\n \t$canv delete markid\n \tset t [eval $canv create rect [$canv bbox $linehtag($id)] \\\n-\t\t\t   -tags markid -outline $fgcolor]\n+\t\t\t-tags markid -outline $fgcolor]\n \t$canv raise $t\n }\n \n@@ -7751,7 +7751,7 @@ proc getblobline {bf id} {\n \t\tif {$jump_to_here ne {} &&\n \t\t\t[lindex $jump_to_here 0] eq [lindex $ctext_file_names 0]} {\n \t\t\tset lnum [expr {[lindex $jump_to_here 1] +\n-\t\t\t\t\t\t\t[lindex [split $commentend .] 0]}]\n+\t\t\t\t\t[lindex [split $commentend .] 0]}]\n \t\t\tmark_ctext_line $lnum\n \t\t}\n \t\t$ctext config -state disabled\n@@ -7905,7 +7905,7 @@ proc gettreediffs {ids} {\n \n \tset cmd [diffcmd $ids {--no-commit-id}]\n \tif {$limitdiffs && $vfilelimit($curview) ne {}} {\n-\t\t\tset cmd [concat $cmd -- $vfilelimit($curview)]\n+\t\tset cmd [concat $cmd -- $vfilelimit($curview)]\n \t}\n \tif {[catch {set gdtf [open $cmd r]}]} return\n \n@@ -8058,7 +8058,7 @@ proc maybe_scroll_ctext {ateof} {\n \tif {![info exists target_scrollpos]} return\n \tif {!$ateof} {\n \t\tset nlines [expr {[winfo height $ctext]\n-\t\t\t\t\t\t  / [font metrics textfont -linespace]}]\n+\t\t\t\t/ [font metrics textfont -linespace]}]\n \t\tif {[$ctext compare \"$target_scrollpos + $nlines lines\" <= end]} return\n \t}\n \t$ctext yview $target_scrollpos\n@@ -8179,8 +8179,8 @@ proc parseblobdiffline {ids line} {\n \t\t\tset l [string length $line]\n \t\t\tset i [expr {$l / 2}]\n \t\t\tif {!(($l & 1) && [string index $line $i] eq \" \" &&\n-\t\t\t\t  [string range $line 2 [expr {$i - 1}]] eq \\\n-\t\t\t\t\t  [string range $line [expr {$i + 3}] end])} {\n+\t\t\t\t\t[string range $line 2 [expr {$i - 1}]] eq \\\n+\t\t\t\t\t[string range $line [expr {$i + 3}] end])} {\n \t\t\t\treturn\n \t\t\t}\n \t\t\t# unescape if quoted and chop off the a/ from the front\n@@ -8252,7 +8252,7 @@ proc parseblobdiffline {ids line} {\n \t\t\t\tsetinlist difffilestart $i $curdiffstart\n \t\t\t}\n \t\t} elseif {![string compare -length 10 $line \"rename to \"] ||\n-\t\t\t\t  ![string compare -length 8 $line \"copy to \"]} {\n+\t\t\t  ![string compare -length 8 $line \"copy to \"]} {\n \t\t\tset fname [string range $line [expr 4 + [string first \" to \" $line] ] end]\n \t\t\tif {[string index $fname 0] eq \"\\\"\"} {\n \t\t\t\tset fname [lindex $fname 0]\n@@ -8269,7 +8269,7 @@ proc parseblobdiffline {ids line} {\n \n \t} else {\n \t\tset line [string map {\\x1A ^Z} \\\n-\t\t\t\t\t  [encoding convertfrom $diffencoding $line]]\n+\t\t\t\t[encoding convertfrom $diffencoding $line]]\n \t\t# parse the prefix - one ' ', '-' or '+' for each parent\n \t\tset prefix [string range $line 0 [expr {$diffnparents - 1}]]\n \t\tset tag [expr {$diffnparents > 1? \"m\": \"d\"}]\n@@ -8429,7 +8429,7 @@ proc settabs {{firstab {}}} {\n \tset w [font measure textfont \"0\"]\n \tif {$firsttabstop != 0} {\n \t\t$ctext conf -tabs [list [expr {($firsttabstop + $tabstop) * $w}] \\\n-\t\t\t\t\t\t\t   [expr {($firsttabstop + 2 * $tabstop) * $w}]]\n+\t\t\t\t[expr {($firsttabstop + 2 * $tabstop) * $w}]]\n \t} elseif {$have_tk85 || $tabstop != 8} {\n \t\t$ctext conf -tabs [expr {$tabstop * $w}]\n \t} else {\n@@ -8655,8 +8655,8 @@ proc fontflags {f {isbold 0}} {\n \tglobal fontattr\n \n \treturn [list -family $fontattr($f,family) -size $fontattr($f,size) \\\n-\t\t\t\t-weight [expr {$isbold? \"bold\": $fontattr($f,weight)}] \\\n-\t\t\t\t-slant $fontattr($f,slant)]\n+\t\t\t-weight [expr {$isbold? \"bold\": $fontattr($f,weight)}] \\\n+\t\t\t-slant $fontattr($f,slant)]\n }\n \n proc fontname {f} {\n@@ -8821,11 +8821,11 @@ proc linehover {} {\n \tset x1 [expr {$x + [font measure mainfont $text] + 2 * $lthickness}]\n \tset y1 [expr {$y + $linespc + 2 * $lthickness}]\n \tset t [$canv create rectangle $x0 $y0 $x1 $y1 \\\n-\t\t\t   -fill $linehoverbgcolor -outline $linehoveroutlinecolor \\\n-\t\t\t   -width 1 -tags hover]\n+\t\t\t-fill $linehoverbgcolor -outline $linehoveroutlinecolor \\\n+\t\t\t-width 1 -tags hover]\n \t$canv raise $t\n \tset t [$canv create text $x $y -anchor nw -text $text -tags hover \\\n-\t\t\t   -font mainfont -fill $linehoverfgcolor]\n+\t\t\t-font mainfont -fill $linehoverfgcolor]\n \t$canv raise $t\n }\n \n@@ -9281,7 +9281,7 @@ proc mkpatchrev {} {\n \tset newid [$patchtop.tosha1 get]\n \tset newhead [$patchtop.tohead get]\n \tforeach e [list fromsha1 fromhead tosha1 tohead] \\\n-\t\t\tv [list $newid $newhead $oldid $oldhead] {\n+\t\tv [list $newid $newhead $oldid $oldhead] {\n \t\t$patchtop.$e conf -state normal\n \t\t$patchtop.$e delete 0 end\n \t\t$patchtop.$e insert 0 $v\n@@ -9666,7 +9666,7 @@ proc exec_citool {tool_args {baseid {}}} {\n \t\tset author [lindex $commitinfo($baseid) 1]\n \t\tset date [lindex $commitinfo($baseid) 2]\n \t\tif {[regexp {^\\s*(\\S.*\\S|\\S)\\s*<(.*)>\\s*$} \\\n-\t\t\t\t\t$author author name email]\n+\t\t\t\t$author author name email]\n \t\t\t&& $date ne {}} {\n \t\t\tset env(GIT_AUTHOR_NAME) $name\n \t\t\tset env(GIT_AUTHOR_EMAIL) $email\n@@ -9689,8 +9689,8 @@ proc cherrypick {} {\n \tset dheads [descheads $rowmenuid]\n \tif {$dheads ne {} && [lsearch -exact $dheads $oldhead] >= 0} {\n \t\tset ok [confirm_popup [mc \"Commit %s is already\\\n-\t\t\t\tincluded in branch %s -- really re-apply it?\" \\\n-\t\t\t\t\t\t\t\t   [string range $rowmenuid 0 7] $mainhead]]\n+\t\t\tincluded in branch %s -- really re-apply it?\" \\\n+\t\t\t\t[string range $rowmenuid 0 7] $mainhead]]\n \t\tif {!$ok} return\n \t}\n \tnowbusy cherrypick [mc \"Cherry-picking\"]\n@@ -9700,14 +9700,14 @@ proc cherrypick {} {\n \tif {[catch {exec sh -c \"git cherry-pick -r $rowmenuid 2>&1\"} err]} {\n \t\tnotbusy cherrypick\n \t\tif {[regexp -line \\\n-\t\t\t\t {Entry '(.*)' (would be overwritten by merge|not uptodate)} \\\n-\t\t\t\t $err msg fname]} {\n+\t\t\t\t{Entry '(.*)' (would be overwritten by merge|not uptodate)} \\\n+\t\t\t\t$err msg fname]} {\n \t\t\terror_popup [mc \"Cherry-pick failed because of local changes\\\n-\t\t\t\t\t\tto file '%s'.\\nPlease commit, reset or stash\\\n-\t\t\t\t\t\tyour changes and try again.\" $fname]\n+\t\t\t\t\tto file '%s'.\\nPlease commit, reset or stash\\\n+\t\t\t\t\tyour changes and try again.\" $fname]\n \t\t} elseif {[regexp -line \\\n-\t\t\t\t\t   {^(CONFLICT \\(.*\\):|Automatic cherry-pick failed|error: could not apply)} \\\n-\t\t\t\t\t   $err]} {\n+\t\t\t\t{^(CONFLICT \\(.*\\):|Automatic cherry-pick failed|error: could not apply)} \\\n+\t\t\t\t$err]} {\n \t\t\tif {[confirm_popup [mc \"Cherry-pick failed because of merge\\\n \t\t\t\t\t\tconflict.\\nDo you wish to run git citool to\\\n \t\t\t\t\t\tresolve it?\"]]} {\n@@ -9752,9 +9752,9 @@ proc revert {} {\n \tset dheads [descheads $rowmenuid]\n \tif { $dheads eq {} || [lsearch -exact $dheads $oldhead] == -1 } {\n \t   set ok [confirm_popup [mc \"Commit %s is not\\\n-\t\t   included in branch %s -- really revert it?\" \\\n-\t\t\t\t\t  [string range $rowmenuid 0 7] $mainhead]]\n-\t   if {!$ok} return\n+\t\tincluded in branch %s -- really revert it?\" \\\n+\t\t\t[string range $rowmenuid 0 7] $mainhead]]\n+\t\tif {!$ok} return\n \t}\n \tnowbusy revert [mc \"Reverting\"]\n \tupdate\n@@ -9988,7 +9988,7 @@ proc rmbranch {} {\n \tif {[llength $dheads] == 1 && $idheads($dheads) eq $head} {\n \t\t# the stuff on this branch isn't on any other branch\n \t\tif {![confirm_popup [mc \"The commits on branch %s aren't on any other\\\n-\t\t\t\t\t\tbranch.\\nReally delete branch %s?\" $head $head]]} return\n+\t\t\t\tbranch.\\nReally delete branch %s?\" $head $head]]} return\n \t}\n \tnowbusy rmbranch\n \tupdate\n@@ -10134,10 +10134,10 @@ proc refill_reflist {} {\n \t\tif {$i < [llength $reflist]} {\n \t\t\tif {$j < [llength $refs]} {\n \t\t\t\tset cmp [string compare [lindex $reflist $i 0] \\\n-\t\t\t\t\t\t\t [lindex $refs $j 0]]\n+\t\t\t\t\t\t[lindex $refs $j 0]]\n \t\t\t\tif {$cmp == 0} {\n \t\t\t\t\tset cmp [string compare [lindex $reflist $i 1] \\\n-\t\t\t\t\t\t\t\t [lindex $refs $j 1]]\n+\t\t\t\t\t\t\t[lindex $refs $j 1]]\n \t\t\t\t}\n \t\t\t} else {\n \t\t\t\tset cmp -1\n@@ -10198,7 +10198,7 @@ proc getallcommits {} {\n \t\tset ids \"--all\"\n \t} else {\n \t\tset refs [concat [array names idheads] [array names idtags] \\\n-\t\t\t\t\t  [array names idotherrefs]]\n+\t\t\t\t[array names idotherrefs]]\n \t\tset ids {}\n \t\tset tagobjs {}\n \t\tforeach name [array names tagobjid] {\n@@ -10557,7 +10557,7 @@ proc dropcache {err} {\n \n \t#puts \"dropping cache ($err)\"\n \tforeach v {arcnos arcout arcids arcstart arcend growing \\\n-\t\t\t\t   arctags archeads allparents allchildren} {\n+\t\t\t\tarctags archeads allparents allchildren} {\n \t\tglobal $v\n \t\tunset -nocomplain $v\n \t}\n@@ -11263,7 +11263,7 @@ proc rereadrefs {} {\n \tglobal idtags idheads idotherrefs mainheadid\n \n \tset refids [concat [array names idtags] \\\n-\t\t\t\t\t[array names idheads] [array names idotherrefs]]\n+\t\t\t[array names idheads] [array names idotherrefs]]\n \tforeach id $refids {\n \t\tif {![info exists ref($id)]} {\n \t\t\tset ref($id) [listrefs $id]\n@@ -11273,7 +11273,7 @@ proc rereadrefs {} {\n \treadrefs\n \tchangedrefs\n \tset refids [lsort -unique [concat $refids [array names idtags] \\\n-\t\t\t\t\t\t[array names idheads] [array names idotherrefs]]]\n+\t\t\t[array names idheads] [array names idotherrefs]]]\n \tforeach id $refids {\n \t\tset v [listrefs $id]\n \t\tif {![info exists ref($id)] || $ref($id) != $v} {\n@@ -11544,7 +11544,7 @@ proc prefspage_general {notebook} {\n \t${NS}::label $page.maxwidthl -text [mc \"Maximum graph width (lines)\"]\n \tspinbox $page.maxwidth -from 0 -to 100 -width 4 -textvariable maxwidth\n \tgrid $page.spacer $page.maxwidthl $page.maxwidth -sticky w\n-\t\t\t\t\t\t\t\t\t\t #xgettext:no-tcl-format\n+\t\t\t#xgettext:no-tcl-format\n \t${NS}::label $page.maxpctl -text [mc \"Maximum graph width (% of pane)\"]\n \tspinbox $page.maxpct -from 1 -to 100 -width 4 -textvariable maxgraphpct\n \tgrid x $page.maxpctl $page.maxpct -sticky w\n@@ -11614,7 +11614,7 @@ proc prefspage_colors {notebook} {\n \tgrid $page.cdisp - -sticky w -pady 10\n \tlabel $page.ui -padx 40 -relief sunk -background $uicolor\n \t${NS}::button $page.uibut -text [mc \"Interface\"] \\\n-\t   -command [list choosecolor uicolor {} $page.ui [mc \"interface\"] setui]\n+\t\t-command [list choosecolor uicolor {} $page.ui [mc \"interface\"] setui]\n \tgrid x $page.uibut $page.ui -sticky w\n \tlabel $page.bg -padx 40 -relief sunk -background $bgcolor\n \t${NS}::button $page.bgbut -text [mc \"Background\"] \\\n@@ -11627,24 +11627,24 @@ proc prefspage_colors {notebook} {\n \tlabel $page.diffold -padx 40 -relief sunk -background [lindex $diffcolors 0]\n \t${NS}::button $page.diffoldbut -text [mc \"Diff: old lines\"] \\\n \t\t-command [list choosecolor diffcolors 0 $page.diffold [mc \"diff old lines\"] \\\n-\t\t\t\t\t  [list $ctext tag conf d0 -foreground]]\n+\t\t\t\t[list $ctext tag conf d0 -foreground]]\n \tgrid x $page.diffoldbut $page.diffold -sticky w\n \tlabel $page.diffnew -padx 40 -relief sunk -background [lindex $diffcolors 1]\n \t${NS}::button $page.diffnewbut -text [mc \"Diff: new lines\"] \\\n \t\t-command [list choosecolor diffcolors 1 $page.diffnew [mc \"diff new lines\"] \\\n-\t\t\t\t\t  [list $ctext tag conf dresult -foreground]]\n+\t\t\t\t[list $ctext tag conf dresult -foreground]]\n \tgrid x $page.diffnewbut $page.diffnew -sticky w\n \tlabel $page.hunksep -padx 40 -relief sunk -background [lindex $diffcolors 2]\n \t${NS}::button $page.hunksepbut -text [mc \"Diff: hunk header\"] \\\n \t\t-command [list choosecolor diffcolors 2 $page.hunksep \\\n-\t\t\t\t\t  [mc \"diff hunk header\"] \\\n-\t\t\t\t\t  [list $ctext tag conf hunksep -foreground]]\n+\t\t\t\t[mc \"diff hunk header\"] \\\n+\t\t\t\t[list $ctext tag conf hunksep -foreground]]\n \tgrid x $page.hunksepbut $page.hunksep -sticky w\n \tlabel $page.markbgsep -padx 40 -relief sunk -background $markbgcolor\n \t${NS}::button $page.markbgbut -text [mc \"Marked line bg\"] \\\n \t\t-command [list choosecolor markbgcolor {} $page.markbgsep \\\n-\t\t\t\t\t  [mc \"marked line background\"] \\\n-\t\t\t\t\t  [list $ctext tag conf omark -background]]\n+\t\t\t\t[mc \"marked line background\"] \\\n+\t\t\t\t[list $ctext tag conf omark -background]]\n \tgrid x $page.markbgbut $page.markbgsep -sticky w\n \tlabel $page.selbgsep -padx 40 -relief sunk -background $selectbgcolor\n \t${NS}::button $page.selbgbut -text [mc \"Select bg\"] \\\n@@ -11678,7 +11678,7 @@ proc doprefs {} {\n \t\treturn\n \t}\n \tforeach v {maxwidth maxgraphpct showneartags showlocalchanges \\\n-\t\t\t\t   limitdiffs tabstop perfile_attrs hideremotes want_ttk} {\n+\t\t\tlimitdiffs tabstop perfile_attrs hideremotes want_ttk} {\n \t\tset oldprefs($v) [set $v]\n \t}\n \tttk_toplevel $top\n@@ -11700,7 +11700,7 @@ proc doprefs {} {\n \t\t\t$notebook add $page -text $title\n \t\t} else {\n \t\t\tset btn [${NS}::button $notebook.b_[string map {. X} $page] \\\n-\t\t\t\t\t\t -text $title -command [list raise $page]]\n+\t\t\t\t\t-text $title -command [list raise $page]]\n \t\t\t$page configure -text $title\n \t\t\tgrid $btn -row 0 -column [incr col] -sticky w\n \t\t\tgrid $page -row 1 -column 0 -sticky news -columnspan 100\n@@ -11743,7 +11743,7 @@ proc choosecolor {v vi w x cmd} {\n \tglobal $v\n \n \tset c [tk_chooseColor -initialcolor [lindex [set $v] $vi] \\\n-\t\t\t   -title [mc \"Gitk: choose color for %s\" $x]]\n+\t\t\t-title [mc \"Gitk: choose color for %s\" $x]]\n \tif {$c eq {}} return\n \t$w conf -background $c\n \tlset $v $vi $c\n@@ -11804,7 +11804,7 @@ proc prefscan {} {\n \tglobal oldprefs prefstop\n \n \tforeach v {maxwidth maxgraphpct showneartags showlocalchanges \\\n-\t\t\t\t   limitdiffs tabstop perfile_attrs hideremotes want_ttk} {\n+\t\t\tlimitdiffs tabstop perfile_attrs hideremotes want_ttk} {\n \t\tglobal $v\n \t\tset $v $oldprefs($v)\n \t}\n@@ -12257,7 +12257,7 @@ namespace import ::msgcat::mc\n # First check that Tcl/Tk is recent enough\n if {[catch {package require Tk 8.4} err]} {\n \tshow_error {} . [mc \"Sorry, gitk cannot run with this version of Tcl/Tk.\\n\\\n-\t\t\t\t\t\t Gitk requires at least Tcl/Tk 8.4.\"]\n+\t\t\t    Gitk requires at least Tcl/Tk 8.4.\"]\n \texit 1\n }\n \n@@ -12521,7 +12521,7 @@ if {$i >= [llength $argv] && $revtreeargs ne {}} {\n \t\tforeach arg $revtreeargs {\n \t\t\tif {[file exists $arg]} {\n \t\t\t\tshow_error {} . [mc \"Ambiguous argument '%s': both revision\\\n-\t\t\t\t\t\t\t\t and filename\" $arg]\n+\t\t\t\t\t\t and filename\" $arg]\n \t\t\t\texit 1\n \t\t\t}\n \t\t}\n-- \n2.28.0.618.gf4bc123cb7\n\n"},{"id":"405352","messageId":"c59cec1c669b26fc2271067f4970d0ecbf816a89.1599726439.git.liu.denton@gmail.com","threadId":"54220","inReplyTo":"cover.1599726439.git.liu.denton@gmail.com","subject":"[PATCH 1/2] gitk: replace spaces with tabs","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2020-09-10T08:27:41Z","receivedAt":"2020-09-10T08:30:21Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The source code is a mix of tabs and spaces. The indentation style\ncurrently is four spaces per indent level but uses tabs every other\nlevel (at eight spaces). Fix this inconsistent spacing and tabbing by\njust using a tab-indent for everything.\n\nThis was done mechanically using the following vim commands:\n\n\t:set tabstop=8\n\t:set expandtab\n\t:retab\n\t:set tabstop=4\n\t:set noexpandtab\n\t:retab!\n\t:set tabstop=8\n\nA future commit will manually clean up the code style errors introduced\nby this patch.\n\nThis patch should be empty with `--ignore-all-space`.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n gitk | 20408 ++++++++++++++++++++++++++++-----------------------------\n 1 file changed, 10204 insertions(+), 10204 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex da84e22dd4..7efb106e52 100755\n--- a/gitk\n+++ b/gitk\n@@ -10,37 +10,37 @@ exec wish \"$0\" -- \"$@\"\n package require Tk\n \n proc hasworktree {} {\n-    return [expr {[exec git rev-parse --is-bare-repository] == \"false\" &&\n-\t\t  [exec git rev-parse --is-inside-git-dir] == \"false\"}]\n+\treturn [expr {[exec git rev-parse --is-bare-repository] == \"false\" &&\n+\t\t\t\t  [exec git rev-parse --is-inside-git-dir] == \"false\"}]\n }\n \n proc reponame {} {\n-    global gitdir\n-    set n [file normalize $gitdir]\n-    if {[string match \"*/.git\" $n]} {\n-\tset n [string range $n 0 end-5]\n-    }\n-    return [file tail $n]\n+\tglobal gitdir\n+\tset n [file normalize $gitdir]\n+\tif {[string match \"*/.git\" $n]} {\n+\t\tset n [string range $n 0 end-5]\n+\t}\n+\treturn [file tail $n]\n }\n \n proc gitworktree {} {\n-    variable _gitworktree\n-    if {[info exists _gitworktree]} {\n+\tvariable _gitworktree\n+\tif {[info exists _gitworktree]} {\n+\t\treturn $_gitworktree\n+\t}\n+\t# v1.7.0 introduced --show-toplevel to return the canonical work-tree\n+\tif {[catch {set _gitworktree [exec git rev-parse --show-toplevel]}]} {\n+\t\t# try to set work tree from environment, core.worktree or use\n+\t\t# cdup to obtain a relative path to the top of the worktree. If\n+\t\t# run from the top, the ./ prefix ensures normalize expands pwd.\n+\t\tif {[catch { set _gitworktree $env(GIT_WORK_TREE) }]} {\n+\t\t\tcatch {set _gitworktree [exec git config --get core.worktree]}\n+\t\t\tif {$_gitworktree eq \"\"} {\n+\t\t\t\tset _gitworktree [file normalize ./[exec git rev-parse --show-cdup]]\n+\t\t\t}\n+\t\t}\n+\t}\n \treturn $_gitworktree\n-    }\n-    # v1.7.0 introduced --show-toplevel to return the canonical work-tree\n-    if {[catch {set _gitworktree [exec git rev-parse --show-toplevel]}]} {\n-        # try to set work tree from environment, core.worktree or use\n-        # cdup to obtain a relative path to the top of the worktree. If\n-        # run from the top, the ./ prefix ensures normalize expands pwd.\n-        if {[catch { set _gitworktree $env(GIT_WORK_TREE) }]} {\n-\t    catch {set _gitworktree [exec git config --get core.worktree]}\n-\t    if {$_gitworktree eq \"\"} {\n-\t\tset _gitworktree [file normalize ./[exec git rev-parse --show-cdup]]\n-\t    }\n-        }\n-    }\n-    return $_gitworktree\n }\n \n # A simple scheduler for compute-intensive stuff.\n@@ -49,1942 +49,1942 @@ proc gitworktree {} {\n # run before X event handlers, so reading from a fast source can\n # make the GUI completely unresponsive.\n proc run args {\n-    global isonrunq runq currunq\n+\tglobal isonrunq runq currunq\n \n-    set script $args\n-    if {[info exists isonrunq($script)]} return\n-    if {$runq eq {} && ![info exists currunq]} {\n-\tafter idle dorunq\n-    }\n-    lappend runq [list {} $script]\n-    set isonrunq($script) 1\n+\tset script $args\n+\tif {[info exists isonrunq($script)]} return\n+\tif {$runq eq {} && ![info exists currunq]} {\n+\t\tafter idle dorunq\n+\t}\n+\tlappend runq [list {} $script]\n+\tset isonrunq($script) 1\n }\n \n proc filerun {fd script} {\n-    fileevent $fd readable [list filereadable $fd $script]\n+\tfileevent $fd readable [list filereadable $fd $script]\n }\n \n proc filereadable {fd script} {\n-    global runq currunq\n+\tglobal runq currunq\n \n-    fileevent $fd readable {}\n-    if {$runq eq {} && ![info exists currunq]} {\n-\tafter idle dorunq\n-    }\n-    lappend runq [list $fd $script]\n+\tfileevent $fd readable {}\n+\tif {$runq eq {} && ![info exists currunq]} {\n+\t\tafter idle dorunq\n+\t}\n+\tlappend runq [list $fd $script]\n }\n \n proc nukefile {fd} {\n-    global runq\n+\tglobal runq\n \n-    for {set i 0} {$i < [llength $runq]} {} {\n-\tif {[lindex $runq $i 0] eq $fd} {\n-\t    set runq [lreplace $runq $i $i]\n-\t} else {\n-\t    incr i\n+\tfor {set i 0} {$i < [llength $runq]} {} {\n+\t\tif {[lindex $runq $i 0] eq $fd} {\n+\t\t\tset runq [lreplace $runq $i $i]\n+\t\t} else {\n+\t\t\tincr i\n+\t\t}\n \t}\n-    }\n }\n \n proc dorunq {} {\n-    global isonrunq runq currunq\n+\tglobal isonrunq runq currunq\n \n-    set tstart [clock clicks -milliseconds]\n-    set t0 $tstart\n-    while {[llength $runq] > 0} {\n-\tset fd [lindex $runq 0 0]\n-\tset script [lindex $runq 0 1]\n-\tset currunq [lindex $runq 0]\n-\tset runq [lrange $runq 1 end]\n-\tset repeat [eval $script]\n-\tunset currunq\n-\tset t1 [clock clicks -milliseconds]\n-\tset t [expr {$t1 - $t0}]\n-\tif {$repeat ne {} && $repeat} {\n-\t    if {$fd eq {} || $repeat == 2} {\n-\t\t# script returns 1 if it wants to be readded\n-\t\t# file readers return 2 if they could do more straight away\n-\t\tlappend runq [list $fd $script]\n-\t    } else {\n-\t\tfileevent $fd readable [list filereadable $fd $script]\n-\t    }\n-\t} elseif {$fd eq {}} {\n-\t    unset isonrunq($script)\n+\tset tstart [clock clicks -milliseconds]\n+\tset t0 $tstart\n+\twhile {[llength $runq] > 0} {\n+\t\tset fd [lindex $runq 0 0]\n+\t\tset script [lindex $runq 0 1]\n+\t\tset currunq [lindex $runq 0]\n+\t\tset runq [lrange $runq 1 end]\n+\t\tset repeat [eval $script]\n+\t\tunset currunq\n+\t\tset t1 [clock clicks -milliseconds]\n+\t\tset t [expr {$t1 - $t0}]\n+\t\tif {$repeat ne {} && $repeat} {\n+\t\t\tif {$fd eq {} || $repeat == 2} {\n+\t\t\t\t# script returns 1 if it wants to be readded\n+\t\t\t\t# file readers return 2 if they could do more straight away\n+\t\t\t\tlappend runq [list $fd $script]\n+\t\t\t} else {\n+\t\t\t\tfileevent $fd readable [list filereadable $fd $script]\n+\t\t\t}\n+\t\t} elseif {$fd eq {}} {\n+\t\t\tunset isonrunq($script)\n+\t\t}\n+\t\tset t0 $t1\n+\t\tif {$t1 - $tstart >= 80} break\n+\t}\n+\tif {$runq ne {}} {\n+\t\tafter idle dorunq\n \t}\n-\tset t0 $t1\n-\tif {$t1 - $tstart >= 80} break\n-    }\n-    if {$runq ne {}} {\n-\tafter idle dorunq\n-    }\n }\n \n proc reg_instance {fd} {\n-    global commfd leftover loginstance\n+\tglobal commfd leftover loginstance\n \n-    set i [incr loginstance]\n-    set commfd($i) $fd\n-    set leftover($i) {}\n-    return $i\n+\tset i [incr loginstance]\n+\tset commfd($i) $fd\n+\tset leftover($i) {}\n+\treturn $i\n }\n \n proc unmerged_files {files} {\n-    global nr_unmerged\n+\tglobal nr_unmerged\n \n-    # find the list of unmerged files\n-    set mlist {}\n-    set nr_unmerged 0\n-    if {[catch {\n-\tset fd [open \"| git ls-files -u\" r]\n-    } err]} {\n-\tshow_error {} . \"[mc \"Couldn't get list of unmerged files:\"] $err\"\n-\texit 1\n-    }\n-    while {[gets $fd line] >= 0} {\n-\tset i [string first \"\\t\" $line]\n-\tif {$i < 0} continue\n-\tset fname [string range $line [expr {$i+1}] end]\n-\tif {[lsearch -exact $mlist $fname] >= 0} continue\n-\tincr nr_unmerged\n-\tif {$files eq {} || [path_filter $files $fname]} {\n-\t    lappend mlist $fname\n+\t# find the list of unmerged files\n+\tset mlist {}\n+\tset nr_unmerged 0\n+\tif {[catch {\n+\t\tset fd [open \"| git ls-files -u\" r]\n+\t} err]} {\n+\t\tshow_error {} . \"[mc \"Couldn't get list of unmerged files:\"] $err\"\n+\t\texit 1\n \t}\n-    }\n-    catch {close $fd}\n-    return $mlist\n+\twhile {[gets $fd line] >= 0} {\n+\t\tset i [string first \"\\t\" $line]\n+\t\tif {$i < 0} continue\n+\t\tset fname [string range $line [expr {$i+1}] end]\n+\t\tif {[lsearch -exact $mlist $fname] >= 0} continue\n+\t\tincr nr_unmerged\n+\t\tif {$files eq {} || [path_filter $files $fname]} {\n+\t\t\tlappend mlist $fname\n+\t\t}\n+\t}\n+\tcatch {close $fd}\n+\treturn $mlist\n }\n \n proc parseviewargs {n arglist} {\n-    global vdatemode vmergeonly vflags vdflags vrevs vfiltered vorigargs env\n-    global vinlinediff\n-    global worddiff git_version\n+\tglobal vdatemode vmergeonly vflags vdflags vrevs vfiltered vorigargs env\n+\tglobal vinlinediff\n+\tglobal worddiff git_version\n \n-    set vdatemode($n) 0\n-    set vmergeonly($n) 0\n-    set vinlinediff($n) 0\n-    set glflags {}\n-    set diffargs {}\n-    set nextisval 0\n-    set revargs {}\n-    set origargs $arglist\n-    set allknown 1\n-    set filtered 0\n-    set i -1\n-    foreach arg $arglist {\n-\tincr i\n-\tif {$nextisval} {\n-\t    lappend glflags $arg\n-\t    set nextisval 0\n-\t    continue\n+\tset vdatemode($n) 0\n+\tset vmergeonly($n) 0\n+\tset vinlinediff($n) 0\n+\tset glflags {}\n+\tset diffargs {}\n+\tset nextisval 0\n+\tset revargs {}\n+\tset origargs $arglist\n+\tset allknown 1\n+\tset filtered 0\n+\tset i -1\n+\tforeach arg $arglist {\n+\t\tincr i\n+\t\tif {$nextisval} {\n+\t\t\tlappend glflags $arg\n+\t\t\tset nextisval 0\n+\t\t\tcontinue\n+\t\t}\n+\t\tswitch -glob -- $arg {\n+\t\t\t\"-d\" -\n+\t\t\t\"--date-order\" {\n+\t\t\t\tset vdatemode($n) 1\n+\t\t\t\t# remove from origargs in case we hit an unknown option\n+\t\t\t\tset origargs [lreplace $origargs $i $i]\n+\t\t\t\tincr i -1\n+\t\t\t}\n+\t\t\t\"-[puabwcrRBMC]\" -\n+\t\t\t\"--no-renames\" - \"--full-index\" - \"--binary\" - \"--abbrev=*\" -\n+\t\t\t\"--find-copies-harder\" - \"-l*\" - \"--ext-diff\" - \"--no-ext-diff\" -\n+\t\t\t\"--src-prefix=*\" - \"--dst-prefix=*\" - \"--no-prefix\" -\n+\t\t\t\"-O*\" - \"--text\" - \"--full-diff\" - \"--ignore-space-at-eol\" -\n+\t\t\t\"--ignore-space-change\" - \"-U*\" - \"--unified=*\" {\n+\t\t\t\t# These request or affect diff output, which we don't want.\n+\t\t\t\t# Some could be used to set our defaults for diff display.\n+\t\t\t\tlappend diffargs $arg\n+\t\t\t}\n+\t\t\t\"--raw\" - \"--patch-with-raw\" - \"--patch-with-stat\" -\n+\t\t\t\"--name-only\" - \"--name-status\" - \"--color\" -\n+\t\t\t\"--log-size\" - \"--pretty=*\" - \"--decorate\" - \"--abbrev-commit\" -\n+\t\t\t\"--cc\" - \"-z\" - \"--header\" - \"--parents\" - \"--boundary\" -\n+\t\t\t\"--no-color\" - \"-g\" - \"--walk-reflogs\" - \"--no-walk\" -\n+\t\t\t\"--timestamp\" - \"relative-date\" - \"--date=*\" - \"--stdin\" -\n+\t\t\t\"--objects\" - \"--objects-edge\" - \"--reverse\" {\n+\t\t\t\t# These cause our parsing of git log's output to fail, or else\n+\t\t\t\t# they're options we want to set ourselves, so ignore them.\n+\t\t\t}\n+\t\t\t\"--color-words*\" - \"--word-diff=color\" {\n+\t\t\t\t# These trigger a word diff in the console interface,\n+\t\t\t\t# so help the user by enabling our own support\n+\t\t\t\tif {[package vcompare $git_version \"1.7.2\"] >= 0} {\n+\t\t\t\t\tset worddiff [mc \"Color words\"]\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\t\"--word-diff*\" {\n+\t\t\t\tif {[package vcompare $git_version \"1.7.2\"] >= 0} {\n+\t\t\t\t\tset worddiff [mc \"Markup words\"]\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\t\"--stat=*\" - \"--numstat\" - \"--shortstat\" - \"--summary\" -\n+\t\t\t\"--check\" - \"--exit-code\" - \"--quiet\" - \"--topo-order\" -\n+\t\t\t\"--full-history\" - \"--dense\" - \"--sparse\" -\n+\t\t\t\"--follow\" - \"--left-right\" - \"--encoding=*\" {\n+\t\t\t\t# These are harmless, and some are even useful\n+\t\t\t\tlappend glflags $arg\n+\t\t\t}\n+\t\t\t\"--diff-filter=*\" - \"--no-merges\" - \"--unpacked\" -\n+\t\t\t\"--max-count=*\" - \"--skip=*\" - \"--since=*\" - \"--after=*\" -\n+\t\t\t\"--until=*\" - \"--before=*\" - \"--max-age=*\" - \"--min-age=*\" -\n+\t\t\t\"--author=*\" - \"--committer=*\" - \"--grep=*\" - \"-[iE]\" -\n+\t\t\t\"--remove-empty\" - \"--first-parent\" - \"--cherry-pick\" -\n+\t\t\t\"-S*\" - \"-G*\" - \"--pickaxe-all\" - \"--pickaxe-regex\" -\n+\t\t\t\"--simplify-by-decoration\" {\n+\t\t\t\t# These mean that we get a subset of the commits\n+\t\t\t\tset filtered 1\n+\t\t\t\tlappend glflags $arg\n+\t\t\t}\n+\t\t\t\"-L*\" {\n+\t\t\t\t# Line-log with 'stuck' argument (unstuck form is\n+\t\t\t\t# not supported)\n+\t\t\t\tset filtered 1\n+\t\t\t\tset vinlinediff($n) 1\n+\t\t\t\tset allknown 0\n+\t\t\t\tlappend glflags $arg\n+\t\t\t}\n+\t\t\t\"-n\" {\n+\t\t\t\t# This appears to be the only one that has a value as a\n+\t\t\t\t# separate word following it\n+\t\t\t\tset filtered 1\n+\t\t\t\tset nextisval 1\n+\t\t\t\tlappend glflags $arg\n+\t\t\t}\n+\t\t\t\"--not\" - \"--all\" {\n+\t\t\t\tlappend revargs $arg\n+\t\t\t}\n+\t\t\t\"--merge\" {\n+\t\t\t\tset vmergeonly($n) 1\n+\t\t\t\t# git rev-parse doesn't understand --merge\n+\t\t\t\tlappend revargs --gitk-symmetric-diff-marker MERGE_HEAD...HEAD\n+\t\t\t}\n+\t\t\t\"--no-replace-objects\" {\n+\t\t\t\tset env(GIT_NO_REPLACE_OBJECTS) \"1\"\n+\t\t\t}\n+\t\t\t\"-*\" {\n+\t\t\t\t# Other flag arguments including -<n>\n+\t\t\t\tif {[string is digit -strict [string range $arg 1 end]]} {\n+\t\t\t\t\tset filtered 1\n+\t\t\t\t} else {\n+\t\t\t\t\t# a flag argument that we don't recognize;\n+\t\t\t\t\t# that means we can't optimize\n+\t\t\t\t\tset allknown 0\n+\t\t\t\t}\n+\t\t\t\tlappend glflags $arg\n+\t\t\t}\n+\t\t\tdefault {\n+\t\t\t\t# Non-flag arguments specify commits or ranges of commits\n+\t\t\t\tif {[string match \"*...*\" $arg]} {\n+\t\t\t\t\tlappend revargs --gitk-symmetric-diff-marker\n+\t\t\t\t}\n+\t\t\t\tlappend revargs $arg\n+\t\t\t}\n+\t\t}\n \t}\n-\tswitch -glob -- $arg {\n-\t    \"-d\" -\n-\t    \"--date-order\" {\n-\t\tset vdatemode($n) 1\n-\t\t# remove from origargs in case we hit an unknown option\n-\t\tset origargs [lreplace $origargs $i $i]\n-\t\tincr i -1\n-\t    }\n-\t    \"-[puabwcrRBMC]\" -\n-\t    \"--no-renames\" - \"--full-index\" - \"--binary\" - \"--abbrev=*\" -\n-\t    \"--find-copies-harder\" - \"-l*\" - \"--ext-diff\" - \"--no-ext-diff\" -\n-\t    \"--src-prefix=*\" - \"--dst-prefix=*\" - \"--no-prefix\" -\n-\t    \"-O*\" - \"--text\" - \"--full-diff\" - \"--ignore-space-at-eol\" -\n-\t    \"--ignore-space-change\" - \"-U*\" - \"--unified=*\" {\n-\t\t# These request or affect diff output, which we don't want.\n-\t\t# Some could be used to set our defaults for diff display.\n-\t\tlappend diffargs $arg\n-\t    }\n-\t    \"--raw\" - \"--patch-with-raw\" - \"--patch-with-stat\" -\n-\t    \"--name-only\" - \"--name-status\" - \"--color\" -\n-\t    \"--log-size\" - \"--pretty=*\" - \"--decorate\" - \"--abbrev-commit\" -\n-\t    \"--cc\" - \"-z\" - \"--header\" - \"--parents\" - \"--boundary\" -\n-\t    \"--no-color\" - \"-g\" - \"--walk-reflogs\" - \"--no-walk\" -\n-\t    \"--timestamp\" - \"relative-date\" - \"--date=*\" - \"--stdin\" -\n-\t    \"--objects\" - \"--objects-edge\" - \"--reverse\" {\n-\t\t# These cause our parsing of git log's output to fail, or else\n-\t\t# they're options we want to set ourselves, so ignore them.\n-\t    }\n-\t    \"--color-words*\" - \"--word-diff=color\" {\n-\t\t# These trigger a word diff in the console interface,\n-\t\t# so help the user by enabling our own support\n-\t\tif {[package vcompare $git_version \"1.7.2\"] >= 0} {\n-\t\t    set worddiff [mc \"Color words\"]\n-\t\t}\n-\t    }\n-\t    \"--word-diff*\" {\n-\t\tif {[package vcompare $git_version \"1.7.2\"] >= 0} {\n-\t\t    set worddiff [mc \"Markup words\"]\n-\t\t}\n-\t    }\n-\t    \"--stat=*\" - \"--numstat\" - \"--shortstat\" - \"--summary\" -\n-\t    \"--check\" - \"--exit-code\" - \"--quiet\" - \"--topo-order\" -\n-\t    \"--full-history\" - \"--dense\" - \"--sparse\" -\n-\t    \"--follow\" - \"--left-right\" - \"--encoding=*\" {\n-\t\t# These are harmless, and some are even useful\n-\t\tlappend glflags $arg\n-\t    }\n-\t    \"--diff-filter=*\" - \"--no-merges\" - \"--unpacked\" -\n-\t    \"--max-count=*\" - \"--skip=*\" - \"--since=*\" - \"--after=*\" -\n-\t    \"--until=*\" - \"--before=*\" - \"--max-age=*\" - \"--min-age=*\" -\n-\t    \"--author=*\" - \"--committer=*\" - \"--grep=*\" - \"-[iE]\" -\n-\t    \"--remove-empty\" - \"--first-parent\" - \"--cherry-pick\" -\n-\t    \"-S*\" - \"-G*\" - \"--pickaxe-all\" - \"--pickaxe-regex\" -\n-\t    \"--simplify-by-decoration\" {\n-\t\t# These mean that we get a subset of the commits\n-\t\tset filtered 1\n-\t\tlappend glflags $arg\n-\t    }\n-\t    \"-L*\" {\n-\t\t# Line-log with 'stuck' argument (unstuck form is\n-\t\t# not supported)\n-\t\tset filtered 1\n-\t\tset vinlinediff($n) 1\n-\t\tset allknown 0\n-\t\tlappend glflags $arg\n-\t    }\n-\t    \"-n\" {\n-\t\t# This appears to be the only one that has a value as a\n-\t\t# separate word following it\n-\t\tset filtered 1\n-\t\tset nextisval 1\n-\t\tlappend glflags $arg\n-\t    }\n-\t    \"--not\" - \"--all\" {\n-\t\tlappend revargs $arg\n-\t    }\n-\t    \"--merge\" {\n-\t\tset vmergeonly($n) 1\n-\t\t# git rev-parse doesn't understand --merge\n-\t\tlappend revargs --gitk-symmetric-diff-marker MERGE_HEAD...HEAD\n-\t    }\n-\t    \"--no-replace-objects\" {\n-\t\tset env(GIT_NO_REPLACE_OBJECTS) \"1\"\n-\t    }\n-\t    \"-*\" {\n-\t\t# Other flag arguments including -<n>\n-\t\tif {[string is digit -strict [string range $arg 1 end]]} {\n-\t\t    set filtered 1\n-\t\t} else {\n-\t\t    # a flag argument that we don't recognize;\n-\t\t    # that means we can't optimize\n-\t\t    set allknown 0\n-\t\t}\n-\t\tlappend glflags $arg\n-\t    }\n-\t    default {\n-\t\t# Non-flag arguments specify commits or ranges of commits\n-\t\tif {[string match \"*...*\" $arg]} {\n-\t\t    lappend revargs --gitk-symmetric-diff-marker\n-\t\t}\n-\t\tlappend revargs $arg\n-\t    }\n-\t}\n-    }\n-    set vdflags($n) $diffargs\n-    set vflags($n) $glflags\n-    set vrevs($n) $revargs\n-    set vfiltered($n) $filtered\n-    set vorigargs($n) $origargs\n-    return $allknown\n+\tset vdflags($n) $diffargs\n+\tset vflags($n) $glflags\n+\tset vrevs($n) $revargs\n+\tset vfiltered($n) $filtered\n+\tset vorigargs($n) $origargs\n+\treturn $allknown\n }\n \n proc parseviewrevs {view revs} {\n-    global vposids vnegids\n+\tglobal vposids vnegids\n \n-    if {$revs eq {}} {\n-\tset revs HEAD\n-    } elseif {[lsearch -exact $revs --all] >= 0} {\n-\tlappend revs HEAD\n-    }\n-    if {[catch {set ids [eval exec git rev-parse $revs]} err]} {\n-\t# we get stdout followed by stderr in $err\n-\t# for an unknown rev, git rev-parse echoes it and then errors out\n-\tset errlines [split $err \"\\n\"]\n-\tset badrev {}\n-\tfor {set l 0} {$l < [llength $errlines]} {incr l} {\n-\t    set line [lindex $errlines $l]\n-\t    if {!([string length $line] == 40 && [string is xdigit $line])} {\n-\t\tif {[string match \"fatal:*\" $line]} {\n-\t\t    if {[string match \"fatal: ambiguous argument*\" $line]\n-\t\t\t&& $badrev ne {}} {\n-\t\t\tif {[llength $badrev] == 1} {\n-\t\t\t    set err \"unknown revision $badrev\"\n-\t\t\t} else {\n-\t\t\t    set err \"unknown revisions: [join $badrev \", \"]\"\n+\tif {$revs eq {}} {\n+\t\tset revs HEAD\n+\t} elseif {[lsearch -exact $revs --all] >= 0} {\n+\t\tlappend revs HEAD\n+\t}\n+\tif {[catch {set ids [eval exec git rev-parse $revs]} err]} {\n+\t\t# we get stdout followed by stderr in $err\n+\t\t# for an unknown rev, git rev-parse echoes it and then errors out\n+\t\tset errlines [split $err \"\\n\"]\n+\t\tset badrev {}\n+\t\tfor {set l 0} {$l < [llength $errlines]} {incr l} {\n+\t\t\tset line [lindex $errlines $l]\n+\t\t\tif {!([string length $line] == 40 && [string is xdigit $line])} {\n+\t\t\t\tif {[string match \"fatal:*\" $line]} {\n+\t\t\t\t\tif {[string match \"fatal: ambiguous argument*\" $line]\n+\t\t\t\t\t\t&& $badrev ne {}} {\n+\t\t\t\t\t\tif {[llength $badrev] == 1} {\n+\t\t\t\t\t\t\tset err \"unknown revision $badrev\"\n+\t\t\t\t\t\t} else {\n+\t\t\t\t\t\t\tset err \"unknown revisions: [join $badrev \", \"]\"\n+\t\t\t\t\t\t}\n+\t\t\t\t\t} else {\n+\t\t\t\t\t\tset err [join [lrange $errlines $l end] \"\\n\"]\n+\t\t\t\t\t}\n+\t\t\t\t\tbreak\n+\t\t\t\t}\n+\t\t\t\tlappend badrev $line\n \t\t\t}\n-\t\t    } else {\n-\t\t\tset err [join [lrange $errlines $l end] \"\\n\"]\n-\t\t    }\n-\t\t    break\n \t\t}\n-\t\tlappend badrev $line\n-\t    }\n+\t\terror_popup \"[mc \"Error parsing revisions:\"] $err\"\n+\t\treturn {}\n \t}\n-\terror_popup \"[mc \"Error parsing revisions:\"] $err\"\n-\treturn {}\n-    }\n-    set ret {}\n-    set pos {}\n-    set neg {}\n-    set sdm 0\n-    foreach id [split $ids \"\\n\"] {\n-\tif {$id eq \"--gitk-symmetric-diff-marker\"} {\n-\t    set sdm 4\n-\t} elseif {[string match \"^*\" $id]} {\n-\t    if {$sdm != 1} {\n-\t\tlappend ret $id\n-\t\tif {$sdm == 3} {\n-\t\t    set sdm 0\n+\tset ret {}\n+\tset pos {}\n+\tset neg {}\n+\tset sdm 0\n+\tforeach id [split $ids \"\\n\"] {\n+\t\tif {$id eq \"--gitk-symmetric-diff-marker\"} {\n+\t\t\tset sdm 4\n+\t\t} elseif {[string match \"^*\" $id]} {\n+\t\t\tif {$sdm != 1} {\n+\t\t\t\tlappend ret $id\n+\t\t\t\tif {$sdm == 3} {\n+\t\t\t\t\tset sdm 0\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tlappend neg [string range $id 1 end]\n+\t\t} else {\n+\t\t\tif {$sdm != 2} {\n+\t\t\t\tlappend ret $id\n+\t\t\t} else {\n+\t\t\t\tlset ret end $id...[lindex $ret end]\n+\t\t\t}\n+\t\t\tlappend pos $id\n \t\t}\n-\t    }\n-\t    lappend neg [string range $id 1 end]\n-\t} else {\n-\t    if {$sdm != 2} {\n-\t\tlappend ret $id\n-\t    } else {\n-\t\tlset ret end $id...[lindex $ret end]\n-\t    }\n-\t    lappend pos $id\n+\t\tincr sdm -1\n \t}\n-\tincr sdm -1\n-    }\n-    set vposids($view) $pos\n-    set vnegids($view) $neg\n-    return $ret\n+\tset vposids($view) $pos\n+\tset vnegids($view) $neg\n+\treturn $ret\n }\n \n # Start off a git log process and arrange to read its output\n proc start_rev_list {view} {\n-    global startmsecs commitidx viewcomplete curview\n-    global tclencoding\n-    global viewargs viewargscmd viewfiles vfilelimit\n-    global showlocalchanges\n-    global viewactive viewinstances vmergeonly\n-    global mainheadid viewmainheadid viewmainheadid_orig\n-    global vcanopt vflags vrevs vorigargs\n-    global show_notes\n+\tglobal startmsecs commitidx viewcomplete curview\n+\tglobal tclencoding\n+\tglobal viewargs viewargscmd viewfiles vfilelimit\n+\tglobal showlocalchanges\n+\tglobal viewactive viewinstances vmergeonly\n+\tglobal mainheadid viewmainheadid viewmainheadid_orig\n+\tglobal vcanopt vflags vrevs vorigargs\n+\tglobal show_notes\n \n-    set startmsecs [clock clicks -milliseconds]\n-    set commitidx($view) 0\n-    # these are set this way for the error exits\n-    set viewcomplete($view) 1\n-    set viewactive($view) 0\n-    varcinit $view\n+\tset startmsecs [clock clicks -milliseconds]\n+\tset commitidx($view) 0\n+\t# these are set this way for the error exits\n+\tset viewcomplete($view) 1\n+\tset viewactive($view) 0\n+\tvarcinit $view\n+\n+\tset args $viewargs($view)\n+\tif {$viewargscmd($view) ne {}} {\n+\t\tif {[catch {\n+\t\t\tset str [exec sh -c $viewargscmd($view)]\n+\t\t} err]} {\n+\t\t\terror_popup \"[mc \"Error executing --argscmd command:\"] $err\"\n+\t\t\treturn 0\n+\t\t}\n+\t\tset args [concat $args [split $str \"\\n\"]]\n+\t}\n+\tset vcanopt($view) [parseviewargs $view $args]\n+\n+\tset files $viewfiles($view)\n+\tif {$vmergeonly($view)} {\n+\t\tset files [unmerged_files $files]\n+\t\tif {$files eq {}} {\n+\t\t\tglobal nr_unmerged\n+\t\t\tif {$nr_unmerged == 0} {\n+\t\t\t\terror_popup [mc \"No files selected: --merge specified but\\\n+\t\t\t\t\t\t\t no files are unmerged.\"]\n+\t\t\t} else {\n+\t\t\t\terror_popup [mc \"No files selected: --merge specified but\\\n+\t\t\t\t\t\t\t no unmerged files are within file limit.\"]\n+\t\t\t}\n+\t\t\treturn 0\n+\t\t}\n+\t}\n+\tset vfilelimit($view) $files\n+\n+\tif {$vcanopt($view)} {\n+\t\tset revs [parseviewrevs $view $vrevs($view)]\n+\t\tif {$revs eq {}} {\n+\t\t\treturn 0\n+\t\t}\n+\t\tset args [concat $vflags($view) $revs]\n+\t} else {\n+\t\tset args $vorigargs($view)\n+\t}\n \n-    set args $viewargs($view)\n-    if {$viewargscmd($view) ne {}} {\n \tif {[catch {\n-\t    set str [exec sh -c $viewargscmd($view)]\n+\t\tset fd [open [concat | git log --no-color -z --pretty=raw $show_notes \\\n+\t\t\t\t\t\t--parents --boundary $args \"--\" $files] r]\n \t} err]} {\n-\t    error_popup \"[mc \"Error executing --argscmd command:\"] $err\"\n-\t    return 0\n+\t\terror_popup \"[mc \"Error executing git log:\"] $err\"\n+\t\treturn 0\n \t}\n-\tset args [concat $args [split $str \"\\n\"]]\n-    }\n-    set vcanopt($view) [parseviewargs $view $args]\n-\n-    set files $viewfiles($view)\n-    if {$vmergeonly($view)} {\n-\tset files [unmerged_files $files]\n-\tif {$files eq {}} {\n-\t    global nr_unmerged\n-\t    if {$nr_unmerged == 0} {\n-\t\terror_popup [mc \"No files selected: --merge specified but\\\n-\t\t\t     no files are unmerged.\"]\n-\t    } else {\n-\t\terror_popup [mc \"No files selected: --merge specified but\\\n-\t\t\t     no unmerged files are within file limit.\"]\n-\t    }\n-\t    return 0\n+\tset i [reg_instance $fd]\n+\tset viewinstances($view) [list $i]\n+\tset viewmainheadid($view) $mainheadid\n+\tset viewmainheadid_orig($view) $mainheadid\n+\tif {$files ne {} && $mainheadid ne {}} {\n+\t\tget_viewmainhead $view\n \t}\n-    }\n-    set vfilelimit($view) $files\n-\n-    if {$vcanopt($view)} {\n-\tset revs [parseviewrevs $view $vrevs($view)]\n-\tif {$revs eq {}} {\n-\t    return 0\n+\tif {$showlocalchanges && $viewmainheadid($view) ne {}} {\n+\t\tinterestedin $viewmainheadid($view) dodiffindex\n \t}\n-\tset args [concat $vflags($view) $revs]\n-    } else {\n-\tset args $vorigargs($view)\n-    }\n-\n-    if {[catch {\n-\tset fd [open [concat | git log --no-color -z --pretty=raw $show_notes \\\n-\t\t\t--parents --boundary $args \"--\" $files] r]\n-    } err]} {\n-\terror_popup \"[mc \"Error executing git log:\"] $err\"\n-\treturn 0\n-    }\n-    set i [reg_instance $fd]\n-    set viewinstances($view) [list $i]\n-    set viewmainheadid($view) $mainheadid\n-    set viewmainheadid_orig($view) $mainheadid\n-    if {$files ne {} && $mainheadid ne {}} {\n-\tget_viewmainhead $view\n-    }\n-    if {$showlocalchanges && $viewmainheadid($view) ne {}} {\n-\tinterestedin $viewmainheadid($view) dodiffindex\n-    }\n-    fconfigure $fd -blocking 0 -translation lf -eofchar {}\n-    if {$tclencoding != {}} {\n-\tfconfigure $fd -encoding $tclencoding\n-    }\n-    filerun $fd [list getcommitlines $fd $i $view 0]\n-    nowbusy $view [mc \"Reading\"]\n-    set viewcomplete($view) 0\n-    set viewactive($view) 1\n-    return 1\n+\tfconfigure $fd -blocking 0 -translation lf -eofchar {}\n+\tif {$tclencoding != {}} {\n+\t\tfconfigure $fd -encoding $tclencoding\n+\t}\n+\tfilerun $fd [list getcommitlines $fd $i $view 0]\n+\tnowbusy $view [mc \"Reading\"]\n+\tset viewcomplete($view) 0\n+\tset viewactive($view) 1\n+\treturn 1\n }\n \n proc stop_instance {inst} {\n-    global commfd leftover\n+\tglobal commfd leftover\n \n-    set fd $commfd($inst)\n-    catch {\n-\tset pid [pid $fd]\n+\tset fd $commfd($inst)\n+\tcatch {\n+\t\tset pid [pid $fd]\n \n-\tif {$::tcl_platform(platform) eq {windows}} {\n-\t    exec taskkill /pid $pid\n-\t} else {\n-\t    exec kill $pid\n+\t\tif {$::tcl_platform(platform) eq {windows}} {\n+\t\t\texec taskkill /pid $pid\n+\t\t} else {\n+\t\t\texec kill $pid\n+\t\t}\n \t}\n-    }\n-    catch {close $fd}\n-    nukefile $fd\n-    unset commfd($inst)\n-    unset leftover($inst)\n+\tcatch {close $fd}\n+\tnukefile $fd\n+\tunset commfd($inst)\n+\tunset leftover($inst)\n }\n \n proc stop_backends {} {\n-    global commfd\n+\tglobal commfd\n \n-    foreach inst [array names commfd] {\n-\tstop_instance $inst\n-    }\n+\tforeach inst [array names commfd] {\n+\t\tstop_instance $inst\n+\t}\n }\n \n proc stop_rev_list {view} {\n-    global viewinstances\n+\tglobal viewinstances\n \n-    foreach inst $viewinstances($view) {\n-\tstop_instance $inst\n-    }\n-    set viewinstances($view) {}\n+\tforeach inst $viewinstances($view) {\n+\t\tstop_instance $inst\n+\t}\n+\tset viewinstances($view) {}\n }\n \n proc reset_pending_select {selid} {\n-    global pending_select mainheadid selectheadid\n+\tglobal pending_select mainheadid selectheadid\n \n-    if {$selid ne {}} {\n-\tset pending_select $selid\n-    } elseif {$selectheadid ne {}} {\n-\tset pending_select $selectheadid\n-    } else {\n-\tset pending_select $mainheadid\n-    }\n+\tif {$selid ne {}} {\n+\t\tset pending_select $selid\n+\t} elseif {$selectheadid ne {}} {\n+\t\tset pending_select $selectheadid\n+\t} else {\n+\t\tset pending_select $mainheadid\n+\t}\n }\n \n proc getcommits {selid} {\n-    global canv curview need_redisplay viewactive\n+\tglobal canv curview need_redisplay viewactive\n \n-    initlayout\n-    if {[start_rev_list $curview]} {\n-\treset_pending_select $selid\n-\tshow_status [mc \"Reading commits...\"]\n-\tset need_redisplay 1\n-    } else {\n-\tshow_status [mc \"No commits selected\"]\n-    }\n+\tinitlayout\n+\tif {[start_rev_list $curview]} {\n+\t\treset_pending_select $selid\n+\t\tshow_status [mc \"Reading commits...\"]\n+\t\tset need_redisplay 1\n+\t} else {\n+\t\tshow_status [mc \"No commits selected\"]\n+\t}\n }\n \n proc updatecommits {} {\n-    global curview vcanopt vorigargs vfilelimit viewinstances\n-    global viewactive viewcomplete tclencoding\n-    global startmsecs showneartags showlocalchanges\n-    global mainheadid viewmainheadid viewmainheadid_orig pending_select\n-    global hasworktree\n-    global varcid vposids vnegids vflags vrevs\n-    global show_notes\n+\tglobal curview vcanopt vorigargs vfilelimit viewinstances\n+\tglobal viewactive viewcomplete tclencoding\n+\tglobal startmsecs showneartags showlocalchanges\n+\tglobal mainheadid viewmainheadid viewmainheadid_orig pending_select\n+\tglobal hasworktree\n+\tglobal varcid vposids vnegids vflags vrevs\n+\tglobal show_notes\n \n-    set hasworktree [hasworktree]\n-    rereadrefs\n-    set view $curview\n-    if {$mainheadid ne $viewmainheadid_orig($view)} {\n-\tif {$showlocalchanges} {\n-\t    dohidelocalchanges\n-\t}\n-\tset viewmainheadid($view) $mainheadid\n-\tset viewmainheadid_orig($view) $mainheadid\n-\tif {$vfilelimit($view) ne {}} {\n-\t    get_viewmainhead $view\n-\t}\n-    }\n-    if {$showlocalchanges} {\n-\tdoshowlocalchanges\n-    }\n-    if {$vcanopt($view)} {\n-\tset oldpos $vposids($view)\n-\tset oldneg $vnegids($view)\n-\tset revs [parseviewrevs $view $vrevs($view)]\n-\tif {$revs eq {}} {\n-\t    return\n-\t}\n-\t# note: getting the delta when negative refs change is hard,\n-\t# and could require multiple git log invocations, so in that\n-\t# case we ask git log for all the commits (not just the delta)\n-\tif {$oldneg eq $vnegids($view)} {\n-\t    set newrevs {}\n-\t    set npos 0\n-\t    # take out positive refs that we asked for before or\n-\t    # that we have already seen\n-\t    foreach rev $revs {\n-\t\tif {[string length $rev] == 40} {\n-\t\t    if {[lsearch -exact $oldpos $rev] < 0\n-\t\t\t&& ![info exists varcid($view,$rev)]} {\n-\t\t\tlappend newrevs $rev\n-\t\t\tincr npos\n-\t\t    }\n-\t\t} else {\n-\t\t    lappend $newrevs $rev\n+\tset hasworktree [hasworktree]\n+\trereadrefs\n+\tset view $curview\n+\tif {$mainheadid ne $viewmainheadid_orig($view)} {\n+\t\tif {$showlocalchanges} {\n+\t\t\tdohidelocalchanges\n+\t\t}\n+\t\tset viewmainheadid($view) $mainheadid\n+\t\tset viewmainheadid_orig($view) $mainheadid\n+\t\tif {$vfilelimit($view) ne {}} {\n+\t\t\tget_viewmainhead $view\n \t\t}\n-\t    }\n-\t    if {$npos == 0} return\n-\t    set revs $newrevs\n-\t    set vposids($view) [lsort -unique [concat $oldpos $vposids($view)]]\n \t}\n-\tset args [concat $vflags($view) $revs --not $oldpos]\n-    } else {\n-\tset args $vorigargs($view)\n-    }\n-    if {[catch {\n-\tset fd [open [concat | git log --no-color -z --pretty=raw $show_notes \\\n-\t\t\t--parents --boundary $args \"--\" $vfilelimit($view)] r]\n-    } err]} {\n-\terror_popup \"[mc \"Error executing git log:\"] $err\"\n-\treturn\n-    }\n-    if {$viewactive($view) == 0} {\n-\tset startmsecs [clock clicks -milliseconds]\n-    }\n-    set i [reg_instance $fd]\n-    lappend viewinstances($view) $i\n-    fconfigure $fd -blocking 0 -translation lf -eofchar {}\n-    if {$tclencoding != {}} {\n-\tfconfigure $fd -encoding $tclencoding\n-    }\n-    filerun $fd [list getcommitlines $fd $i $view 1]\n-    incr viewactive($view)\n-    set viewcomplete($view) 0\n-    reset_pending_select {}\n-    nowbusy $view [mc \"Reading\"]\n-    if {$showneartags} {\n-\tgetallcommits\n-    }\n+\tif {$showlocalchanges} {\n+\t\tdoshowlocalchanges\n+\t}\n+\tif {$vcanopt($view)} {\n+\t\tset oldpos $vposids($view)\n+\t\tset oldneg $vnegids($view)\n+\t\tset revs [parseviewrevs $view $vrevs($view)]\n+\t\tif {$revs eq {}} {\n+\t\t\treturn\n+\t\t}\n+\t\t# note: getting the delta when negative refs change is hard,\n+\t\t# and could require multiple git log invocations, so in that\n+\t\t# case we ask git log for all the commits (not just the delta)\n+\t\tif {$oldneg eq $vnegids($view)} {\n+\t\t\tset newrevs {}\n+\t\t\tset npos 0\n+\t\t\t# take out positive refs that we asked for before or\n+\t\t\t# that we have already seen\n+\t\t\tforeach rev $revs {\n+\t\t\t\tif {[string length $rev] == 40} {\n+\t\t\t\t\tif {[lsearch -exact $oldpos $rev] < 0\n+\t\t\t\t\t\t&& ![info exists varcid($view,$rev)]} {\n+\t\t\t\t\t\tlappend newrevs $rev\n+\t\t\t\t\t\tincr npos\n+\t\t\t\t\t}\n+\t\t\t\t} else {\n+\t\t\t\t\tlappend $newrevs $rev\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tif {$npos == 0} return\n+\t\t\tset revs $newrevs\n+\t\t\tset vposids($view) [lsort -unique [concat $oldpos $vposids($view)]]\n+\t\t}\n+\t\tset args [concat $vflags($view) $revs --not $oldpos]\n+\t} else {\n+\t\tset args $vorigargs($view)\n+\t}\n+\tif {[catch {\n+\t\tset fd [open [concat | git log --no-color -z --pretty=raw $show_notes \\\n+\t\t\t\t\t\t--parents --boundary $args \"--\" $vfilelimit($view)] r]\n+\t} err]} {\n+\t\terror_popup \"[mc \"Error executing git log:\"] $err\"\n+\t\treturn\n+\t}\n+\tif {$viewactive($view) == 0} {\n+\t\tset startmsecs [clock clicks -milliseconds]\n+\t}\n+\tset i [reg_instance $fd]\n+\tlappend viewinstances($view) $i\n+\tfconfigure $fd -blocking 0 -translation lf -eofchar {}\n+\tif {$tclencoding != {}} {\n+\t\tfconfigure $fd -encoding $tclencoding\n+\t}\n+\tfilerun $fd [list getcommitlines $fd $i $view 1]\n+\tincr viewactive($view)\n+\tset viewcomplete($view) 0\n+\treset_pending_select {}\n+\tnowbusy $view [mc \"Reading\"]\n+\tif {$showneartags} {\n+\t\tgetallcommits\n+\t}\n }\n \n proc reloadcommits {} {\n-    global curview viewcomplete selectedline currentid thickerline\n-    global showneartags treediffs commitinterest cached_commitrow\n-    global targetid commitinfo\n+\tglobal curview viewcomplete selectedline currentid thickerline\n+\tglobal showneartags treediffs commitinterest cached_commitrow\n+\tglobal targetid commitinfo\n \n-    set selid {}\n-    if {$selectedline ne {}} {\n-\tset selid $currentid\n-    }\n+\tset selid {}\n+\tif {$selectedline ne {}} {\n+\t\tset selid $currentid\n+\t}\n \n-    if {!$viewcomplete($curview)} {\n-\tstop_rev_list $curview\n-    }\n-    resetvarcs $curview\n-    set selectedline {}\n-    unset -nocomplain currentid\n-    unset -nocomplain thickerline\n-    unset -nocomplain treediffs\n-    readrefs\n-    changedrefs\n-    if {$showneartags} {\n-\tgetallcommits\n-    }\n-    clear_display\n-    unset -nocomplain commitinfo\n-    unset -nocomplain commitinterest\n-    unset -nocomplain cached_commitrow\n-    unset -nocomplain targetid\n-    setcanvscroll\n-    getcommits $selid\n-    return 0\n+\tif {!$viewcomplete($curview)} {\n+\t\tstop_rev_list $curview\n+\t}\n+\tresetvarcs $curview\n+\tset selectedline {}\n+\tunset -nocomplain currentid\n+\tunset -nocomplain thickerline\n+\tunset -nocomplain treediffs\n+\treadrefs\n+\tchangedrefs\n+\tif {$showneartags} {\n+\t\tgetallcommits\n+\t}\n+\tclear_display\n+\tunset -nocomplain commitinfo\n+\tunset -nocomplain commitinterest\n+\tunset -nocomplain cached_commitrow\n+\tunset -nocomplain targetid\n+\tsetcanvscroll\n+\tgetcommits $selid\n+\treturn 0\n }\n \n # This makes a string representation of a positive integer which\n # sorts as a string in numerical order\n proc strrep {n} {\n-    if {$n < 16} {\n-\treturn [format \"%x\" $n]\n-    } elseif {$n < 256} {\n-\treturn [format \"x%.2x\" $n]\n-    } elseif {$n < 65536} {\n-\treturn [format \"y%.4x\" $n]\n-    }\n-    return [format \"z%.8x\" $n]\n+\tif {$n < 16} {\n+\t\treturn [format \"%x\" $n]\n+\t} elseif {$n < 256} {\n+\t\treturn [format \"x%.2x\" $n]\n+\t} elseif {$n < 65536} {\n+\t\treturn [format \"y%.4x\" $n]\n+\t}\n+\treturn [format \"z%.8x\" $n]\n }\n \n # Procedures used in reordering commits from git log (without\n # --topo-order) into the order for display.\n \n proc varcinit {view} {\n-    global varcstart vupptr vdownptr vleftptr vbackptr varctok varcrow\n-    global vtokmod varcmod vrowmod varcix vlastins\n+\tglobal varcstart vupptr vdownptr vleftptr vbackptr varctok varcrow\n+\tglobal vtokmod varcmod vrowmod varcix vlastins\n \n-    set varcstart($view) {{}}\n-    set vupptr($view) {0}\n-    set vdownptr($view) {0}\n-    set vleftptr($view) {0}\n-    set vbackptr($view) {0}\n-    set varctok($view) {{}}\n-    set varcrow($view) {{}}\n-    set vtokmod($view) {}\n-    set varcmod($view) 0\n-    set vrowmod($view) 0\n-    set varcix($view) {{}}\n-    set vlastins($view) {0}\n+\tset varcstart($view) {{}}\n+\tset vupptr($view) {0}\n+\tset vdownptr($view) {0}\n+\tset vleftptr($view) {0}\n+\tset vbackptr($view) {0}\n+\tset varctok($view) {{}}\n+\tset varcrow($view) {{}}\n+\tset vtokmod($view) {}\n+\tset varcmod($view) 0\n+\tset vrowmod($view) 0\n+\tset varcix($view) {{}}\n+\tset vlastins($view) {0}\n }\n \n proc resetvarcs {view} {\n-    global varcid varccommits parents children vseedcount ordertok\n-    global vshortids\n+\tglobal varcid varccommits parents children vseedcount ordertok\n+\tglobal vshortids\n \n-    foreach vid [array names varcid $view,*] {\n-\tunset varcid($vid)\n-\tunset children($vid)\n-\tunset parents($vid)\n-    }\n-    foreach vid [array names vshortids $view,*] {\n-\tunset vshortids($vid)\n-    }\n-    # some commits might have children but haven't been seen yet\n-    foreach vid [array names children $view,*] {\n-\tunset children($vid)\n-    }\n-    foreach va [array names varccommits $view,*] {\n-\tunset varccommits($va)\n-    }\n-    foreach vd [array names vseedcount $view,*] {\n-\tunset vseedcount($vd)\n-    }\n-    unset -nocomplain ordertok\n+\tforeach vid [array names varcid $view,*] {\n+\t\tunset varcid($vid)\n+\t\tunset children($vid)\n+\t\tunset parents($vid)\n+\t}\n+\tforeach vid [array names vshortids $view,*] {\n+\t\tunset vshortids($vid)\n+\t}\n+\t# some commits might have children but haven't been seen yet\n+\tforeach vid [array names children $view,*] {\n+\t\tunset children($vid)\n+\t}\n+\tforeach va [array names varccommits $view,*] {\n+\t\tunset varccommits($va)\n+\t}\n+\tforeach vd [array names vseedcount $view,*] {\n+\t\tunset vseedcount($vd)\n+\t}\n+\tunset -nocomplain ordertok\n }\n \n # returns a list of the commits with no children\n proc seeds {v} {\n-    global vdownptr vleftptr varcstart\n+\tglobal vdownptr vleftptr varcstart\n \n-    set ret {}\n-    set a [lindex $vdownptr($v) 0]\n-    while {$a != 0} {\n-\tlappend ret [lindex $varcstart($v) $a]\n-\tset a [lindex $vleftptr($v) $a]\n-    }\n-    return $ret\n+\tset ret {}\n+\tset a [lindex $vdownptr($v) 0]\n+\twhile {$a != 0} {\n+\t\tlappend ret [lindex $varcstart($v) $a]\n+\t\tset a [lindex $vleftptr($v) $a]\n+\t}\n+\treturn $ret\n }\n \n proc newvarc {view id} {\n-    global varcid varctok parents children vdatemode\n-    global vupptr vdownptr vleftptr vbackptr varcrow varcix varcstart\n-    global commitdata commitinfo vseedcount varccommits vlastins\n+\tglobal varcid varctok parents children vdatemode\n+\tglobal vupptr vdownptr vleftptr vbackptr varcrow varcix varcstart\n+\tglobal commitdata commitinfo vseedcount varccommits vlastins\n \n-    set a [llength $varctok($view)]\n-    set vid $view,$id\n-    if {[llength $children($vid)] == 0 || $vdatemode($view)} {\n-\tif {![info exists commitinfo($id)]} {\n-\t    parsecommit $id $commitdata($id) 1\n+\tset a [llength $varctok($view)]\n+\tset vid $view,$id\n+\tif {[llength $children($vid)] == 0 || $vdatemode($view)} {\n+\t\tif {![info exists commitinfo($id)]} {\n+\t\t\tparsecommit $id $commitdata($id) 1\n+\t\t}\n+\t\tset cdate [lindex [lindex $commitinfo($id) 4] 0]\n+\t\tif {![string is integer -strict $cdate]} {\n+\t\t\tset cdate 0\n+\t\t}\n+\t\tif {![info exists vseedcount($view,$cdate)]} {\n+\t\t\tset vseedcount($view,$cdate) -1\n+\t\t}\n+\t\tset c [incr vseedcount($view,$cdate)]\n+\t\tset cdate [expr {$cdate ^ 0xffffffff}]\n+\t\tset tok \"s[strrep $cdate][strrep $c]\"\n+\t} else {\n+\t\tset tok {}\n \t}\n-\tset cdate [lindex [lindex $commitinfo($id) 4] 0]\n-\tif {![string is integer -strict $cdate]} {\n-\t    set cdate 0\n+\tset ka 0\n+\tif {[llength $children($vid)] > 0} {\n+\t\tset kid [lindex $children($vid) end]\n+\t\tset k $varcid($view,$kid)\n+\t\tif {[string compare [lindex $varctok($view) $k] $tok] > 0} {\n+\t\t\tset ki $kid\n+\t\t\tset ka $k\n+\t\t\tset tok [lindex $varctok($view) $k]\n+\t\t}\n \t}\n-\tif {![info exists vseedcount($view,$cdate)]} {\n-\t    set vseedcount($view,$cdate) -1\n+\tif {$ka != 0} {\n+\t\tset i [lsearch -exact $parents($view,$ki) $id]\n+\t\tset j [expr {[llength $parents($view,$ki)] - 1 - $i}]\n+\t\tappend tok [strrep $j]\n \t}\n-\tset c [incr vseedcount($view,$cdate)]\n-\tset cdate [expr {$cdate ^ 0xffffffff}]\n-\tset tok \"s[strrep $cdate][strrep $c]\"\n-    } else {\n-\tset tok {}\n-    }\n-    set ka 0\n-    if {[llength $children($vid)] > 0} {\n-\tset kid [lindex $children($vid) end]\n-\tset k $varcid($view,$kid)\n-\tif {[string compare [lindex $varctok($view) $k] $tok] > 0} {\n-\t    set ki $kid\n-\t    set ka $k\n-\t    set tok [lindex $varctok($view) $k]\n+\tset c [lindex $vlastins($view) $ka]\n+\tif {$c == 0 || [string compare $tok [lindex $varctok($view) $c]] < 0} {\n+\t\tset c $ka\n+\t\tset b [lindex $vdownptr($view) $ka]\n+\t} else {\n+\t\tset b [lindex $vleftptr($view) $c]\n \t}\n-    }\n-    if {$ka != 0} {\n-\tset i [lsearch -exact $parents($view,$ki) $id]\n-\tset j [expr {[llength $parents($view,$ki)] - 1 - $i}]\n-\tappend tok [strrep $j]\n-    }\n-    set c [lindex $vlastins($view) $ka]\n-    if {$c == 0 || [string compare $tok [lindex $varctok($view) $c]] < 0} {\n-\tset c $ka\n-\tset b [lindex $vdownptr($view) $ka]\n-    } else {\n-\tset b [lindex $vleftptr($view) $c]\n-    }\n-    while {$b != 0 && [string compare $tok [lindex $varctok($view) $b]] >= 0} {\n-\tset c $b\n-\tset b [lindex $vleftptr($view) $c]\n-    }\n-    if {$c == $ka} {\n-\tlset vdownptr($view) $ka $a\n-\tlappend vbackptr($view) 0\n-    } else {\n-\tlset vleftptr($view) $c $a\n-\tlappend vbackptr($view) $c\n-    }\n-    lset vlastins($view) $ka $a\n-    lappend vupptr($view) $ka\n-    lappend vleftptr($view) $b\n-    if {$b != 0} {\n-\tlset vbackptr($view) $b $a\n-    }\n-    lappend varctok($view) $tok\n-    lappend varcstart($view) $id\n-    lappend vdownptr($view) 0\n-    lappend varcrow($view) {}\n-    lappend varcix($view) {}\n-    set varccommits($view,$a) {}\n-    lappend vlastins($view) 0\n-    return $a\n+\twhile {$b != 0 && [string compare $tok [lindex $varctok($view) $b]] >= 0} {\n+\t\tset c $b\n+\t\tset b [lindex $vleftptr($view) $c]\n+\t}\n+\tif {$c == $ka} {\n+\t\tlset vdownptr($view) $ka $a\n+\t\tlappend vbackptr($view) 0\n+\t} else {\n+\t\tlset vleftptr($view) $c $a\n+\t\tlappend vbackptr($view) $c\n+\t}\n+\tlset vlastins($view) $ka $a\n+\tlappend vupptr($view) $ka\n+\tlappend vleftptr($view) $b\n+\tif {$b != 0} {\n+\t\tlset vbackptr($view) $b $a\n+\t}\n+\tlappend varctok($view) $tok\n+\tlappend varcstart($view) $id\n+\tlappend vdownptr($view) 0\n+\tlappend varcrow($view) {}\n+\tlappend varcix($view) {}\n+\tset varccommits($view,$a) {}\n+\tlappend vlastins($view) 0\n+\treturn $a\n }\n \n proc splitvarc {p v} {\n-    global varcid varcstart varccommits varctok vtokmod\n-    global vupptr vdownptr vleftptr vbackptr varcix varcrow vlastins\n+\tglobal varcid varcstart varccommits varctok vtokmod\n+\tglobal vupptr vdownptr vleftptr vbackptr varcix varcrow vlastins\n \n-    set oa $varcid($v,$p)\n-    set otok [lindex $varctok($v) $oa]\n-    set ac $varccommits($v,$oa)\n-    set i [lsearch -exact $varccommits($v,$oa) $p]\n-    if {$i <= 0} return\n-    set na [llength $varctok($v)]\n-    # \"%\" sorts before \"0\"...\n-    set tok \"$otok%[strrep $i]\"\n-    lappend varctok($v) $tok\n-    lappend varcrow($v) {}\n-    lappend varcix($v) {}\n-    set varccommits($v,$oa) [lrange $ac 0 [expr {$i - 1}]]\n-    set varccommits($v,$na) [lrange $ac $i end]\n-    lappend varcstart($v) $p\n-    foreach id $varccommits($v,$na) {\n-\tset varcid($v,$id) $na\n-    }\n-    lappend vdownptr($v) [lindex $vdownptr($v) $oa]\n-    lappend vlastins($v) [lindex $vlastins($v) $oa]\n-    lset vdownptr($v) $oa $na\n-    lset vlastins($v) $oa 0\n-    lappend vupptr($v) $oa\n-    lappend vleftptr($v) 0\n-    lappend vbackptr($v) 0\n-    for {set b [lindex $vdownptr($v) $na]} {$b != 0} {set b [lindex $vleftptr($v) $b]} {\n-\tlset vupptr($v) $b $na\n-    }\n-    if {[string compare $otok $vtokmod($v)] <= 0} {\n-\tmodify_arc $v $oa\n-    }\n+\tset oa $varcid($v,$p)\n+\tset otok [lindex $varctok($v) $oa]\n+\tset ac $varccommits($v,$oa)\n+\tset i [lsearch -exact $varccommits($v,$oa) $p]\n+\tif {$i <= 0} return\n+\tset na [llength $varctok($v)]\n+\t# \"%\" sorts before \"0\"...\n+\tset tok \"$otok%[strrep $i]\"\n+\tlappend varctok($v) $tok\n+\tlappend varcrow($v) {}\n+\tlappend varcix($v) {}\n+\tset varccommits($v,$oa) [lrange $ac 0 [expr {$i - 1}]]\n+\tset varccommits($v,$na) [lrange $ac $i end]\n+\tlappend varcstart($v) $p\n+\tforeach id $varccommits($v,$na) {\n+\t\tset varcid($v,$id) $na\n+\t}\n+\tlappend vdownptr($v) [lindex $vdownptr($v) $oa]\n+\tlappend vlastins($v) [lindex $vlastins($v) $oa]\n+\tlset vdownptr($v) $oa $na\n+\tlset vlastins($v) $oa 0\n+\tlappend vupptr($v) $oa\n+\tlappend vleftptr($v) 0\n+\tlappend vbackptr($v) 0\n+\tfor {set b [lindex $vdownptr($v) $na]} {$b != 0} {set b [lindex $vleftptr($v) $b]} {\n+\t\tlset vupptr($v) $b $na\n+\t}\n+\tif {[string compare $otok $vtokmod($v)] <= 0} {\n+\t\tmodify_arc $v $oa\n+\t}\n }\n \n proc renumbervarc {a v} {\n-    global parents children varctok varcstart varccommits\n-    global vupptr vdownptr vleftptr vbackptr vlastins varcid vtokmod vdatemode\n+\tglobal parents children varctok varcstart varccommits\n+\tglobal vupptr vdownptr vleftptr vbackptr vlastins varcid vtokmod vdatemode\n \n-    set t1 [clock clicks -milliseconds]\n-    set todo {}\n-    set isrelated($a) 1\n-    set kidchanged($a) 1\n-    set ntot 0\n-    while {$a != 0} {\n-\tif {[info exists isrelated($a)]} {\n-\t    lappend todo $a\n-\t    set id [lindex $varccommits($v,$a) end]\n-\t    foreach p $parents($v,$id) {\n-\t\tif {[info exists varcid($v,$p)]} {\n-\t\t    set isrelated($varcid($v,$p)) 1\n+\tset t1 [clock clicks -milliseconds]\n+\tset todo {}\n+\tset isrelated($a) 1\n+\tset kidchanged($a) 1\n+\tset ntot 0\n+\twhile {$a != 0} {\n+\t\tif {[info exists isrelated($a)]} {\n+\t\t\tlappend todo $a\n+\t\t\tset id [lindex $varccommits($v,$a) end]\n+\t\t\tforeach p $parents($v,$id) {\n+\t\t\t\tif {[info exists varcid($v,$p)]} {\n+\t\t\t\t\tset isrelated($varcid($v,$p)) 1\n+\t\t\t\t}\n+\t\t\t}\n \t\t}\n-\t    }\n+\t\tincr ntot\n+\t\tset b [lindex $vdownptr($v) $a]\n+\t\tif {$b == 0} {\n+\t\t\twhile {$a != 0} {\n+\t\t\t\tset b [lindex $vleftptr($v) $a]\n+\t\t\t\tif {$b != 0} break\n+\t\t\t\tset a [lindex $vupptr($v) $a]\n+\t\t\t}\n+\t\t}\n+\t\tset a $b\n \t}\n-\tincr ntot\n-\tset b [lindex $vdownptr($v) $a]\n-\tif {$b == 0} {\n-\t    while {$a != 0} {\n-\t\tset b [lindex $vleftptr($v) $a]\n-\t\tif {$b != 0} break\n-\t\tset a [lindex $vupptr($v) $a]\n-\t    }\n+\tforeach a $todo {\n+\t\tif {![info exists kidchanged($a)]} continue\n+\t\tset id [lindex $varcstart($v) $a]\n+\t\tif {[llength $children($v,$id)] > 1} {\n+\t\t\tset children($v,$id) [lsort -command [list vtokcmp $v] \\\n+\t\t\t\t\t\t\t\t\t  $children($v,$id)]\n+\t\t}\n+\t\tset oldtok [lindex $varctok($v) $a]\n+\t\tif {!$vdatemode($v)} {\n+\t\t\tset tok {}\n+\t\t} else {\n+\t\t\tset tok $oldtok\n+\t\t}\n+\t\tset ka 0\n+\t\tset kid [last_real_child $v,$id]\n+\t\tif {$kid ne {}} {\n+\t\t\tset k $varcid($v,$kid)\n+\t\t\tif {[string compare [lindex $varctok($v) $k] $tok] > 0} {\n+\t\t\t\tset ki $kid\n+\t\t\t\tset ka $k\n+\t\t\t\tset tok [lindex $varctok($v) $k]\n+\t\t\t}\n+\t\t}\n+\t\tif {$ka != 0} {\n+\t\t\tset i [lsearch -exact $parents($v,$ki) $id]\n+\t\t\tset j [expr {[llength $parents($v,$ki)] - 1 - $i}]\n+\t\t\tappend tok [strrep $j]\n+\t\t}\n+\t\tif {$tok eq $oldtok} {\n+\t\t\tcontinue\n+\t\t}\n+\t\tset id [lindex $varccommits($v,$a) end]\n+\t\tforeach p $parents($v,$id) {\n+\t\t\tif {[info exists varcid($v,$p)]} {\n+\t\t\t\tset kidchanged($varcid($v,$p)) 1\n+\t\t\t} else {\n+\t\t\t\tset sortkids($p) 1\n+\t\t\t}\n+\t\t}\n+\t\tlset varctok($v) $a $tok\n+\t\tset b [lindex $vupptr($v) $a]\n+\t\tif {$b != $ka} {\n+\t\t\tif {[string compare [lindex $varctok($v) $ka] $vtokmod($v)] < 0} {\n+\t\t\t\tmodify_arc $v $ka\n+\t\t\t}\n+\t\t\tif {[string compare [lindex $varctok($v) $b] $vtokmod($v)] < 0} {\n+\t\t\t\tmodify_arc $v $b\n+\t\t\t}\n+\t\t\tset c [lindex $vbackptr($v) $a]\n+\t\t\tset d [lindex $vleftptr($v) $a]\n+\t\t\tif {$c == 0} {\n+\t\t\t\tlset vdownptr($v) $b $d\n+\t\t\t} else {\n+\t\t\t\tlset vleftptr($v) $c $d\n+\t\t\t}\n+\t\t\tif {$d != 0} {\n+\t\t\t\tlset vbackptr($v) $d $c\n+\t\t\t}\n+\t\t\tif {[lindex $vlastins($v) $b] == $a} {\n+\t\t\t\tlset vlastins($v) $b $c\n+\t\t\t}\n+\t\t\tlset vupptr($v) $a $ka\n+\t\t\tset c [lindex $vlastins($v) $ka]\n+\t\t\tif {$c == 0 || \\\n+\t\t\t\t\t[string compare $tok [lindex $varctok($v) $c]] < 0} {\n+\t\t\t\tset c $ka\n+\t\t\t\tset b [lindex $vdownptr($v) $ka]\n+\t\t\t} else {\n+\t\t\t\tset b [lindex $vleftptr($v) $c]\n+\t\t\t}\n+\t\t\twhile {$b != 0 && \\\n+\t\t\t\t\t  [string compare $tok [lindex $varctok($v) $b]] >= 0} {\n+\t\t\t\tset c $b\n+\t\t\t\tset b [lindex $vleftptr($v) $c]\n+\t\t\t}\n+\t\t\tif {$c == $ka} {\n+\t\t\t\tlset vdownptr($v) $ka $a\n+\t\t\t\tlset vbackptr($v) $a 0\n+\t\t\t} else {\n+\t\t\t\tlset vleftptr($v) $c $a\n+\t\t\t\tlset vbackptr($v) $a $c\n+\t\t\t}\n+\t\t\tlset vleftptr($v) $a $b\n+\t\t\tif {$b != 0} {\n+\t\t\t\tlset vbackptr($v) $b $a\n+\t\t\t}\n+\t\t\tlset vlastins($v) $ka $a\n+\t\t}\n \t}\n-\tset a $b\n-    }\n-    foreach a $todo {\n-\tif {![info exists kidchanged($a)]} continue\n-\tset id [lindex $varcstart($v) $a]\n-\tif {[llength $children($v,$id)] > 1} {\n-\t    set children($v,$id) [lsort -command [list vtokcmp $v] \\\n-\t\t\t\t      $children($v,$id)]\n+\tforeach id [array names sortkids] {\n+\t\tif {[llength $children($v,$id)] > 1} {\n+\t\t\tset children($v,$id) [lsort -command [list vtokcmp $v] \\\n+\t\t\t\t\t\t\t\t\t  $children($v,$id)]\n+\t\t}\n \t}\n-\tset oldtok [lindex $varctok($v) $a]\n-\tif {!$vdatemode($v)} {\n-\t    set tok {}\n-\t} else {\n-\t    set tok $oldtok\n-\t}\n-\tset ka 0\n-\tset kid [last_real_child $v,$id]\n-\tif {$kid ne {}} {\n-\t    set k $varcid($v,$kid)\n-\t    if {[string compare [lindex $varctok($v) $k] $tok] > 0} {\n-\t\tset ki $kid\n-\t\tset ka $k\n-\t\tset tok [lindex $varctok($v) $k]\n-\t    }\n-\t}\n-\tif {$ka != 0} {\n-\t    set i [lsearch -exact $parents($v,$ki) $id]\n-\t    set j [expr {[llength $parents($v,$ki)] - 1 - $i}]\n-\t    append tok [strrep $j]\n-\t}\n-\tif {$tok eq $oldtok} {\n-\t    continue\n-\t}\n-\tset id [lindex $varccommits($v,$a) end]\n-\tforeach p $parents($v,$id) {\n-\t    if {[info exists varcid($v,$p)]} {\n-\t\tset kidchanged($varcid($v,$p)) 1\n-\t    } else {\n-\t\tset sortkids($p) 1\n-\t    }\n-\t}\n-\tlset varctok($v) $a $tok\n-\tset b [lindex $vupptr($v) $a]\n-\tif {$b != $ka} {\n-\t    if {[string compare [lindex $varctok($v) $ka] $vtokmod($v)] < 0} {\n-\t\tmodify_arc $v $ka\n-\t    }\n-\t    if {[string compare [lindex $varctok($v) $b] $vtokmod($v)] < 0} {\n-\t\tmodify_arc $v $b\n-\t    }\n-\t    set c [lindex $vbackptr($v) $a]\n-\t    set d [lindex $vleftptr($v) $a]\n-\t    if {$c == 0} {\n-\t\tlset vdownptr($v) $b $d\n-\t    } else {\n-\t\tlset vleftptr($v) $c $d\n-\t    }\n-\t    if {$d != 0} {\n-\t\tlset vbackptr($v) $d $c\n-\t    }\n-\t    if {[lindex $vlastins($v) $b] == $a} {\n-\t\tlset vlastins($v) $b $c\n-\t    }\n-\t    lset vupptr($v) $a $ka\n-\t    set c [lindex $vlastins($v) $ka]\n-\t    if {$c == 0 || \\\n-\t\t    [string compare $tok [lindex $varctok($v) $c]] < 0} {\n-\t\tset c $ka\n-\t\tset b [lindex $vdownptr($v) $ka]\n-\t    } else {\n-\t\tset b [lindex $vleftptr($v) $c]\n-\t    }\n-\t    while {$b != 0 && \\\n-\t\t      [string compare $tok [lindex $varctok($v) $b]] >= 0} {\n-\t\tset c $b\n-\t\tset b [lindex $vleftptr($v) $c]\n-\t    }\n-\t    if {$c == $ka} {\n- \t\tlset vdownptr($v) $ka $a\n-\t\tlset vbackptr($v) $a 0\n-\t    } else {\n-\t\tlset vleftptr($v) $c $a\n-\t\tlset vbackptr($v) $a $c\n-\t    }\n-\t    lset vleftptr($v) $a $b\n-\t    if {$b != 0} {\n-\t\tlset vbackptr($v) $b $a\n-\t    }\n-\t    lset vlastins($v) $ka $a\n-\t}\n-    }\n-    foreach id [array names sortkids] {\n-\tif {[llength $children($v,$id)] > 1} {\n-\t    set children($v,$id) [lsort -command [list vtokcmp $v] \\\n-\t\t\t\t      $children($v,$id)]\n-\t}\n-    }\n-    set t2 [clock clicks -milliseconds]\n-    #puts \"renumbervarc did [llength $todo] of $ntot arcs in [expr {$t2-$t1}]ms\"\n+\tset t2 [clock clicks -milliseconds]\n+\t#puts \"renumbervarc did [llength $todo] of $ntot arcs in [expr {$t2-$t1}]ms\"\n }\n \n # Fix up the graph after we have found out that in view $v,\n # $p (a commit that we have already seen) is actually the parent\n # of the last commit in arc $a.\n proc fix_reversal {p a v} {\n-    global varcid varcstart varctok vupptr\n+\tglobal varcid varcstart varctok vupptr\n \n-    set pa $varcid($v,$p)\n-    if {$p ne [lindex $varcstart($v) $pa]} {\n-\tsplitvarc $p $v\n \tset pa $varcid($v,$p)\n-    }\n-    # seeds always need to be renumbered\n-    if {[lindex $vupptr($v) $pa] == 0 ||\n-\t[string compare [lindex $varctok($v) $a] \\\n-\t     [lindex $varctok($v) $pa]] > 0} {\n-\trenumbervarc $pa $v\n-    }\n+\tif {$p ne [lindex $varcstart($v) $pa]} {\n+\t\tsplitvarc $p $v\n+\t\tset pa $varcid($v,$p)\n+\t}\n+\t# seeds always need to be renumbered\n+\tif {[lindex $vupptr($v) $pa] == 0 ||\n+\t\t[string compare [lindex $varctok($v) $a] \\\n+\t\t\t [lindex $varctok($v) $pa]] > 0} {\n+\t\trenumbervarc $pa $v\n+\t}\n }\n \n proc insertrow {id p v} {\n-    global cmitlisted children parents varcid varctok vtokmod\n-    global varccommits ordertok commitidx numcommits curview\n-    global targetid targetrow vshortids\n+\tglobal cmitlisted children parents varcid varctok vtokmod\n+\tglobal varccommits ordertok commitidx numcommits curview\n+\tglobal targetid targetrow vshortids\n \n-    readcommit $id\n-    set vid $v,$id\n-    set cmitlisted($vid) 1\n-    set children($vid) {}\n-    set parents($vid) [list $p]\n-    set a [newvarc $v $id]\n-    set varcid($vid) $a\n-    lappend vshortids($v,[string range $id 0 3]) $id\n-    if {[string compare [lindex $varctok($v) $a] $vtokmod($v)] < 0} {\n-\tmodify_arc $v $a\n-    }\n-    lappend varccommits($v,$a) $id\n-    set vp $v,$p\n-    if {[llength [lappend children($vp) $id]] > 1} {\n-\tset children($vp) [lsort -command [list vtokcmp $v] $children($vp)]\n-\tunset -nocomplain ordertok\n-    }\n-    fix_reversal $p $a $v\n-    incr commitidx($v)\n-    if {$v == $curview} {\n-\tset numcommits $commitidx($v)\n-\tsetcanvscroll\n-\tif {[info exists targetid]} {\n-\t    if {![comes_before $targetid $p]} {\n-\t\tincr targetrow\n-\t    }\n+\treadcommit $id\n+\tset vid $v,$id\n+\tset cmitlisted($vid) 1\n+\tset children($vid) {}\n+\tset parents($vid) [list $p]\n+\tset a [newvarc $v $id]\n+\tset varcid($vid) $a\n+\tlappend vshortids($v,[string range $id 0 3]) $id\n+\tif {[string compare [lindex $varctok($v) $a] $vtokmod($v)] < 0} {\n+\t\tmodify_arc $v $a\n+\t}\n+\tlappend varccommits($v,$a) $id\n+\tset vp $v,$p\n+\tif {[llength [lappend children($vp) $id]] > 1} {\n+\t\tset children($vp) [lsort -command [list vtokcmp $v] $children($vp)]\n+\t\tunset -nocomplain ordertok\n+\t}\n+\tfix_reversal $p $a $v\n+\tincr commitidx($v)\n+\tif {$v == $curview} {\n+\t\tset numcommits $commitidx($v)\n+\t\tsetcanvscroll\n+\t\tif {[info exists targetid]} {\n+\t\t\tif {![comes_before $targetid $p]} {\n+\t\t\t\tincr targetrow\n+\t\t\t}\n+\t\t}\n \t}\n-    }\n }\n \n proc insertfakerow {id p} {\n-    global varcid varccommits parents children cmitlisted\n-    global commitidx varctok vtokmod targetid targetrow curview numcommits\n+\tglobal varcid varccommits parents children cmitlisted\n+\tglobal commitidx varctok vtokmod targetid targetrow curview numcommits\n \n-    set v $curview\n-    set a $varcid($v,$p)\n-    set i [lsearch -exact $varccommits($v,$a) $p]\n-    if {$i < 0} {\n-\tputs \"oops: insertfakerow can't find [shortids $p] on arc $a\"\n-\treturn\n-    }\n-    set children($v,$id) {}\n-    set parents($v,$id) [list $p]\n-    set varcid($v,$id) $a\n-    lappend children($v,$p) $id\n-    set cmitlisted($v,$id) 1\n-    set numcommits [incr commitidx($v)]\n-    # note we deliberately don't update varcstart($v) even if $i == 0\n-    set varccommits($v,$a) [linsert $varccommits($v,$a) $i $id]\n-    modify_arc $v $a $i\n-    if {[info exists targetid]} {\n-\tif {![comes_before $targetid $p]} {\n-\t    incr targetrow\n+\tset v $curview\n+\tset a $varcid($v,$p)\n+\tset i [lsearch -exact $varccommits($v,$a) $p]\n+\tif {$i < 0} {\n+\t\tputs \"oops: insertfakerow can't find [shortids $p] on arc $a\"\n+\t\treturn\n \t}\n-    }\n-    setcanvscroll\n-    drawvisible\n+\tset children($v,$id) {}\n+\tset parents($v,$id) [list $p]\n+\tset varcid($v,$id) $a\n+\tlappend children($v,$p) $id\n+\tset cmitlisted($v,$id) 1\n+\tset numcommits [incr commitidx($v)]\n+\t# note we deliberately don't update varcstart($v) even if $i == 0\n+\tset varccommits($v,$a) [linsert $varccommits($v,$a) $i $id]\n+\tmodify_arc $v $a $i\n+\tif {[info exists targetid]} {\n+\t\tif {![comes_before $targetid $p]} {\n+\t\t\tincr targetrow\n+\t\t}\n+\t}\n+\tsetcanvscroll\n+\tdrawvisible\n }\n \n proc removefakerow {id} {\n-    global varcid varccommits parents children commitidx\n-    global varctok vtokmod cmitlisted currentid selectedline\n-    global targetid curview numcommits\n+\tglobal varcid varccommits parents children commitidx\n+\tglobal varctok vtokmod cmitlisted currentid selectedline\n+\tglobal targetid curview numcommits\n \n-    set v $curview\n-    if {[llength $parents($v,$id)] != 1} {\n-\tputs \"oops: removefakerow [shortids $id] has [llength $parents($v,$id)] parents\"\n-\treturn\n-    }\n-    set p [lindex $parents($v,$id) 0]\n-    set a $varcid($v,$id)\n-    set i [lsearch -exact $varccommits($v,$a) $id]\n-    if {$i < 0} {\n-\tputs \"oops: removefakerow can't find [shortids $id] on arc $a\"\n-\treturn\n-    }\n-    unset varcid($v,$id)\n-    set varccommits($v,$a) [lreplace $varccommits($v,$a) $i $i]\n-    unset parents($v,$id)\n-    unset children($v,$id)\n-    unset cmitlisted($v,$id)\n-    set numcommits [incr commitidx($v) -1]\n-    set j [lsearch -exact $children($v,$p) $id]\n-    if {$j >= 0} {\n-\tset children($v,$p) [lreplace $children($v,$p) $j $j]\n-    }\n-    modify_arc $v $a $i\n-    if {[info exist currentid] && $id eq $currentid} {\n-\tunset currentid\n-\tset selectedline {}\n-    }\n-    if {[info exists targetid] && $targetid eq $id} {\n-\tset targetid $p\n-    }\n-    setcanvscroll\n-    drawvisible\n+\tset v $curview\n+\tif {[llength $parents($v,$id)] != 1} {\n+\t\tputs \"oops: removefakerow [shortids $id] has [llength $parents($v,$id)] parents\"\n+\t\treturn\n+\t}\n+\tset p [lindex $parents($v,$id) 0]\n+\tset a $varcid($v,$id)\n+\tset i [lsearch -exact $varccommits($v,$a) $id]\n+\tif {$i < 0} {\n+\t\tputs \"oops: removefakerow can't find [shortids $id] on arc $a\"\n+\t\treturn\n+\t}\n+\tunset varcid($v,$id)\n+\tset varccommits($v,$a) [lreplace $varccommits($v,$a) $i $i]\n+\tunset parents($v,$id)\n+\tunset children($v,$id)\n+\tunset cmitlisted($v,$id)\n+\tset numcommits [incr commitidx($v) -1]\n+\tset j [lsearch -exact $children($v,$p) $id]\n+\tif {$j >= 0} {\n+\t\tset children($v,$p) [lreplace $children($v,$p) $j $j]\n+\t}\n+\tmodify_arc $v $a $i\n+\tif {[info exist currentid] && $id eq $currentid} {\n+\t\tunset currentid\n+\t\tset selectedline {}\n+\t}\n+\tif {[info exists targetid] && $targetid eq $id} {\n+\t\tset targetid $p\n+\t}\n+\tsetcanvscroll\n+\tdrawvisible\n }\n \n proc real_children {vp} {\n-    global children nullid nullid2\n+\tglobal children nullid nullid2\n \n-    set kids {}\n-    foreach id $children($vp) {\n-\tif {$id ne $nullid && $id ne $nullid2} {\n-\t    lappend kids $id\n+\tset kids {}\n+\tforeach id $children($vp) {\n+\t\tif {$id ne $nullid && $id ne $nullid2} {\n+\t\t\tlappend kids $id\n+\t\t}\n \t}\n-    }\n-    return $kids\n+\treturn $kids\n }\n \n proc first_real_child {vp} {\n-    global children nullid nullid2\n+\tglobal children nullid nullid2\n \n-    foreach id $children($vp) {\n-\tif {$id ne $nullid && $id ne $nullid2} {\n-\t    return $id\n+\tforeach id $children($vp) {\n+\t\tif {$id ne $nullid && $id ne $nullid2} {\n+\t\t\treturn $id\n+\t\t}\n \t}\n-    }\n-    return {}\n+\treturn {}\n }\n \n proc last_real_child {vp} {\n-    global children nullid nullid2\n+\tglobal children nullid nullid2\n \n-    set kids $children($vp)\n-    for {set i [llength $kids]} {[incr i -1] >= 0} {} {\n-\tset id [lindex $kids $i]\n-\tif {$id ne $nullid && $id ne $nullid2} {\n-\t    return $id\n+\tset kids $children($vp)\n+\tfor {set i [llength $kids]} {[incr i -1] >= 0} {} {\n+\t\tset id [lindex $kids $i]\n+\t\tif {$id ne $nullid && $id ne $nullid2} {\n+\t\t\treturn $id\n+\t\t}\n \t}\n-    }\n-    return {}\n+\treturn {}\n }\n \n proc vtokcmp {v a b} {\n-    global varctok varcid\n+\tglobal varctok varcid\n \n-    return [string compare [lindex $varctok($v) $varcid($v,$a)] \\\n-\t\t[lindex $varctok($v) $varcid($v,$b)]]\n+\treturn [string compare [lindex $varctok($v) $varcid($v,$a)] \\\n+\t\t\t\t[lindex $varctok($v) $varcid($v,$b)]]\n }\n \n # This assumes that if lim is not given, the caller has checked that\n # arc a's token is less than $vtokmod($v)\n proc modify_arc {v a {lim {}}} {\n-    global varctok vtokmod varcmod varcrow vupptr curview vrowmod varccommits\n+\tglobal varctok vtokmod varcmod varcrow vupptr curview vrowmod varccommits\n \n-    if {$lim ne {}} {\n-\tset c [string compare [lindex $varctok($v) $a] $vtokmod($v)]\n-\tif {$c > 0} return\n-\tif {$c == 0} {\n-\t    set r [lindex $varcrow($v) $a]\n-\t    if {$r ne {} && $vrowmod($v) <= $r + $lim} return\n+\tif {$lim ne {}} {\n+\t\tset c [string compare [lindex $varctok($v) $a] $vtokmod($v)]\n+\t\tif {$c > 0} return\n+\t\tif {$c == 0} {\n+\t\t\tset r [lindex $varcrow($v) $a]\n+\t\t\tif {$r ne {} && $vrowmod($v) <= $r + $lim} return\n+\t\t}\n \t}\n-    }\n-    set vtokmod($v) [lindex $varctok($v) $a]\n-    set varcmod($v) $a\n-    if {$v == $curview} {\n-\twhile {$a != 0 && [lindex $varcrow($v) $a] eq {}} {\n-\t    set a [lindex $vupptr($v) $a]\n-\t    set lim {}\n+\tset vtokmod($v) [lindex $varctok($v) $a]\n+\tset varcmod($v) $a\n+\tif {$v == $curview} {\n+\t\twhile {$a != 0 && [lindex $varcrow($v) $a] eq {}} {\n+\t\t\tset a [lindex $vupptr($v) $a]\n+\t\t\tset lim {}\n+\t\t}\n+\t\tset r 0\n+\t\tif {$a != 0} {\n+\t\t\tif {$lim eq {}} {\n+\t\t\t\tset lim [llength $varccommits($v,$a)]\n+\t\t\t}\n+\t\t\tset r [expr {[lindex $varcrow($v) $a] + $lim}]\n+\t\t}\n+\t\tset vrowmod($v) $r\n+\t\tundolayout $r\n \t}\n-\tset r 0\n-\tif {$a != 0} {\n-\t    if {$lim eq {}} {\n-\t\tset lim [llength $varccommits($v,$a)]\n-\t    }\n-\t    set r [expr {[lindex $varcrow($v) $a] + $lim}]\n-\t}\n-\tset vrowmod($v) $r\n-\tundolayout $r\n-    }\n }\n \n proc update_arcrows {v} {\n-    global vtokmod varcmod vrowmod varcrow commitidx currentid selectedline\n-    global varcid vrownum varcorder varcix varccommits\n-    global vupptr vdownptr vleftptr varctok\n-    global displayorder parentlist curview cached_commitrow\n+\tglobal vtokmod varcmod vrowmod varcrow commitidx currentid selectedline\n+\tglobal varcid vrownum varcorder varcix varccommits\n+\tglobal vupptr vdownptr vleftptr varctok\n+\tglobal displayorder parentlist curview cached_commitrow\n \n-    if {$vrowmod($v) == $commitidx($v)} return\n-    if {$v == $curview} {\n-\tif {[llength $displayorder] > $vrowmod($v)} {\n-\t    set displayorder [lrange $displayorder 0 [expr {$vrowmod($v) - 1}]]\n-\t    set parentlist [lrange $parentlist 0 [expr {$vrowmod($v) - 1}]]\n+\tif {$vrowmod($v) == $commitidx($v)} return\n+\tif {$v == $curview} {\n+\t\tif {[llength $displayorder] > $vrowmod($v)} {\n+\t\t\tset displayorder [lrange $displayorder 0 [expr {$vrowmod($v) - 1}]]\n+\t\t\tset parentlist [lrange $parentlist 0 [expr {$vrowmod($v) - 1}]]\n+\t\t}\n+\t\tunset -nocomplain cached_commitrow\n \t}\n-\tunset -nocomplain cached_commitrow\n-    }\n-    set narctot [expr {[llength $varctok($v)] - 1}]\n-    set a $varcmod($v)\n-    while {$a != 0 && [lindex $varcix($v) $a] eq {}} {\n-\t# go up the tree until we find something that has a row number,\n-\t# or we get to a seed\n-\tset a [lindex $vupptr($v) $a]\n-    }\n-    if {$a == 0} {\n-\tset a [lindex $vdownptr($v) 0]\n-\tif {$a == 0} return\n-\tset vrownum($v) {0}\n-\tset varcorder($v) [list $a]\n-\tlset varcix($v) $a 0\n-\tlset varcrow($v) $a 0\n-\tset arcn 0\n-\tset row 0\n-    } else {\n-\tset arcn [lindex $varcix($v) $a]\n-\tif {[llength $vrownum($v)] > $arcn + 1} {\n-\t    set vrownum($v) [lrange $vrownum($v) 0 $arcn]\n-\t    set varcorder($v) [lrange $varcorder($v) 0 $arcn]\n-\t}\n-\tset row [lindex $varcrow($v) $a]\n-    }\n-    while {1} {\n-\tset p $a\n-\tincr row [llength $varccommits($v,$a)]\n-\t# go down if possible\n-\tset b [lindex $vdownptr($v) $a]\n-\tif {$b == 0} {\n-\t    # if not, go left, or go up until we can go left\n-\t    while {$a != 0} {\n-\t\tset b [lindex $vleftptr($v) $a]\n-\t\tif {$b != 0} break\n+\tset narctot [expr {[llength $varctok($v)] - 1}]\n+\tset a $varcmod($v)\n+\twhile {$a != 0 && [lindex $varcix($v) $a] eq {}} {\n+\t\t# go up the tree until we find something that has a row number,\n+\t\t# or we get to a seed\n \t\tset a [lindex $vupptr($v) $a]\n-\t    }\n-\t    if {$a == 0} break\n \t}\n-\tset a $b\n-\tincr arcn\n-\tlappend vrownum($v) $row\n-\tlappend varcorder($v) $a\n-\tlset varcix($v) $a $arcn\n-\tlset varcrow($v) $a $row\n-    }\n-    set vtokmod($v) [lindex $varctok($v) $p]\n-    set varcmod($v) $p\n-    set vrowmod($v) $row\n-    if {[info exists currentid]} {\n-\tset selectedline [rowofcommit $currentid]\n-    }\n+\tif {$a == 0} {\n+\t\tset a [lindex $vdownptr($v) 0]\n+\t\tif {$a == 0} return\n+\t\tset vrownum($v) {0}\n+\t\tset varcorder($v) [list $a]\n+\t\tlset varcix($v) $a 0\n+\t\tlset varcrow($v) $a 0\n+\t\tset arcn 0\n+\t\tset row 0\n+\t} else {\n+\t\tset arcn [lindex $varcix($v) $a]\n+\t\tif {[llength $vrownum($v)] > $arcn + 1} {\n+\t\t\tset vrownum($v) [lrange $vrownum($v) 0 $arcn]\n+\t\t\tset varcorder($v) [lrange $varcorder($v) 0 $arcn]\n+\t\t}\n+\t\tset row [lindex $varcrow($v) $a]\n+\t}\n+\twhile {1} {\n+\t\tset p $a\n+\t\tincr row [llength $varccommits($v,$a)]\n+\t\t# go down if possible\n+\t\tset b [lindex $vdownptr($v) $a]\n+\t\tif {$b == 0} {\n+\t\t\t# if not, go left, or go up until we can go left\n+\t\t\twhile {$a != 0} {\n+\t\t\t\tset b [lindex $vleftptr($v) $a]\n+\t\t\t\tif {$b != 0} break\n+\t\t\t\tset a [lindex $vupptr($v) $a]\n+\t\t\t}\n+\t\t\tif {$a == 0} break\n+\t\t}\n+\t\tset a $b\n+\t\tincr arcn\n+\t\tlappend vrownum($v) $row\n+\t\tlappend varcorder($v) $a\n+\t\tlset varcix($v) $a $arcn\n+\t\tlset varcrow($v) $a $row\n+\t}\n+\tset vtokmod($v) [lindex $varctok($v) $p]\n+\tset varcmod($v) $p\n+\tset vrowmod($v) $row\n+\tif {[info exists currentid]} {\n+\t\tset selectedline [rowofcommit $currentid]\n+\t}\n }\n \n # Test whether view $v contains commit $id\n proc commitinview {id v} {\n-    global varcid\n+\tglobal varcid\n \n-    return [info exists varcid($v,$id)]\n+\treturn [info exists varcid($v,$id)]\n }\n \n # Return the row number for commit $id in the current view\n proc rowofcommit {id} {\n-    global varcid varccommits varcrow curview cached_commitrow\n-    global varctok vtokmod\n+\tglobal varcid varccommits varcrow curview cached_commitrow\n+\tglobal varctok vtokmod\n \n-    set v $curview\n-    if {![info exists varcid($v,$id)]} {\n-\tputs \"oops rowofcommit no arc for [shortids $id]\"\n-\treturn {}\n-    }\n-    set a $varcid($v,$id)\n-    if {[string compare [lindex $varctok($v) $a] $vtokmod($v)] >= 0} {\n-\tupdate_arcrows $v\n-    }\n-    if {[info exists cached_commitrow($id)]} {\n-\treturn $cached_commitrow($id)\n-    }\n-    set i [lsearch -exact $varccommits($v,$a) $id]\n-    if {$i < 0} {\n-\tputs \"oops didn't find commit [shortids $id] in arc $a\"\n-\treturn {}\n-    }\n-    incr i [lindex $varcrow($v) $a]\n-    set cached_commitrow($id) $i\n-    return $i\n+\tset v $curview\n+\tif {![info exists varcid($v,$id)]} {\n+\t\tputs \"oops rowofcommit no arc for [shortids $id]\"\n+\t\treturn {}\n+\t}\n+\tset a $varcid($v,$id)\n+\tif {[string compare [lindex $varctok($v) $a] $vtokmod($v)] >= 0} {\n+\t\tupdate_arcrows $v\n+\t}\n+\tif {[info exists cached_commitrow($id)]} {\n+\t\treturn $cached_commitrow($id)\n+\t}\n+\tset i [lsearch -exact $varccommits($v,$a) $id]\n+\tif {$i < 0} {\n+\t\tputs \"oops didn't find commit [shortids $id] in arc $a\"\n+\t\treturn {}\n+\t}\n+\tincr i [lindex $varcrow($v) $a]\n+\tset cached_commitrow($id) $i\n+\treturn $i\n }\n \n # Returns 1 if a is on an earlier row than b, otherwise 0\n proc comes_before {a b} {\n-    global varcid varctok curview\n+\tglobal varcid varctok curview\n \n-    set v $curview\n-    if {$a eq $b || ![info exists varcid($v,$a)] || \\\n-\t    ![info exists varcid($v,$b)]} {\n-\treturn 0\n-    }\n-    if {$varcid($v,$a) != $varcid($v,$b)} {\n-\treturn [expr {[string compare [lindex $varctok($v) $varcid($v,$a)] \\\n-\t\t\t   [lindex $varctok($v) $varcid($v,$b)]] < 0}]\n-    }\n-    return [expr {[rowofcommit $a] < [rowofcommit $b]}]\n+\tset v $curview\n+\tif {$a eq $b || ![info exists varcid($v,$a)] || \\\n+\t\t\t![info exists varcid($v,$b)]} {\n+\t\treturn 0\n+\t}\n+\tif {$varcid($v,$a) != $varcid($v,$b)} {\n+\t\treturn [expr {[string compare [lindex $varctok($v) $varcid($v,$a)] \\\n+\t\t\t\t\t\t   [lindex $varctok($v) $varcid($v,$b)]] < 0}]\n+\t}\n+\treturn [expr {[rowofcommit $a] < [rowofcommit $b]}]\n }\n \n proc bsearch {l elt} {\n-    if {[llength $l] == 0 || $elt <= [lindex $l 0]} {\n-\treturn 0\n-    }\n-    set lo 0\n-    set hi [llength $l]\n-    while {$hi - $lo > 1} {\n-\tset mid [expr {int(($lo + $hi) / 2)}]\n-\tset t [lindex $l $mid]\n-\tif {$elt < $t} {\n-\t    set hi $mid\n-\t} elseif {$elt > $t} {\n-\t    set lo $mid\n-\t} else {\n-\t    return $mid\n+\tif {[llength $l] == 0 || $elt <= [lindex $l 0]} {\n+\t\treturn 0\n \t}\n-    }\n-    return $lo\n+\tset lo 0\n+\tset hi [llength $l]\n+\twhile {$hi - $lo > 1} {\n+\t\tset mid [expr {int(($lo + $hi) / 2)}]\n+\t\tset t [lindex $l $mid]\n+\t\tif {$elt < $t} {\n+\t\t\tset hi $mid\n+\t\t} elseif {$elt > $t} {\n+\t\t\tset lo $mid\n+\t\t} else {\n+\t\t\treturn $mid\n+\t\t}\n+\t}\n+\treturn $lo\n }\n \n # Make sure rows $start..$end-1 are valid in displayorder and parentlist\n proc make_disporder {start end} {\n-    global vrownum curview commitidx displayorder parentlist\n-    global varccommits varcorder parents vrowmod varcrow\n-    global d_valid_start d_valid_end\n+\tglobal vrownum curview commitidx displayorder parentlist\n+\tglobal varccommits varcorder parents vrowmod varcrow\n+\tglobal d_valid_start d_valid_end\n \n-    if {$end > $vrowmod($curview)} {\n-\tupdate_arcrows $curview\n-    }\n-    set ai [bsearch $vrownum($curview) $start]\n-    set start [lindex $vrownum($curview) $ai]\n-    set narc [llength $vrownum($curview)]\n-    for {set r $start} {$ai < $narc && $r < $end} {incr ai} {\n-\tset a [lindex $varcorder($curview) $ai]\n-\tset l [llength $displayorder]\n-\tset al [llength $varccommits($curview,$a)]\n-\tif {$l < $r + $al} {\n-\t    if {$l < $r} {\n-\t\tset pad [ntimes [expr {$r - $l}] {}]\n-\t\tset displayorder [concat $displayorder $pad]\n-\t\tset parentlist [concat $parentlist $pad]\n-\t    } elseif {$l > $r} {\n-\t\tset displayorder [lrange $displayorder 0 [expr {$r - 1}]]\n-\t\tset parentlist [lrange $parentlist 0 [expr {$r - 1}]]\n-\t    }\n-\t    foreach id $varccommits($curview,$a) {\n-\t\tlappend displayorder $id\n-\t\tlappend parentlist $parents($curview,$id)\n-\t    }\n-\t} elseif {[lindex $displayorder [expr {$r + $al - 1}]] eq {}} {\n-\t    set i $r\n-\t    foreach id $varccommits($curview,$a) {\n-\t\tlset displayorder $i $id\n-\t\tlset parentlist $i $parents($curview,$id)\n-\t\tincr i\n-\t    }\n+\tif {$end > $vrowmod($curview)} {\n+\t\tupdate_arcrows $curview\n+\t}\n+\tset ai [bsearch $vrownum($curview) $start]\n+\tset start [lindex $vrownum($curview) $ai]\n+\tset narc [llength $vrownum($curview)]\n+\tfor {set r $start} {$ai < $narc && $r < $end} {incr ai} {\n+\t\tset a [lindex $varcorder($curview) $ai]\n+\t\tset l [llength $displayorder]\n+\t\tset al [llength $varccommits($curview,$a)]\n+\t\tif {$l < $r + $al} {\n+\t\t\tif {$l < $r} {\n+\t\t\t\tset pad [ntimes [expr {$r - $l}] {}]\n+\t\t\t\tset displayorder [concat $displayorder $pad]\n+\t\t\t\tset parentlist [concat $parentlist $pad]\n+\t\t\t} elseif {$l > $r} {\n+\t\t\t\tset displayorder [lrange $displayorder 0 [expr {$r - 1}]]\n+\t\t\t\tset parentlist [lrange $parentlist 0 [expr {$r - 1}]]\n+\t\t\t}\n+\t\t\tforeach id $varccommits($curview,$a) {\n+\t\t\t\tlappend displayorder $id\n+\t\t\t\tlappend parentlist $parents($curview,$id)\n+\t\t\t}\n+\t\t} elseif {[lindex $displayorder [expr {$r + $al - 1}]] eq {}} {\n+\t\t\tset i $r\n+\t\t\tforeach id $varccommits($curview,$a) {\n+\t\t\t\tlset displayorder $i $id\n+\t\t\t\tlset parentlist $i $parents($curview,$id)\n+\t\t\t\tincr i\n+\t\t\t}\n+\t\t}\n+\t\tincr r $al\n \t}\n-\tincr r $al\n-    }\n }\n \n proc commitonrow {row} {\n-    global displayorder\n+\tglobal displayorder\n \n-    set id [lindex $displayorder $row]\n-    if {$id eq {}} {\n-\tmake_disporder $row [expr {$row + 1}]\n \tset id [lindex $displayorder $row]\n-    }\n-    return $id\n+\tif {$id eq {}} {\n+\t\tmake_disporder $row [expr {$row + 1}]\n+\t\tset id [lindex $displayorder $row]\n+\t}\n+\treturn $id\n }\n \n proc closevarcs {v} {\n-    global varctok varccommits varcid parents children\n-    global cmitlisted commitidx vtokmod curview numcommits\n+\tglobal varctok varccommits varcid parents children\n+\tglobal cmitlisted commitidx vtokmod curview numcommits\n \n-    set missing_parents 0\n-    set scripts {}\n-    set narcs [llength $varctok($v)]\n-    for {set a 1} {$a < $narcs} {incr a} {\n-\tset id [lindex $varccommits($v,$a) end]\n-\tforeach p $parents($v,$id) {\n-\t    if {[info exists varcid($v,$p)]} continue\n-\t    # add p as a new commit\n-\t    incr missing_parents\n-\t    set cmitlisted($v,$p) 0\n-\t    set parents($v,$p) {}\n-\t    if {[llength $children($v,$p)] == 1 &&\n-\t\t[llength $parents($v,$id)] == 1} {\n-\t\tset b $a\n-\t    } else {\n-\t\tset b [newvarc $v $p]\n-\t    }\n-\t    set varcid($v,$p) $b\n-\t    if {[string compare [lindex $varctok($v) $b] $vtokmod($v)] < 0} {\n-\t\tmodify_arc $v $b\n-\t    }\n-\t    lappend varccommits($v,$b) $p\n-\t    incr commitidx($v)\n-\t    if {$v == $curview} {\n-\t\tset numcommits $commitidx($v)\n-\t    }\n-\t    set scripts [check_interest $p $scripts]\n+\tset missing_parents 0\n+\tset scripts {}\n+\tset narcs [llength $varctok($v)]\n+\tfor {set a 1} {$a < $narcs} {incr a} {\n+\t\tset id [lindex $varccommits($v,$a) end]\n+\t\tforeach p $parents($v,$id) {\n+\t\t\tif {[info exists varcid($v,$p)]} continue\n+\t\t\t# add p as a new commit\n+\t\t\tincr missing_parents\n+\t\t\tset cmitlisted($v,$p) 0\n+\t\t\tset parents($v,$p) {}\n+\t\t\tif {[llength $children($v,$p)] == 1 &&\n+\t\t\t\t[llength $parents($v,$id)] == 1} {\n+\t\t\t\tset b $a\n+\t\t\t} else {\n+\t\t\t\tset b [newvarc $v $p]\n+\t\t\t}\n+\t\t\tset varcid($v,$p) $b\n+\t\t\tif {[string compare [lindex $varctok($v) $b] $vtokmod($v)] < 0} {\n+\t\t\t\tmodify_arc $v $b\n+\t\t\t}\n+\t\t\tlappend varccommits($v,$b) $p\n+\t\t\tincr commitidx($v)\n+\t\t\tif {$v == $curview} {\n+\t\t\t\tset numcommits $commitidx($v)\n+\t\t\t}\n+\t\t\tset scripts [check_interest $p $scripts]\n+\t\t}\n \t}\n-    }\n-    if {$missing_parents > 0} {\n-\tforeach s $scripts {\n-\t    eval $s\n+\tif {$missing_parents > 0} {\n+\t\tforeach s $scripts {\n+\t\t\teval $s\n+\t\t}\n \t}\n-    }\n }\n \n # Use $rwid as a substitute for $id, i.e. reparent $id's children to $rwid\n # Assumes we already have an arc for $rwid.\n proc rewrite_commit {v id rwid} {\n-    global children parents varcid varctok vtokmod varccommits\n+\tglobal children parents varcid varctok vtokmod varccommits\n \n-    foreach ch $children($v,$id) {\n-\t# make $rwid be $ch's parent in place of $id\n-\tset i [lsearch -exact $parents($v,$ch) $id]\n-\tif {$i < 0} {\n-\t    puts \"oops rewrite_commit didn't find $id in parent list for $ch\"\n+\tforeach ch $children($v,$id) {\n+\t\t# make $rwid be $ch's parent in place of $id\n+\t\tset i [lsearch -exact $parents($v,$ch) $id]\n+\t\tif {$i < 0} {\n+\t\t\tputs \"oops rewrite_commit didn't find $id in parent list for $ch\"\n+\t\t}\n+\t\tset parents($v,$ch) [lreplace $parents($v,$ch) $i $i $rwid]\n+\t\t# add $ch to $rwid's children and sort the list if necessary\n+\t\tif {[llength [lappend children($v,$rwid) $ch]] > 1} {\n+\t\t\tset children($v,$rwid) [lsort -command [list vtokcmp $v] \\\n+\t\t\t\t\t\t\t\t\t\t$children($v,$rwid)]\n+\t\t}\n+\t\t# fix the graph after joining $id to $rwid\n+\t\tset a $varcid($v,$ch)\n+\t\tfix_reversal $rwid $a $v\n+\t\t# parentlist is wrong for the last element of arc $a\n+\t\t# even if displayorder is right, hence the 3rd arg here\n+\t\tmodify_arc $v $a [expr {[llength $varccommits($v,$a)] - 1}]\n \t}\n-\tset parents($v,$ch) [lreplace $parents($v,$ch) $i $i $rwid]\n-\t# add $ch to $rwid's children and sort the list if necessary\n-\tif {[llength [lappend children($v,$rwid) $ch]] > 1} {\n-\t    set children($v,$rwid) [lsort -command [list vtokcmp $v] \\\n-\t\t\t\t\t$children($v,$rwid)]\n-\t}\n-\t# fix the graph after joining $id to $rwid\n-\tset a $varcid($v,$ch)\n-\tfix_reversal $rwid $a $v\n-\t# parentlist is wrong for the last element of arc $a\n-\t# even if displayorder is right, hence the 3rd arg here\n-\tmodify_arc $v $a [expr {[llength $varccommits($v,$a)] - 1}]\n-    }\n }\n \n # Mechanism for registering a command to be executed when we come\n # across a particular commit.  To handle the case when only the\n # prefix of the commit is known, the commitinterest array is now\n-# indexed by the first 4 characters of the ID.  Each element is a\n+# indexed by the first 4 characters of the ID.\tEach element is a\n # list of id, cmd pairs.\n proc interestedin {id cmd} {\n-    global commitinterest\n+\tglobal commitinterest\n \n-    lappend commitinterest([string range $id 0 3]) $id $cmd\n+\tlappend commitinterest([string range $id 0 3]) $id $cmd\n }\n \n proc check_interest {id scripts} {\n-    global commitinterest\n+\tglobal commitinterest\n \n-    set prefix [string range $id 0 3]\n-    if {[info exists commitinterest($prefix)]} {\n-\tset newlist {}\n-\tforeach {i script} $commitinterest($prefix) {\n-\t    if {[string match \"$i*\" $id]} {\n-\t\tlappend scripts [string map [list \"%I\" $id \"%P\" $i] $script]\n-\t    } else {\n-\t\tlappend newlist $i $script\n-\t    }\n+\tset prefix [string range $id 0 3]\n+\tif {[info exists commitinterest($prefix)]} {\n+\t\tset newlist {}\n+\t\tforeach {i script} $commitinterest($prefix) {\n+\t\t\tif {[string match \"$i*\" $id]} {\n+\t\t\t\tlappend scripts [string map [list \"%I\" $id \"%P\" $i] $script]\n+\t\t\t} else {\n+\t\t\t\tlappend newlist $i $script\n+\t\t\t}\n+\t\t}\n+\t\tif {$newlist ne {}} {\n+\t\t\tset commitinterest($prefix) $newlist\n+\t\t} else {\n+\t\t\tunset commitinterest($prefix)\n+\t\t}\n \t}\n-\tif {$newlist ne {}} {\n-\t    set commitinterest($prefix) $newlist\n-\t} else {\n-\t    unset commitinterest($prefix)\n-\t}\n-    }\n-    return $scripts\n+\treturn $scripts\n }\n \n proc getcommitlines {fd inst view updating}  {\n-    global cmitlisted leftover\n-    global commitidx commitdata vdatemode\n-    global parents children curview hlview\n-    global idpending ordertok\n-    global varccommits varcid varctok vtokmod vfilelimit vshortids\n+\tglobal cmitlisted leftover\n+\tglobal commitidx commitdata vdatemode\n+\tglobal parents children curview hlview\n+\tglobal idpending ordertok\n+\tglobal varccommits varcid varctok vtokmod vfilelimit vshortids\n \n-    set stuff [read $fd 500000]\n-    # git log doesn't terminate the last commit with a null...\n-    if {$stuff == {} && $leftover($inst) ne {} && [eof $fd]} {\n-\tset stuff \"\\0\"\n-    }\n-    if {$stuff == {}} {\n-\tif {![eof $fd]} {\n-\t    return 1\n+\tset stuff [read $fd 500000]\n+\t# git log doesn't terminate the last commit with a null...\n+\tif {$stuff == {} && $leftover($inst) ne {} && [eof $fd]} {\n+\t\tset stuff \"\\0\"\n \t}\n-\tglobal commfd viewcomplete viewactive viewname\n-\tglobal viewinstances\n-\tunset commfd($inst)\n-\tset i [lsearch -exact $viewinstances($view) $inst]\n-\tif {$i >= 0} {\n-\t    set viewinstances($view) [lreplace $viewinstances($view) $i $i]\n-\t}\n-\t# set it blocking so we wait for the process to terminate\n-\tfconfigure $fd -blocking 1\n-\tif {[catch {close $fd} err]} {\n-\t    set fv {}\n-\t    if {$view != $curview} {\n-\t\tset fv \" for the \\\"$viewname($view)\\\" view\"\n-\t    }\n-\t    if {[string range $err 0 4] == \"usage\"} {\n-\t\tset err \"Gitk: error reading commits$fv:\\\n-\t\t\tbad arguments to git log.\"\n-\t\tif {$viewname($view) eq [mc \"Command line\"]} {\n-\t\t    append err \\\n-\t\t\t\"  (Note: arguments to gitk are passed to git log\\\n-\t\t\t to allow selection of commits to be displayed.)\"\n+\tif {$stuff == {}} {\n+\t\tif {![eof $fd]} {\n+\t\t\treturn 1\n \t\t}\n-\t    } else {\n-\t\tset err \"Error reading commits$fv: $err\"\n-\t    }\n-\t    error_popup $err\n-\t}\n-\tif {[incr viewactive($view) -1] <= 0} {\n-\t    set viewcomplete($view) 1\n-\t    # Check if we have seen any ids listed as parents that haven't\n-\t    # appeared in the list\n-\t    closevarcs $view\n-\t    notbusy $view\n-\t}\n-\tif {$view == $curview} {\n-\t    run chewcommits\n-\t}\n-\treturn 0\n-    }\n-    set start 0\n-    set gotsome 0\n-    set scripts {}\n-    while 1 {\n-\tset i [string first \"\\0\" $stuff $start]\n-\tif {$i < 0} {\n-\t    append leftover($inst) [string range $stuff $start end]\n-\t    break\n-\t}\n-\tif {$start == 0} {\n-\t    set cmit $leftover($inst)\n-\t    append cmit [string range $stuff 0 [expr {$i - 1}]]\n-\t    set leftover($inst) {}\n-\t} else {\n-\t    set cmit [string range $stuff $start [expr {$i - 1}]]\n-\t}\n-\tset start [expr {$i + 1}]\n-\tset j [string first \"\\n\" $cmit]\n-\tset ok 0\n-\tset listed 1\n-\tif {$j >= 0 && [string match \"commit *\" $cmit]} {\n-\t    set ids [string range $cmit 7 [expr {$j - 1}]]\n-\t    if {[string match {[-^<>]*} $ids]} {\n-\t\tswitch -- [string index $ids 0] {\n-\t\t    \"-\" {set listed 0}\n-\t\t    \"^\" {set listed 2}\n-\t\t    \"<\" {set listed 3}\n-\t\t    \">\" {set listed 4}\n+\t\tglobal commfd viewcomplete viewactive viewname\n+\t\tglobal viewinstances\n+\t\tunset commfd($inst)\n+\t\tset i [lsearch -exact $viewinstances($view) $inst]\n+\t\tif {$i >= 0} {\n+\t\t\tset viewinstances($view) [lreplace $viewinstances($view) $i $i]\n \t\t}\n-\t\tset ids [string range $ids 1 end]\n-\t    }\n-\t    set ok 1\n-\t    foreach id $ids {\n-\t\tif {[string length $id] != 40} {\n-\t\t    set ok 0\n-\t\t    break\n+\t\t# set it blocking so we wait for the process to terminate\n+\t\tfconfigure $fd -blocking 1\n+\t\tif {[catch {close $fd} err]} {\n+\t\t\tset fv {}\n+\t\t\tif {$view != $curview} {\n+\t\t\t\tset fv \" for the \\\"$viewname($view)\\\" view\"\n+\t\t\t}\n+\t\t\tif {[string range $err 0 4] == \"usage\"} {\n+\t\t\t\tset err \"Gitk: error reading commits$fv:\\\n+\t\t\t\t\t\tbad arguments to git log.\"\n+\t\t\t\tif {$viewname($view) eq [mc \"Command line\"]} {\n+\t\t\t\t\tappend err \\\n+\t\t\t\t\t\t\"  (Note: arguments to gitk are passed to git log\\\n+\t\t\t\t\t\t to allow selection of commits to be displayed.)\"\n+\t\t\t\t}\n+\t\t\t} else {\n+\t\t\t\tset err \"Error reading commits$fv: $err\"\n+\t\t\t}\n+\t\t\terror_popup $err\n \t\t}\n-\t    }\n-\t}\n-\tif {!$ok} {\n-\t    set shortcmit $cmit\n-\t    if {[string length $shortcmit] > 80} {\n-\t\tset shortcmit \"[string range $shortcmit 0 80]...\"\n-\t    }\n-\t    error_popup \"[mc \"Can't parse git log output:\"] {$shortcmit}\"\n-\t    exit 1\n-\t}\n-\tset id [lindex $ids 0]\n-\tset vid $view,$id\n-\n-\tlappend vshortids($view,[string range $id 0 3]) $id\n-\n-\tif {!$listed && $updating && ![info exists varcid($vid)] &&\n-\t    $vfilelimit($view) ne {}} {\n-\t    # git log doesn't rewrite parents for unlisted commits\n-\t    # when doing path limiting, so work around that here\n-\t    # by working out the rewritten parent with git rev-list\n-\t    # and if we already know about it, using the rewritten\n-\t    # parent as a substitute parent for $id's children.\n-\t    if {![catch {\n-\t\tset rwid [exec git rev-list --first-parent --max-count=1 \\\n-\t\t\t      $id -- $vfilelimit($view)]\n-\t    }]} {\n-\t\tif {$rwid ne {} && [info exists varcid($view,$rwid)]} {\n-\t\t    # use $rwid in place of $id\n-\t\t    rewrite_commit $view $id $rwid\n-\t\t    continue\n+\t\tif {[incr viewactive($view) -1] <= 0} {\n+\t\t\tset viewcomplete($view) 1\n+\t\t\t# Check if we have seen any ids listed as parents that haven't\n+\t\t\t# appeared in the list\n+\t\t\tclosevarcs $view\n+\t\t\tnotbusy $view\n \t\t}\n-\t    }\n-\t}\n-\n-\tset a 0\n-\tif {[info exists varcid($vid)]} {\n-\t    if {$cmitlisted($vid) || !$listed} continue\n-\t    set a $varcid($vid)\n-\t}\n-\tif {$listed} {\n-\t    set olds [lrange $ids 1 end]\n-\t} else {\n-\t    set olds {}\n-\t}\n-\tset commitdata($id) [string range $cmit [expr {$j + 1}] end]\n-\tset cmitlisted($vid) $listed\n-\tset parents($vid) $olds\n-\tif {![info exists children($vid)]} {\n-\t    set children($vid) {}\n-\t} elseif {$a == 0 && [llength $children($vid)] == 1} {\n-\t    set k [lindex $children($vid) 0]\n-\t    if {[llength $parents($view,$k)] == 1 &&\n-\t\t(!$vdatemode($view) ||\n-\t\t $varcid($view,$k) == [llength $varctok($view)] - 1)} {\n-\t\tset a $varcid($view,$k)\n-\t    }\n-\t}\n-\tif {$a == 0} {\n-\t    # new arc\n-\t    set a [newvarc $view $id]\n-\t}\n-\tif {[string compare [lindex $varctok($view) $a] $vtokmod($view)] < 0} {\n-\t    modify_arc $view $a\n-\t}\n-\tif {![info exists varcid($vid)]} {\n-\t    set varcid($vid) $a\n-\t    lappend varccommits($view,$a) $id\n-\t    incr commitidx($view)\n-\t}\n-\n-\tset i 0\n-\tforeach p $olds {\n-\t    if {$i == 0 || [lsearch -exact $olds $p] >= $i} {\n-\t\tset vp $view,$p\n-\t\tif {[llength [lappend children($vp) $id]] > 1 &&\n-\t\t    [vtokcmp $view [lindex $children($vp) end-1] $id] > 0} {\n-\t\t    set children($vp) [lsort -command [list vtokcmp $view] \\\n-\t\t\t\t\t   $children($vp)]\n-\t\t    unset -nocomplain ordertok\n+\t\tif {$view == $curview} {\n+\t\t\trun chewcommits\n \t\t}\n-\t\tif {[info exists varcid($view,$p)]} {\n-\t\t    fix_reversal $p $a $view\n+\t\treturn 0\n+\t}\n+\tset start 0\n+\tset gotsome 0\n+\tset scripts {}\n+\twhile 1 {\n+\t\tset i [string first \"\\0\" $stuff $start]\n+\t\tif {$i < 0} {\n+\t\t\tappend leftover($inst) [string range $stuff $start end]\n+\t\t\tbreak\n \t\t}\n-\t    }\n-\t    incr i\n-\t}\n+\t\tif {$start == 0} {\n+\t\t\tset cmit $leftover($inst)\n+\t\t\tappend cmit [string range $stuff 0 [expr {$i - 1}]]\n+\t\t\tset leftover($inst) {}\n+\t\t} else {\n+\t\t\tset cmit [string range $stuff $start [expr {$i - 1}]]\n+\t\t}\n+\t\tset start [expr {$i + 1}]\n+\t\tset j [string first \"\\n\" $cmit]\n+\t\tset ok 0\n+\t\tset listed 1\n+\t\tif {$j >= 0 && [string match \"commit *\" $cmit]} {\n+\t\t\tset ids [string range $cmit 7 [expr {$j - 1}]]\n+\t\t\tif {[string match {[-^<>]*} $ids]} {\n+\t\t\t\tswitch -- [string index $ids 0] {\n+\t\t\t\t\t\"-\" {set listed 0}\n+\t\t\t\t\t\"^\" {set listed 2}\n+\t\t\t\t\t\"<\" {set listed 3}\n+\t\t\t\t\t\">\" {set listed 4}\n+\t\t\t\t}\n+\t\t\t\tset ids [string range $ids 1 end]\n+\t\t\t}\n+\t\t\tset ok 1\n+\t\t\tforeach id $ids {\n+\t\t\t\tif {[string length $id] != 40} {\n+\t\t\t\t\tset ok 0\n+\t\t\t\t\tbreak\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\t\tif {!$ok} {\n+\t\t\tset shortcmit $cmit\n+\t\t\tif {[string length $shortcmit] > 80} {\n+\t\t\t\tset shortcmit \"[string range $shortcmit 0 80]...\"\n+\t\t\t}\n+\t\t\terror_popup \"[mc \"Can't parse git log output:\"] {$shortcmit}\"\n+\t\t\texit 1\n+\t\t}\n+\t\tset id [lindex $ids 0]\n+\t\tset vid $view,$id\n \n-\tset scripts [check_interest $id $scripts]\n-\tset gotsome 1\n-    }\n-    if {$gotsome} {\n-\tglobal numcommits hlview\n+\t\tlappend vshortids($view,[string range $id 0 3]) $id\n \n-\tif {$view == $curview} {\n-\t    set numcommits $commitidx($view)\n-\t    run chewcommits\n+\t\tif {!$listed && $updating && ![info exists varcid($vid)] &&\n+\t\t\t$vfilelimit($view) ne {}} {\n+\t\t\t# git log doesn't rewrite parents for unlisted commits\n+\t\t\t# when doing path limiting, so work around that here\n+\t\t\t# by working out the rewritten parent with git rev-list\n+\t\t\t# and if we already know about it, using the rewritten\n+\t\t\t# parent as a substitute parent for $id's children.\n+\t\t\tif {![catch {\n+\t\t\t\tset rwid [exec git rev-list --first-parent --max-count=1 \\\n+\t\t\t\t\t\t\t  $id -- $vfilelimit($view)]\n+\t\t\t}]} {\n+\t\t\t\tif {$rwid ne {} && [info exists varcid($view,$rwid)]} {\n+\t\t\t\t\t# use $rwid in place of $id\n+\t\t\t\t\trewrite_commit $view $id $rwid\n+\t\t\t\t\tcontinue\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\n+\t\tset a 0\n+\t\tif {[info exists varcid($vid)]} {\n+\t\t\tif {$cmitlisted($vid) || !$listed} continue\n+\t\t\tset a $varcid($vid)\n+\t\t}\n+\t\tif {$listed} {\n+\t\t\tset olds [lrange $ids 1 end]\n+\t\t} else {\n+\t\t\tset olds {}\n+\t\t}\n+\t\tset commitdata($id) [string range $cmit [expr {$j + 1}] end]\n+\t\tset cmitlisted($vid) $listed\n+\t\tset parents($vid) $olds\n+\t\tif {![info exists children($vid)]} {\n+\t\t\tset children($vid) {}\n+\t\t} elseif {$a == 0 && [llength $children($vid)] == 1} {\n+\t\t\tset k [lindex $children($vid) 0]\n+\t\t\tif {[llength $parents($view,$k)] == 1 &&\n+\t\t\t\t(!$vdatemode($view) ||\n+\t\t\t\t $varcid($view,$k) == [llength $varctok($view)] - 1)} {\n+\t\t\t\tset a $varcid($view,$k)\n+\t\t\t}\n+\t\t}\n+\t\tif {$a == 0} {\n+\t\t\t# new arc\n+\t\t\tset a [newvarc $view $id]\n+\t\t}\n+\t\tif {[string compare [lindex $varctok($view) $a] $vtokmod($view)] < 0} {\n+\t\t\tmodify_arc $view $a\n+\t\t}\n+\t\tif {![info exists varcid($vid)]} {\n+\t\t\tset varcid($vid) $a\n+\t\t\tlappend varccommits($view,$a) $id\n+\t\t\tincr commitidx($view)\n+\t\t}\n+\n+\t\tset i 0\n+\t\tforeach p $olds {\n+\t\t\tif {$i == 0 || [lsearch -exact $olds $p] >= $i} {\n+\t\t\t\tset vp $view,$p\n+\t\t\t\tif {[llength [lappend children($vp) $id]] > 1 &&\n+\t\t\t\t\t[vtokcmp $view [lindex $children($vp) end-1] $id] > 0} {\n+\t\t\t\t\tset children($vp) [lsort -command [list vtokcmp $view] \\\n+\t\t\t\t\t\t\t\t\t\t   $children($vp)]\n+\t\t\t\t\tunset -nocomplain ordertok\n+\t\t\t\t}\n+\t\t\t\tif {[info exists varcid($view,$p)]} {\n+\t\t\t\t\tfix_reversal $p $a $view\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tincr i\n+\t\t}\n+\n+\t\tset scripts [check_interest $id $scripts]\n+\t\tset gotsome 1\n \t}\n-\tif {[info exists hlview] && $view == $hlview} {\n-\t    # we never actually get here...\n-\t    run vhighlightmore\n+\tif {$gotsome} {\n+\t\tglobal numcommits hlview\n+\n+\t\tif {$view == $curview} {\n+\t\t\tset numcommits $commitidx($view)\n+\t\t\trun chewcommits\n+\t\t}\n+\t\tif {[info exists hlview] && $view == $hlview} {\n+\t\t\t# we never actually get here...\n+\t\t\trun vhighlightmore\n+\t\t}\n+\t\tforeach s $scripts {\n+\t\t\teval $s\n+\t\t}\n \t}\n-\tforeach s $scripts {\n-\t    eval $s\n-\t}\n-    }\n-    return 2\n+\treturn 2\n }\n \n proc chewcommits {} {\n-    global curview hlview viewcomplete\n-    global pending_select\n+\tglobal curview hlview viewcomplete\n+\tglobal pending_select\n \n-    layoutmore\n-    if {$viewcomplete($curview)} {\n-\tglobal commitidx varctok\n-\tglobal numcommits startmsecs\n+\tlayoutmore\n+\tif {$viewcomplete($curview)} {\n+\t\tglobal commitidx varctok\n+\t\tglobal numcommits startmsecs\n \n-\tif {[info exists pending_select]} {\n-\t    update\n-\t    reset_pending_select {}\n+\t\tif {[info exists pending_select]} {\n+\t\t\tupdate\n+\t\t\treset_pending_select {}\n \n-\t    if {[commitinview $pending_select $curview]} {\n-\t\tselectline [rowofcommit $pending_select] 1\n-\t    } else {\n-\t\tset row [first_real_row]\n-\t\tselectline $row 1\n-\t    }\n+\t\t\tif {[commitinview $pending_select $curview]} {\n+\t\t\t\tselectline [rowofcommit $pending_select] 1\n+\t\t\t} else {\n+\t\t\t\tset row [first_real_row]\n+\t\t\t\tselectline $row 1\n+\t\t\t}\n+\t\t}\n+\t\tif {$commitidx($curview) > 0} {\n+\t\t\t#set ms [expr {[clock clicks -milliseconds] - $startmsecs}]\n+\t\t\t#puts \"overall $ms ms for $numcommits commits\"\n+\t\t\t#puts \"[llength $varctok($view)] arcs, $commitidx($view) commits\"\n+\t\t} else {\n+\t\t\tshow_status [mc \"No commits selected\"]\n+\t\t}\n+\t\tnotbusy layout\n \t}\n-\tif {$commitidx($curview) > 0} {\n-\t    #set ms [expr {[clock clicks -milliseconds] - $startmsecs}]\n-\t    #puts \"overall $ms ms for $numcommits commits\"\n-\t    #puts \"[llength $varctok($view)] arcs, $commitidx($view) commits\"\n-\t} else {\n-\t    show_status [mc \"No commits selected\"]\n-\t}\n-\tnotbusy layout\n-    }\n-    return 0\n+\treturn 0\n }\n \n proc do_readcommit {id} {\n-    global tclencoding\n+\tglobal tclencoding\n \n-    # Invoke git-log to handle automatic encoding conversion\n-    set fd [open [concat | git log --no-color --pretty=raw -1 $id] r]\n-    # Read the results using i18n.logoutputencoding\n-    fconfigure $fd -translation lf -eofchar {}\n-    if {$tclencoding != {}} {\n-\tfconfigure $fd -encoding $tclencoding\n-    }\n-    set contents [read $fd]\n-    close $fd\n-    # Remove the heading line\n-    regsub {^commit [0-9a-f]+\\n} $contents {} contents\n+\t# Invoke git-log to handle automatic encoding conversion\n+\tset fd [open [concat | git log --no-color --pretty=raw -1 $id] r]\n+\t# Read the results using i18n.logoutputencoding\n+\tfconfigure $fd -translation lf -eofchar {}\n+\tif {$tclencoding != {}} {\n+\t\tfconfigure $fd -encoding $tclencoding\n+\t}\n+\tset contents [read $fd]\n+\tclose $fd\n+\t# Remove the heading line\n+\tregsub {^commit [0-9a-f]+\\n} $contents {} contents\n \n-    return $contents\n+\treturn $contents\n }\n \n proc readcommit {id} {\n-    if {[catch {set contents [do_readcommit $id]}]} return\n-    parsecommit $id $contents 1\n+\tif {[catch {set contents [do_readcommit $id]}]} return\n+\tparsecommit $id $contents 1\n }\n \n proc parsecommit {id contents listed} {\n-    global commitinfo\n+\tglobal commitinfo\n \n-    set inhdr 1\n-    set comment {}\n-    set headline {}\n-    set auname {}\n-    set audate {}\n-    set comname {}\n-    set comdate {}\n-    set hdrend [string first \"\\n\\n\" $contents]\n-    if {$hdrend < 0} {\n-\t# should never happen...\n-\tset hdrend [string length $contents]\n-    }\n-    set header [string range $contents 0 [expr {$hdrend - 1}]]\n-    set comment [string range $contents [expr {$hdrend + 2}] end]\n-    foreach line [split $header \"\\n\"] {\n-\tset line [split $line \" \"]\n-\tset tag [lindex $line 0]\n-\tif {$tag == \"author\"} {\n-\t    set audate [lrange $line end-1 end]\n-\t    set auname [join [lrange $line 1 end-2] \" \"]\n-\t} elseif {$tag == \"committer\"} {\n-\t    set comdate [lrange $line end-1 end]\n-\t    set comname [join [lrange $line 1 end-2] \" \"]\n+\tset inhdr 1\n+\tset comment {}\n+\tset headline {}\n+\tset auname {}\n+\tset audate {}\n+\tset comname {}\n+\tset comdate {}\n+\tset hdrend [string first \"\\n\\n\" $contents]\n+\tif {$hdrend < 0} {\n+\t\t# should never happen...\n+\t\tset hdrend [string length $contents]\n \t}\n-    }\n-    set headline {}\n-    # take the first non-blank line of the comment as the headline\n-    set headline [string trimleft $comment]\n-    set i [string first \"\\n\" $headline]\n-    if {$i >= 0} {\n-\tset headline [string range $headline 0 $i]\n-    }\n-    set headline [string trimright $headline]\n-    set i [string first \"\\r\" $headline]\n-    if {$i >= 0} {\n-\tset headline [string trimright [string range $headline 0 $i]]\n-    }\n-    if {!$listed} {\n-\t# git log indents the comment by 4 spaces;\n-\t# if we got this via git cat-file, add the indentation\n-\tset newcomment {}\n-\tforeach line [split $comment \"\\n\"] {\n-\t    append newcomment \"    \"\n-\t    append newcomment $line\n-\t    append newcomment \"\\n\"\n+\tset header [string range $contents 0 [expr {$hdrend - 1}]]\n+\tset comment [string range $contents [expr {$hdrend + 2}] end]\n+\tforeach line [split $header \"\\n\"] {\n+\t\tset line [split $line \" \"]\n+\t\tset tag [lindex $line 0]\n+\t\tif {$tag == \"author\"} {\n+\t\t\tset audate [lrange $line end-1 end]\n+\t\t\tset auname [join [lrange $line 1 end-2] \" \"]\n+\t\t} elseif {$tag == \"committer\"} {\n+\t\t\tset comdate [lrange $line end-1 end]\n+\t\t\tset comname [join [lrange $line 1 end-2] \" \"]\n+\t\t}\n \t}\n-\tset comment $newcomment\n-    }\n-    set hasnote [string first \"\\nNotes:\\n\" $contents]\n-    set diff \"\"\n-    # If there is diff output shown in the git-log stream, split it\n-    # out.  But get rid of the empty line that always precedes the\n-    # diff.\n-    set i [string first \"\\n\\ndiff\" $comment]\n-    if {$i >= 0} {\n-\tset diff [string range $comment $i+1 end]\n-\tset comment [string range $comment 0 $i-1]\n-    }\n-    set commitinfo($id) [list $headline $auname $audate \\\n-\t\t\t     $comname $comdate $comment $hasnote $diff]\n+\tset headline {}\n+\t# take the first non-blank line of the comment as the headline\n+\tset headline [string trimleft $comment]\n+\tset i [string first \"\\n\" $headline]\n+\tif {$i >= 0} {\n+\t\tset headline [string range $headline 0 $i]\n+\t}\n+\tset headline [string trimright $headline]\n+\tset i [string first \"\\r\" $headline]\n+\tif {$i >= 0} {\n+\t\tset headline [string trimright [string range $headline 0 $i]]\n+\t}\n+\tif {!$listed} {\n+\t\t# git log indents the comment by 4 spaces;\n+\t\t# if we got this via git cat-file, add the indentation\n+\t\tset newcomment {}\n+\t\tforeach line [split $comment \"\\n\"] {\n+\t\t\tappend newcomment \"    \"\n+\t\t\tappend newcomment $line\n+\t\t\tappend newcomment \"\\n\"\n+\t\t}\n+\t\tset comment $newcomment\n+\t}\n+\tset hasnote [string first \"\\nNotes:\\n\" $contents]\n+\tset diff \"\"\n+\t# If there is diff output shown in the git-log stream, split it\n+\t# out.\tBut get rid of the empty line that always precedes the\n+\t# diff.\n+\tset i [string first \"\\n\\ndiff\" $comment]\n+\tif {$i >= 0} {\n+\t\tset diff [string range $comment $i+1 end]\n+\t\tset comment [string range $comment 0 $i-1]\n+\t}\n+\tset commitinfo($id) [list $headline $auname $audate \\\n+\t\t\t\t\t\t\t $comname $comdate $comment $hasnote $diff]\n }\n \n proc getcommit {id} {\n-    global commitdata commitinfo\n+\tglobal commitdata commitinfo\n \n-    if {[info exists commitdata($id)]} {\n-\tparsecommit $id $commitdata($id) 1\n-    } else {\n-\treadcommit $id\n-\tif {![info exists commitinfo($id)]} {\n-\t    set commitinfo($id) [list [mc \"No commit information available\"]]\n+\tif {[info exists commitdata($id)]} {\n+\t\tparsecommit $id $commitdata($id) 1\n+\t} else {\n+\t\treadcommit $id\n+\t\tif {![info exists commitinfo($id)]} {\n+\t\t\tset commitinfo($id) [list [mc \"No commit information available\"]]\n+\t\t}\n \t}\n-    }\n-    return 1\n+\treturn 1\n }\n \n # Expand an abbreviated commit ID to a list of full 40-char IDs that match\n # and are present in the current view.\n # This is fairly slow...\n proc longid {prefix} {\n-    global varcid curview vshortids\n+\tglobal varcid curview vshortids\n \n-    set ids {}\n-    if {[string length $prefix] >= 4} {\n-\tset vshortid $curview,[string range $prefix 0 3]\n-\tif {[info exists vshortids($vshortid)]} {\n-\t    foreach id $vshortids($vshortid) {\n-\t\tif {[string match \"$prefix*\" $id]} {\n-\t\t    if {[lsearch -exact $ids $id] < 0} {\n-\t\t\tlappend ids $id\n-\t\t\tif {[llength $ids] >= 2} break\n-\t\t    }\n+\tset ids {}\n+\tif {[string length $prefix] >= 4} {\n+\t\tset vshortid $curview,[string range $prefix 0 3]\n+\t\tif {[info exists vshortids($vshortid)]} {\n+\t\t\tforeach id $vshortids($vshortid) {\n+\t\t\t\tif {[string match \"$prefix*\" $id]} {\n+\t\t\t\t\tif {[lsearch -exact $ids $id] < 0} {\n+\t\t\t\t\t\tlappend ids $id\n+\t\t\t\t\t\tif {[llength $ids] >= 2} break\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\t} else {\n+\t\tforeach match [array names varcid \"$curview,$prefix*\"] {\n+\t\t\tlappend ids [lindex [split $match \",\"] 1]\n+\t\t\tif {[llength $ids] >= 2} break\n \t\t}\n-\t    }\n \t}\n-    } else {\n-\tforeach match [array names varcid \"$curview,$prefix*\"] {\n-\t    lappend ids [lindex [split $match \",\"] 1]\n-\t    if {[llength $ids] >= 2} break\n-\t}\n-    }\n-    return $ids\n+\treturn $ids\n }\n \n proc readrefs {} {\n-    global tagids idtags headids idheads tagobjid\n-    global otherrefids idotherrefs mainhead mainheadid\n-    global selecthead selectheadid\n-    global hideremotes\n-    global tclencoding\n+\tglobal tagids idtags headids idheads tagobjid\n+\tglobal otherrefids idotherrefs mainhead mainheadid\n+\tglobal selecthead selectheadid\n+\tglobal hideremotes\n+\tglobal tclencoding\n \n-    foreach v {tagids idtags headids idheads otherrefids idotherrefs} {\n-\tunset -nocomplain $v\n-    }\n-    set refd [open [list | git show-ref -d] r]\n-    if {$tclencoding != {}} {\n-\tfconfigure $refd -encoding $tclencoding\n-    }\n-    while {[gets $refd line] >= 0} {\n-\tif {[string index $line 40] ne \" \"} continue\n-\tset id [string range $line 0 39]\n-\tset ref [string range $line 41 end]\n-\tif {![string match \"refs/*\" $ref]} continue\n-\tset name [string range $ref 5 end]\n-\tif {[string match \"remotes/*\" $name]} {\n-\t    if {![string match \"*/HEAD\" $name] && !$hideremotes} {\n-\t\tset headids($name) $id\n-\t\tlappend idheads($id) $name\n-\t    }\n-\t} elseif {[string match \"heads/*\" $name]} {\n-\t    set name [string range $name 6 end]\n-\t    set headids($name) $id\n-\t    lappend idheads($id) $name\n-\t} elseif {[string match \"tags/*\" $name]} {\n-\t    # this lets refs/tags/foo^{} overwrite refs/tags/foo,\n-\t    # which is what we want since the former is the commit ID\n-\t    set name [string range $name 5 end]\n-\t    if {[string match \"*^{}\" $name]} {\n-\t\tset name [string range $name 0 end-3]\n-\t    } else {\n-\t\tset tagobjid($name) $id\n-\t    }\n-\t    set tagids($name) $id\n-\t    lappend idtags($id) $name\n-\t} else {\n-\t    set otherrefids($name) $id\n-\t    lappend idotherrefs($id) $name\n+\tforeach v {tagids idtags headids idheads otherrefids idotherrefs} {\n+\t\tunset -nocomplain $v\n \t}\n-    }\n-    catch {close $refd}\n-    set mainhead {}\n-    set mainheadid {}\n-    catch {\n-\tset mainheadid [exec git rev-parse HEAD]\n-\tset thehead [exec git symbolic-ref HEAD]\n-\tif {[string match \"refs/heads/*\" $thehead]} {\n-\t    set mainhead [string range $thehead 11 end]\n+\tset refd [open [list | git show-ref -d] r]\n+\tif {$tclencoding != {}} {\n+\t\tfconfigure $refd -encoding $tclencoding\n \t}\n-    }\n-    set selectheadid {}\n-    if {$selecthead ne {}} {\n+\twhile {[gets $refd line] >= 0} {\n+\t\tif {[string index $line 40] ne \" \"} continue\n+\t\tset id [string range $line 0 39]\n+\t\tset ref [string range $line 41 end]\n+\t\tif {![string match \"refs/*\" $ref]} continue\n+\t\tset name [string range $ref 5 end]\n+\t\tif {[string match \"remotes/*\" $name]} {\n+\t\t\tif {![string match \"*/HEAD\" $name] && !$hideremotes} {\n+\t\t\t\tset headids($name) $id\n+\t\t\t\tlappend idheads($id) $name\n+\t\t\t}\n+\t\t} elseif {[string match \"heads/*\" $name]} {\n+\t\t\tset name [string range $name 6 end]\n+\t\t\tset headids($name) $id\n+\t\t\tlappend idheads($id) $name\n+\t\t} elseif {[string match \"tags/*\" $name]} {\n+\t\t\t# this lets refs/tags/foo^{} overwrite refs/tags/foo,\n+\t\t\t# which is what we want since the former is the commit ID\n+\t\t\tset name [string range $name 5 end]\n+\t\t\tif {[string match \"*^{}\" $name]} {\n+\t\t\t\tset name [string range $name 0 end-3]\n+\t\t\t} else {\n+\t\t\t\tset tagobjid($name) $id\n+\t\t\t}\n+\t\t\tset tagids($name) $id\n+\t\t\tlappend idtags($id) $name\n+\t\t} else {\n+\t\t\tset otherrefids($name) $id\n+\t\t\tlappend idotherrefs($id) $name\n+\t\t}\n+\t}\n+\tcatch {close $refd}\n+\tset mainhead {}\n+\tset mainheadid {}\n \tcatch {\n-\t    set selectheadid [exec git rev-parse --verify $selecthead]\n+\t\tset mainheadid [exec git rev-parse HEAD]\n+\t\tset thehead [exec git symbolic-ref HEAD]\n+\t\tif {[string match \"refs/heads/*\" $thehead]} {\n+\t\t\tset mainhead [string range $thehead 11 end]\n+\t\t}\n+\t}\n+\tset selectheadid {}\n+\tif {$selecthead ne {}} {\n+\t\tcatch {\n+\t\t\tset selectheadid [exec git rev-parse --verify $selecthead]\n+\t\t}\n \t}\n-    }\n }\n \n # skip over fake commits\n proc first_real_row {} {\n-    global nullid nullid2 numcommits\n+\tglobal nullid nullid2 numcommits\n \n-    for {set row 0} {$row < $numcommits} {incr row} {\n-\tset id [commitonrow $row]\n-\tif {$id ne $nullid && $id ne $nullid2} {\n-\t    break\n+\tfor {set row 0} {$row < $numcommits} {incr row} {\n+\t\tset id [commitonrow $row]\n+\t\tif {$id ne $nullid && $id ne $nullid2} {\n+\t\t\tbreak\n+\t\t}\n \t}\n-    }\n-    return $row\n+\treturn $row\n }\n \n # update things for a head moved to a child of its previous location\n proc movehead {id name} {\n-    global headids idheads\n+\tglobal headids idheads\n \n-    removehead $headids($name) $name\n-    set headids($name) $id\n-    lappend idheads($id) $name\n+\tremovehead $headids($name) $name\n+\tset headids($name) $id\n+\tlappend idheads($id) $name\n }\n \n # update things when a head has been removed\n proc removehead {id name} {\n-    global headids idheads\n+\tglobal headids idheads\n \n-    if {$idheads($id) eq $name} {\n-\tunset idheads($id)\n-    } else {\n-\tset i [lsearch -exact $idheads($id) $name]\n-\tif {$i >= 0} {\n-\t    set idheads($id) [lreplace $idheads($id) $i $i]\n+\tif {$idheads($id) eq $name} {\n+\t\tunset idheads($id)\n+\t} else {\n+\t\tset i [lsearch -exact $idheads($id) $name]\n+\t\tif {$i >= 0} {\n+\t\t\tset idheads($id) [lreplace $idheads($id) $i $i]\n+\t\t}\n \t}\n-    }\n-    unset headids($name)\n+\tunset headids($name)\n }\n \n proc ttk_toplevel {w args} {\n-    global use_ttk\n-    eval [linsert $args 0 ::toplevel $w]\n-    if {$use_ttk} {\n-        place [ttk::frame $w._toplevel_background] -x 0 -y 0 -relwidth 1 -relheight 1\n-    }\n-    return $w\n+\tglobal use_ttk\n+\teval [linsert $args 0 ::toplevel $w]\n+\tif {$use_ttk} {\n+\t\tplace [ttk::frame $w._toplevel_background] -x 0 -y 0 -relwidth 1 -relheight 1\n+\t}\n+\treturn $w\n }\n \n proc make_transient {window origin} {\n-    global have_tk85\n+\tglobal have_tk85\n \n-    # In MacOS Tk 8.4 transient appears to work by setting\n-    # overrideredirect, which is utterly useless, since the\n-    # windows get no border, and are not even kept above\n-    # the parent.\n-    if {!$have_tk85 && [tk windowingsystem] eq {aqua}} return\n+\t# In MacOS Tk 8.4 transient appears to work by setting\n+\t# overrideredirect, which is utterly useless, since the\n+\t# windows get no border, and are not even kept above\n+\t# the parent.\n+\tif {!$have_tk85 && [tk windowingsystem] eq {aqua}} return\n \n-    wm transient $window $origin\n+\twm transient $window $origin\n \n-    # Windows fails to place transient windows normally, so\n-    # schedule a callback to center them on the parent.\n-    if {[tk windowingsystem] eq {win32}} {\n-\tafter idle [list tk::PlaceWindow $window widget $origin]\n-    }\n+\t# Windows fails to place transient windows normally, so\n+\t# schedule a callback to center them on the parent.\n+\tif {[tk windowingsystem] eq {win32}} {\n+\t\tafter idle [list tk::PlaceWindow $window widget $origin]\n+\t}\n }\n \n proc show_error {w top msg} {\n-    global NS\n-    if {![info exists NS]} {set NS \"\"}\n-    if {[wm state $top] eq \"withdrawn\"} { wm deiconify $top }\n-    message $w.m -text $msg -justify center -aspect 400\n-    pack $w.m -side top -fill x -padx 20 -pady 20\n-    ${NS}::button $w.ok -default active -text [mc OK] -command \"destroy $top\"\n-    pack $w.ok -side bottom -fill x\n-    bind $top <Visibility> \"grab $top; focus $top\"\n-    bind $top <Key-Return> \"destroy $top\"\n-    bind $top <Key-space>  \"destroy $top\"\n-    bind $top <Key-Escape> \"destroy $top\"\n-    tkwait window $top\n+\tglobal NS\n+\tif {![info exists NS]} {set NS \"\"}\n+\tif {[wm state $top] eq \"withdrawn\"} { wm deiconify $top }\n+\tmessage $w.m -text $msg -justify center -aspect 400\n+\tpack $w.m -side top -fill x -padx 20 -pady 20\n+\t${NS}::button $w.ok -default active -text [mc OK] -command \"destroy $top\"\n+\tpack $w.ok -side bottom -fill x\n+\tbind $top <Visibility> \"grab $top; focus $top\"\n+\tbind $top <Key-Return> \"destroy $top\"\n+\tbind $top <Key-space>  \"destroy $top\"\n+\tbind $top <Key-Escape> \"destroy $top\"\n+\ttkwait window $top\n }\n \n proc error_popup {msg {owner .}} {\n-    if {[tk windowingsystem] eq \"win32\"} {\n-        tk_messageBox -icon error -type ok -title [wm title .] \\\n-            -parent $owner -message $msg\n-    } else {\n-        set w .error\n-        ttk_toplevel $w\n-        make_transient $w $owner\n-        show_error $w $w $msg\n-    }\n+\tif {[tk windowingsystem] eq \"win32\"} {\n+\t\ttk_messageBox -icon error -type ok -title [wm title .] \\\n+\t\t\t-parent $owner -message $msg\n+\t} else {\n+\t\tset w .error\n+\t\tttk_toplevel $w\n+\t\tmake_transient $w $owner\n+\t\tshow_error $w $w $msg\n+\t}\n }\n \n proc confirm_popup {msg {owner .}} {\n-    global confirm_ok NS\n-    set confirm_ok 0\n-    set w .confirm\n-    ttk_toplevel $w\n-    make_transient $w $owner\n-    message $w.m -text $msg -justify center -aspect 400\n-    pack $w.m -side top -fill x -padx 20 -pady 20\n-    ${NS}::button $w.ok -text [mc OK] -command \"set confirm_ok 1; destroy $w\"\n-    pack $w.ok -side left -fill x\n-    ${NS}::button $w.cancel -text [mc Cancel] -command \"destroy $w\"\n-    pack $w.cancel -side right -fill x\n-    bind $w <Visibility> \"grab $w; focus $w\"\n-    bind $w <Key-Return> \"set confirm_ok 1; destroy $w\"\n-    bind $w <Key-space>  \"set confirm_ok 1; destroy $w\"\n-    bind $w <Key-Escape> \"destroy $w\"\n-    tk::PlaceWindow $w widget $owner\n-    tkwait window $w\n-    return $confirm_ok\n+\tglobal confirm_ok NS\n+\tset confirm_ok 0\n+\tset w .confirm\n+\tttk_toplevel $w\n+\tmake_transient $w $owner\n+\tmessage $w.m -text $msg -justify center -aspect 400\n+\tpack $w.m -side top -fill x -padx 20 -pady 20\n+\t${NS}::button $w.ok -text [mc OK] -command \"set confirm_ok 1; destroy $w\"\n+\tpack $w.ok -side left -fill x\n+\t${NS}::button $w.cancel -text [mc Cancel] -command \"destroy $w\"\n+\tpack $w.cancel -side right -fill x\n+\tbind $w <Visibility> \"grab $w; focus $w\"\n+\tbind $w <Key-Return> \"set confirm_ok 1; destroy $w\"\n+\tbind $w <Key-space>  \"set confirm_ok 1; destroy $w\"\n+\tbind $w <Key-Escape> \"destroy $w\"\n+\ttk::PlaceWindow $w widget $owner\n+\ttkwait window $w\n+\treturn $confirm_ok\n }\n \n proc setoptions {} {\n-    global use_ttk\n+\tglobal use_ttk\n \n-    if {[tk windowingsystem] ne \"win32\"} {\n-        option add *Panedwindow.showHandle 1 startupFile\n-        option add *Panedwindow.sashRelief raised startupFile\n-        if {[tk windowingsystem] ne \"aqua\"} {\n-            option add *Menu.font uifont startupFile\n-        }\n-    } else {\n-        option add *Menu.TearOff 0 startupFile\n-    }\n-    option add *Button.font uifont startupFile\n-    option add *Checkbutton.font uifont startupFile\n-    option add *Radiobutton.font uifont startupFile\n-    option add *Menubutton.font uifont startupFile\n-    option add *Label.font uifont startupFile\n-    option add *Message.font uifont startupFile\n-    option add *Entry.font textfont startupFile\n-    option add *Text.font textfont startupFile\n-    option add *Labelframe.font uifont startupFile\n-    option add *Spinbox.font textfont startupFile\n-    option add *Listbox.font mainfont startupFile\n+\tif {[tk windowingsystem] ne \"win32\"} {\n+\t\toption add *Panedwindow.showHandle 1 startupFile\n+\t\toption add *Panedwindow.sashRelief raised startupFile\n+\t\tif {[tk windowingsystem] ne \"aqua\"} {\n+\t\t\toption add *Menu.font uifont startupFile\n+\t\t}\n+\t} else {\n+\t\toption add *Menu.TearOff 0 startupFile\n+\t}\n+\toption add *Button.font uifont startupFile\n+\toption add *Checkbutton.font uifont startupFile\n+\toption add *Radiobutton.font uifont startupFile\n+\toption add *Menubutton.font uifont startupFile\n+\toption add *Label.font uifont startupFile\n+\toption add *Message.font uifont startupFile\n+\toption add *Entry.font textfont startupFile\n+\toption add *Text.font textfont startupFile\n+\toption add *Labelframe.font uifont startupFile\n+\toption add *Spinbox.font textfont startupFile\n+\toption add *Listbox.font mainfont startupFile\n }\n \n proc setttkstyle {} {\n-    eval font configure TkDefaultFont [fontflags mainfont]\n-    eval font configure TkTextFont [fontflags textfont]\n-    eval font configure TkHeadingFont [fontflags mainfont]\n-    eval font configure TkCaptionFont [fontflags mainfont] -weight bold\n-    eval font configure TkTooltipFont [fontflags uifont]\n-    eval font configure TkFixedFont   [fontflags textfont]\n-    eval font configure TkIconFont    [fontflags uifont]\n-    eval font configure TkMenuFont    [fontflags uifont]\n-    eval font configure TkSmallCaptionFont [fontflags uifont]\n+\teval font configure TkDefaultFont [fontflags mainfont]\n+\teval font configure TkTextFont [fontflags textfont]\n+\teval font configure TkHeadingFont [fontflags mainfont]\n+\teval font configure TkCaptionFont [fontflags mainfont] -weight bold\n+\teval font configure TkTooltipFont [fontflags uifont]\n+\teval font configure TkFixedFont   [fontflags textfont]\n+\teval font configure TkIconFont\t  [fontflags uifont]\n+\teval font configure TkMenuFont\t  [fontflags uifont]\n+\teval font configure TkSmallCaptionFont [fontflags uifont]\n }\n \n # Make a menu and submenus.\n@@ -1996,8235 +1996,8235 @@ proc setttkstyle {} {\n # description depends on type; it's the sublist for cascade, the\n # command to invoke for command, or {variable value} for radiobutton\n proc makemenu {m items} {\n-    menu $m\n-    if {[tk windowingsystem] eq {aqua}} {\n-\tset Meta1 Cmd\n-    } else {\n-\tset Meta1 Ctrl\n-    }\n-    foreach i $items {\n-\tset name [mc [lindex $i 1]]\n-\tset type [lindex $i 2]\n-\tset thing [lindex $i 3]\n-\tset params [list $type]\n-\tif {$name ne {}} {\n-\t    set u [string first \"&\" [string map {&& x} $name]]\n-\t    lappend params -label [string map {&& & & {}} $name]\n-\t    if {$u >= 0} {\n-\t\tlappend params -underline $u\n-\t    }\n+\tmenu $m\n+\tif {[tk windowingsystem] eq {aqua}} {\n+\t\tset Meta1 Cmd\n+\t} else {\n+\t\tset Meta1 Ctrl\n \t}\n-\tswitch -- $type {\n-\t    \"cascade\" {\n-\t\tset submenu [string tolower [string map {& \"\"} [lindex $i 1]]]\n-\t\tlappend params -menu $m.$submenu\n-\t    }\n-\t    \"command\" {\n-\t\tlappend params -command $thing\n-\t    }\n-\t    \"radiobutton\" {\n-\t\tlappend params -variable [lindex $thing 0] \\\n-\t\t    -value [lindex $thing 1]\n-\t    }\n+\tforeach i $items {\n+\t\tset name [mc [lindex $i 1]]\n+\t\tset type [lindex $i 2]\n+\t\tset thing [lindex $i 3]\n+\t\tset params [list $type]\n+\t\tif {$name ne {}} {\n+\t\t\tset u [string first \"&\" [string map {&& x} $name]]\n+\t\t\tlappend params -label [string map {&& & & {}} $name]\n+\t\t\tif {$u >= 0} {\n+\t\t\t\tlappend params -underline $u\n+\t\t\t}\n+\t\t}\n+\t\tswitch -- $type {\n+\t\t\t\"cascade\" {\n+\t\t\t\tset submenu [string tolower [string map {& \"\"} [lindex $i 1]]]\n+\t\t\t\tlappend params -menu $m.$submenu\n+\t\t\t}\n+\t\t\t\"command\" {\n+\t\t\t\tlappend params -command $thing\n+\t\t\t}\n+\t\t\t\"radiobutton\" {\n+\t\t\t\tlappend params -variable [lindex $thing 0] \\\n+\t\t\t\t\t-value [lindex $thing 1]\n+\t\t\t}\n+\t\t}\n+\t\tset tail [lrange $i 4 end]\n+\t\tregsub -all {\\yMeta1\\y} $tail $Meta1 tail\n+\t\teval $m add $params $tail\n+\t\tif {$type eq \"cascade\"} {\n+\t\t\tmakemenu $m.$submenu $thing\n+\t\t}\n \t}\n-\tset tail [lrange $i 4 end]\n-\tregsub -all {\\yMeta1\\y} $tail $Meta1 tail\n-\teval $m add $params $tail\n-\tif {$type eq \"cascade\"} {\n-\t    makemenu $m.$submenu $thing\n-\t}\n-    }\n }\n \n # translate string and remove ampersands\n proc mca {str} {\n-    return [string map {&& & & {}} [mc $str]]\n+\treturn [string map {&& & & {}} [mc $str]]\n }\n \n proc cleardropsel {w} {\n-    $w selection clear\n+\t$w selection clear\n }\n proc makedroplist {w varname args} {\n-    global use_ttk\n-    if {$use_ttk} {\n-        set width 0\n-        foreach label $args {\n-            set cx [string length $label]\n-            if {$cx > $width} {set width $cx}\n-        }\n-\tset gm [ttk::combobox $w -width $width -state readonly\\\n-\t\t    -textvariable $varname -values $args \\\n-\t\t    -exportselection false]\n-\tbind $gm <<ComboboxSelected>> [list $gm selection clear]\n-    } else {\n-\tset gm [eval [linsert $args 0 tk_optionMenu $w $varname]]\n-    }\n-    return $gm\n+\tglobal use_ttk\n+\tif {$use_ttk} {\n+\t\tset width 0\n+\t\tforeach label $args {\n+\t\t\tset cx [string length $label]\n+\t\t\tif {$cx > $width} {set width $cx}\n+\t\t}\n+\t\tset gm [ttk::combobox $w -width $width -state readonly\\\n+\t\t\t\t\t-textvariable $varname -values $args \\\n+\t\t\t\t\t-exportselection false]\n+\t\tbind $gm <<ComboboxSelected>> [list $gm selection clear]\n+\t} else {\n+\t\tset gm [eval [linsert $args 0 tk_optionMenu $w $varname]]\n+\t}\n+\treturn $gm\n }\n \n proc makewindow {} {\n-    global canv canv2 canv3 linespc charspc ctext cflist cscroll\n-    global tabstop\n-    global findtype findtypemenu findloc findstring fstring geometry\n-    global entries sha1entry sha1string sha1but\n-    global diffcontextstring diffcontext\n-    global ignorespace\n-    global maincursor textcursor curtextcursor\n-    global rowctxmenu fakerowmenu mergemax wrapcomment\n-    global highlight_files gdttype\n-    global searchstring sstring\n-    global bgcolor fgcolor bglist fglist diffcolors selectbgcolor\n-    global uifgcolor uifgdisabledcolor\n-    global filesepbgcolor filesepfgcolor\n-    global mergecolors foundbgcolor currentsearchhitbgcolor\n-    global headctxmenu progresscanv progressitem progresscoords statusw\n-    global fprogitem fprogcoord lastprogupdate progupdatepending\n-    global rprogitem rprogcoord rownumsel numcommits\n-    global have_tk85 use_ttk NS\n-    global git_version\n-    global worddiff\n+\tglobal canv canv2 canv3 linespc charspc ctext cflist cscroll\n+\tglobal tabstop\n+\tglobal findtype findtypemenu findloc findstring fstring geometry\n+\tglobal entries sha1entry sha1string sha1but\n+\tglobal diffcontextstring diffcontext\n+\tglobal ignorespace\n+\tglobal maincursor textcursor curtextcursor\n+\tglobal rowctxmenu fakerowmenu mergemax wrapcomment\n+\tglobal highlight_files gdttype\n+\tglobal searchstring sstring\n+\tglobal bgcolor fgcolor bglist fglist diffcolors selectbgcolor\n+\tglobal uifgcolor uifgdisabledcolor\n+\tglobal filesepbgcolor filesepfgcolor\n+\tglobal mergecolors foundbgcolor currentsearchhitbgcolor\n+\tglobal headctxmenu progresscanv progressitem progresscoords statusw\n+\tglobal fprogitem fprogcoord lastprogupdate progupdatepending\n+\tglobal rprogitem rprogcoord rownumsel numcommits\n+\tglobal have_tk85 use_ttk NS\n+\tglobal git_version\n+\tglobal worddiff\n \n-    # The \"mc\" arguments here are purely so that xgettext\n-    # sees the following string as needing to be translated\n-    set file {\n-\tmc \"&File\" cascade {\n-\t    {mc \"&Update\" command updatecommits -accelerator F5}\n-\t    {mc \"&Reload\" command reloadcommits -accelerator Shift-F5}\n-\t    {mc \"Reread re&ferences\" command rereadrefs}\n-\t    {mc \"&List references\" command showrefs -accelerator F2}\n-\t    {xx \"\" separator}\n-\t    {mc \"Start git &gui\" command {exec git gui &}}\n-\t    {xx \"\" separator}\n-\t    {mc \"&Quit\" command doquit -accelerator Meta1-Q}\n-\t}}\n-    set edit {\n-\tmc \"&Edit\" cascade {\n-\t    {mc \"&Preferences\" command doprefs}\n-\t}}\n-    set view {\n-\tmc \"&View\" cascade {\n-\t    {mc \"&New view...\" command {newview 0} -accelerator Shift-F4}\n-\t    {mc \"&Edit view...\" command editview -state disabled -accelerator F4}\n-\t    {mc \"&Delete view\" command delview -state disabled}\n-\t    {xx \"\" separator}\n-\t    {mc \"&All files\" radiobutton {selectedview 0} -command {showview 0}}\n-\t}}\n-    if {[tk windowingsystem] ne \"aqua\"} {\n-\tset help {\n-\tmc \"&Help\" cascade {\n-\t    {mc \"&About gitk\" command about}\n-\t    {mc \"&Key bindings\" command keys}\n-\t}}\n-\tset bar [list $file $edit $view $help]\n-    } else {\n-\tproc ::tk::mac::ShowPreferences {} {doprefs}\n-\tproc ::tk::mac::Quit {} {doquit}\n-\tlset file end [lreplace [lindex $file end] end-1 end]\n-\tset apple {\n-\txx \"&Apple\" cascade {\n-\t    {mc \"&About gitk\" command about}\n-\t    {xx \"\" separator}\n-\t}}\n-\tset help {\n-\tmc \"&Help\" cascade {\n-\t    {mc \"&Key bindings\" command keys}\n-\t}}\n-\tset bar [list $apple $file $view $help]\n-    }\n-    makemenu .bar $bar\n-    . configure -menu .bar\n-\n-    if {$use_ttk} {\n-        # cover the non-themed toplevel with a themed frame.\n-        place [ttk::frame ._main_background] -x 0 -y 0 -relwidth 1 -relheight 1\n-    }\n-\n-    # the gui has upper and lower half, parts of a paned window.\n-    ${NS}::panedwindow .ctop -orient vertical\n-\n-    # possibly use assumed geometry\n-    if {![info exists geometry(pwsash0)]} {\n-        set geometry(topheight) [expr {15 * $linespc}]\n-        set geometry(topwidth) [expr {80 * $charspc}]\n-        set geometry(botheight) [expr {15 * $linespc}]\n-        set geometry(botwidth) [expr {50 * $charspc}]\n-        set geometry(pwsash0) [list [expr {40 * $charspc}] 2]\n-        set geometry(pwsash1) [list [expr {60 * $charspc}] 2]\n-    }\n-\n-    # the upper half will have a paned window, a scroll bar to the right, and some stuff below\n-    ${NS}::frame .tf -height $geometry(topheight) -width $geometry(topwidth)\n-    ${NS}::frame .tf.histframe\n-    ${NS}::panedwindow .tf.histframe.pwclist -orient horizontal\n-    if {!$use_ttk} {\n-\t.tf.histframe.pwclist configure -sashpad 0 -handlesize 4\n-    }\n-\n-    # create three canvases\n-    set cscroll .tf.histframe.csb\n-    set canv .tf.histframe.pwclist.canv\n-    canvas $canv \\\n-\t-selectbackground $selectbgcolor \\\n-\t-background $bgcolor -bd 0 \\\n-\t-yscrollincr $linespc -yscrollcommand \"scrollcanv $cscroll\"\n-    .tf.histframe.pwclist add $canv\n-    set canv2 .tf.histframe.pwclist.canv2\n-    canvas $canv2 \\\n-\t-selectbackground $selectbgcolor \\\n-\t-background $bgcolor -bd 0 -yscrollincr $linespc\n-    .tf.histframe.pwclist add $canv2\n-    set canv3 .tf.histframe.pwclist.canv3\n-    canvas $canv3 \\\n-\t-selectbackground $selectbgcolor \\\n-\t-background $bgcolor -bd 0 -yscrollincr $linespc\n-    .tf.histframe.pwclist add $canv3\n-    if {$use_ttk} {\n-\tbind .tf.histframe.pwclist <Map> {\n-\t    bind %W <Map> {}\n-\t    .tf.histframe.pwclist sashpos 1 [lindex $::geometry(pwsash1) 0]\n-\t    .tf.histframe.pwclist sashpos 0 [lindex $::geometry(pwsash0) 0]\n+\t# The \"mc\" arguments here are purely so that xgettext\n+\t# sees the following string as needing to be translated\n+\tset file {\n+\t\tmc \"&File\" cascade {\n+\t\t\t{mc \"&Update\" command updatecommits -accelerator F5}\n+\t\t\t{mc \"&Reload\" command reloadcommits -accelerator Shift-F5}\n+\t\t\t{mc \"Reread re&ferences\" command rereadrefs}\n+\t\t\t{mc \"&List references\" command showrefs -accelerator F2}\n+\t\t\t{xx \"\" separator}\n+\t\t\t{mc \"Start git &gui\" command {exec git gui &}}\n+\t\t\t{xx \"\" separator}\n+\t\t\t{mc \"&Quit\" command doquit -accelerator Meta1-Q}\n+\t\t}}\n+\tset edit {\n+\t\tmc \"&Edit\" cascade {\n+\t\t\t{mc \"&Preferences\" command doprefs}\n+\t\t}}\n+\tset view {\n+\t\tmc \"&View\" cascade {\n+\t\t\t{mc \"&New view...\" command {newview 0} -accelerator Shift-F4}\n+\t\t\t{mc \"&Edit view...\" command editview -state disabled -accelerator F4}\n+\t\t\t{mc \"&Delete view\" command delview -state disabled}\n+\t\t\t{xx \"\" separator}\n+\t\t\t{mc \"&All files\" radiobutton {selectedview 0} -command {showview 0}}\n+\t\t}}\n+\tif {[tk windowingsystem] ne \"aqua\"} {\n+\t\tset help {\n+\t\tmc \"&Help\" cascade {\n+\t\t\t{mc \"&About gitk\" command about}\n+\t\t\t{mc \"&Key bindings\" command keys}\n+\t\t}}\n+\t\tset bar [list $file $edit $view $help]\n+\t} else {\n+\t\tproc ::tk::mac::ShowPreferences {} {doprefs}\n+\t\tproc ::tk::mac::Quit {} {doquit}\n+\t\tlset file end [lreplace [lindex $file end] end-1 end]\n+\t\tset apple {\n+\t\txx \"&Apple\" cascade {\n+\t\t\t{mc \"&About gitk\" command about}\n+\t\t\t{xx \"\" separator}\n+\t\t}}\n+\t\tset help {\n+\t\tmc \"&Help\" cascade {\n+\t\t\t{mc \"&Key bindings\" command keys}\n+\t\t}}\n+\t\tset bar [list $apple $file $view $help]\n \t}\n-    } else {\n-\teval .tf.histframe.pwclist sash place 0 $geometry(pwsash0)\n-\teval .tf.histframe.pwclist sash place 1 $geometry(pwsash1)\n-    }\n+\tmakemenu .bar $bar\n+\t. configure -menu .bar\n \n-    # a scroll bar to rule them\n-    ${NS}::scrollbar $cscroll -command {allcanvs yview}\n-    if {!$use_ttk} {$cscroll configure -highlightthickness 0}\n-    pack $cscroll -side right -fill y\n-    bind .tf.histframe.pwclist <Configure> {resizeclistpanes %W %w}\n-    lappend bglist $canv $canv2 $canv3\n-    pack .tf.histframe.pwclist -fill both -expand 1 -side left\n-\n-    # we have two button bars at bottom of top frame. Bar 1\n-    ${NS}::frame .tf.bar\n-    ${NS}::frame .tf.lbar -height 15\n-\n-    set sha1entry .tf.bar.sha1\n-    set entries $sha1entry\n-    set sha1but .tf.bar.sha1label\n-    button $sha1but -text \"[mc \"SHA1 ID:\"] \" -state disabled -relief flat \\\n-\t-command gotocommit -width 8\n-    $sha1but conf -disabledforeground [$sha1but cget -foreground]\n-    pack .tf.bar.sha1label -side left\n-    ${NS}::entry $sha1entry -width 40 -font textfont -textvariable sha1string\n-    trace add variable sha1string write sha1change\n-    pack $sha1entry -side left -pady 2\n-\n-    set bm_left_data {\n-\t#define left_width 16\n-\t#define left_height 16\n-\tstatic unsigned char left_bits[] = {\n-\t0x00, 0x00, 0xc0, 0x01, 0xe0, 0x00, 0x70, 0x00, 0x38, 0x00, 0x1c, 0x00,\n-\t0x0e, 0x00, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x0e, 0x00, 0x1c, 0x00,\n-\t0x38, 0x00, 0x70, 0x00, 0xe0, 0x00, 0xc0, 0x01};\n-    }\n-    set bm_right_data {\n-\t#define right_width 16\n-\t#define right_height 16\n-\tstatic unsigned char right_bits[] = {\n-\t0x00, 0x00, 0xc0, 0x01, 0x80, 0x03, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x1c,\n-\t0x00, 0x38, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x00, 0x38, 0x00, 0x1c,\n-\t0x00, 0x0e, 0x00, 0x07, 0x80, 0x03, 0xc0, 0x01};\n-    }\n-    image create bitmap bm-left -data $bm_left_data -foreground $uifgcolor\n-    image create bitmap bm-left-gray -data $bm_left_data -foreground $uifgdisabledcolor\n-    image create bitmap bm-right -data $bm_right_data -foreground $uifgcolor\n-    image create bitmap bm-right-gray -data $bm_right_data -foreground $uifgdisabledcolor\n-\n-    ${NS}::button .tf.bar.leftbut -command goback -state disabled -width 26\n-    if {$use_ttk} {\n-\t.tf.bar.leftbut configure -image [list bm-left disabled bm-left-gray]\n-    } else {\n-\t.tf.bar.leftbut configure -image bm-left\n-    }\n-    pack .tf.bar.leftbut -side left -fill y\n-    ${NS}::button .tf.bar.rightbut -command goforw -state disabled -width 26\n-    if {$use_ttk} {\n-\t.tf.bar.rightbut configure -image [list bm-right disabled bm-right-gray]\n-    } else {\n-\t.tf.bar.rightbut configure -image bm-right\n-    }\n-    pack .tf.bar.rightbut -side left -fill y\n-\n-    ${NS}::label .tf.bar.rowlabel -text [mc \"Row\"]\n-    set rownumsel {}\n-    ${NS}::label .tf.bar.rownum -width 7 -textvariable rownumsel \\\n-\t-relief sunken -anchor e\n-    ${NS}::label .tf.bar.rowlabel2 -text \"/\"\n-    ${NS}::label .tf.bar.numcommits -width 7 -textvariable numcommits \\\n-\t-relief sunken -anchor e\n-    pack .tf.bar.rowlabel .tf.bar.rownum .tf.bar.rowlabel2 .tf.bar.numcommits \\\n-\t-side left\n-    if {!$use_ttk} {\n-        foreach w {rownum numcommits} {.tf.bar.$w configure -font textfont}\n-    }\n-    global selectedline\n-    trace add variable selectedline write selectedline_change\n-\n-    # Status label and progress bar\n-    set statusw .tf.bar.status\n-    ${NS}::label $statusw -width 15 -relief sunken\n-    pack $statusw -side left -padx 5\n-    if {$use_ttk} {\n-\tset progresscanv [ttk::progressbar .tf.bar.progress]\n-    } else {\n-\tset h [expr {[font metrics uifont -linespace] + 2}]\n-\tset progresscanv .tf.bar.progress\n-\tcanvas $progresscanv -relief sunken -height $h -borderwidth 2\n-\tset progressitem [$progresscanv create rect -1 0 0 $h -fill \"#00ff00\"]\n-\tset fprogitem [$progresscanv create rect -1 0 0 $h -fill yellow]\n-\tset rprogitem [$progresscanv create rect -1 0 0 $h -fill red]\n-    }\n-    pack $progresscanv -side right -expand 1 -fill x -padx {0 2}\n-    set progresscoords {0 0}\n-    set fprogcoord 0\n-    set rprogcoord 0\n-    bind $progresscanv <Configure> adjustprogress\n-    set lastprogupdate [clock clicks -milliseconds]\n-    set progupdatepending 0\n-\n-    # build up the bottom bar of upper window\n-    ${NS}::label .tf.lbar.flabel -text \"[mc \"Find\"] \"\n-\n-    set bm_down_data {\n-\t#define down_width 16\n-\t#define down_height 16\n-\tstatic unsigned char down_bits[] = {\n-\t0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,\n-\t0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,\n-\t0x87, 0xe1, 0x8e, 0x71, 0x9c, 0x39, 0xb8, 0x1d,\n-\t0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01};\n-    }\n-    image create bitmap bm-down -data $bm_down_data -foreground $uifgcolor\n-    ${NS}::button .tf.lbar.fnext -width 26 -command {dofind 1 1}\n-    .tf.lbar.fnext configure -image bm-down\n-\n-    set bm_up_data {\n-\t#define up_width 16\n-\t#define up_height 16\n-\tstatic unsigned char up_bits[] = {\n-\t0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f,\n-\t0xb8, 0x1d, 0x9c, 0x39, 0x8e, 0x71, 0x87, 0xe1,\n-\t0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,\n-\t0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01};\n-    }\n-    image create bitmap bm-up -data $bm_up_data -foreground $uifgcolor\n-    ${NS}::button .tf.lbar.fprev -width 26 -command {dofind -1 1}\n-    .tf.lbar.fprev configure -image bm-up\n-\n-    ${NS}::label .tf.lbar.flab2 -text \" [mc \"commit\"] \"\n-\n-    pack .tf.lbar.flabel .tf.lbar.fnext .tf.lbar.fprev .tf.lbar.flab2 \\\n-\t-side left -fill y\n-    set gdttype [mc \"containing:\"]\n-    set gm [makedroplist .tf.lbar.gdttype gdttype \\\n-\t\t[mc \"containing:\"] \\\n-\t\t[mc \"touching paths:\"] \\\n-\t\t[mc \"adding/removing string:\"] \\\n-\t\t[mc \"changing lines matching:\"]]\n-    trace add variable gdttype write gdttype_change\n-    pack .tf.lbar.gdttype -side left -fill y\n-\n-    set findstring {}\n-    set fstring .tf.lbar.findstring\n-    lappend entries $fstring\n-    ${NS}::entry $fstring -width 30 -textvariable findstring\n-    trace add variable findstring write find_change\n-    set findtype [mc \"Exact\"]\n-    set findtypemenu [makedroplist .tf.lbar.findtype \\\n-\t\t\t  findtype [mc \"Exact\"] [mc \"IgnCase\"] [mc \"Regexp\"]]\n-    trace add variable findtype write findcom_change\n-    set findloc [mc \"All fields\"]\n-    makedroplist .tf.lbar.findloc findloc [mc \"All fields\"] [mc \"Headline\"] \\\n-\t[mc \"Comments\"] [mc \"Author\"] [mc \"Committer\"]\n-    trace add variable findloc write find_change\n-    pack .tf.lbar.findloc -side right\n-    pack .tf.lbar.findtype -side right\n-    pack $fstring -side left -expand 1 -fill x\n-\n-    # Finish putting the upper half of the viewer together\n-    pack .tf.lbar -in .tf -side bottom -fill x\n-    pack .tf.bar -in .tf -side bottom -fill x\n-    pack .tf.histframe -fill both -side top -expand 1\n-    .ctop add .tf\n-    if {!$use_ttk} {\n-\t.ctop paneconfigure .tf -height $geometry(topheight)\n-\t.ctop paneconfigure .tf -width $geometry(topwidth)\n-    }\n-\n-    # now build up the bottom\n-    ${NS}::panedwindow .pwbottom -orient horizontal\n-\n-    # lower left, a text box over search bar, scroll bar to the right\n-    # if we know window height, then that will set the lower text height, otherwise\n-    # we set lower text height which will drive window height\n-    if {[info exists geometry(main)]} {\n-\t${NS}::frame .bleft -width $geometry(botwidth)\n-    } else {\n-\t${NS}::frame .bleft -width $geometry(botwidth) -height $geometry(botheight)\n-    }\n-    ${NS}::frame .bleft.top\n-    ${NS}::frame .bleft.mid\n-    ${NS}::frame .bleft.bottom\n-\n-    # gap between sub-widgets\n-    set wgap [font measure uifont \"i\"]\n-\n-    ${NS}::button .bleft.top.search -text [mc \"Search\"] -command dosearch\n-    pack .bleft.top.search -side left -padx 5\n-    set sstring .bleft.top.sstring\n-    set searchstring \"\"\n-    ${NS}::entry $sstring -width 20 -textvariable searchstring\n-    lappend entries $sstring\n-    trace add variable searchstring write incrsearch\n-    pack $sstring -side left -expand 1 -fill x\n-    ${NS}::radiobutton .bleft.mid.diff -text [mc \"Diff\"] \\\n-\t-command changediffdisp -variable diffelide -value {0 0}\n-    ${NS}::radiobutton .bleft.mid.old -text [mc \"Old version\"] \\\n-\t-command changediffdisp -variable diffelide -value {0 1}\n-    ${NS}::radiobutton .bleft.mid.new -text [mc \"New version\"] \\\n-\t-command changediffdisp -variable diffelide -value {1 0}\n-\n-    ${NS}::label .bleft.mid.labeldiffcontext -text \"      [mc \"Lines of context\"]: \"\n-    pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left -ipadx $wgap\n-    spinbox .bleft.mid.diffcontext -width 5 \\\n-\t-from 0 -increment 1 -to 10000000 \\\n-\t-validate all -validatecommand \"diffcontextvalidate %P\" \\\n-\t-textvariable diffcontextstring\n-    .bleft.mid.diffcontext set $diffcontext\n-    trace add variable diffcontextstring write diffcontextchange\n-    lappend entries .bleft.mid.diffcontext\n-    pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left -ipadx $wgap\n-    ${NS}::checkbutton .bleft.mid.ignspace -text [mc \"Ignore space change\"] \\\n-\t-command changeignorespace -variable ignorespace\n-    pack .bleft.mid.ignspace -side left -padx 5\n-\n-    set worddiff [mc \"Line diff\"]\n-    if {[package vcompare $git_version \"1.7.2\"] >= 0} {\n-\tmakedroplist .bleft.mid.worddiff worddiff [mc \"Line diff\"] \\\n-\t    [mc \"Markup words\"] [mc \"Color words\"]\n-\ttrace add variable worddiff write changeworddiff\n-\tpack .bleft.mid.worddiff -side left -padx 5\n-    }\n-\n-    set ctext .bleft.bottom.ctext\n-    text $ctext -background $bgcolor -foreground $fgcolor \\\n-\t-state disabled -undo 0 -font textfont \\\n-\t-yscrollcommand scrolltext -wrap none \\\n-\t-xscrollcommand \".bleft.bottom.sbhorizontal set\"\n-    if {$have_tk85} {\n-\t$ctext conf -tabstyle wordprocessor\n-    }\n-    ${NS}::scrollbar .bleft.bottom.sb -command \"$ctext yview\"\n-    ${NS}::scrollbar .bleft.bottom.sbhorizontal -command \"$ctext xview\" -orient h\n-    pack .bleft.top -side top -fill x\n-    pack .bleft.mid -side top -fill x\n-    grid $ctext .bleft.bottom.sb -sticky nsew\n-    grid .bleft.bottom.sbhorizontal -sticky ew\n-    grid columnconfigure .bleft.bottom 0 -weight 1\n-    grid rowconfigure .bleft.bottom 0 -weight 1\n-    grid rowconfigure .bleft.bottom 1 -weight 0\n-    pack .bleft.bottom -side top -fill both -expand 1\n-    lappend bglist $ctext\n-    lappend fglist $ctext\n-\n-    $ctext tag conf comment -wrap $wrapcomment\n-    $ctext tag conf filesep -font textfontbold -fore $filesepfgcolor -back $filesepbgcolor\n-    $ctext tag conf hunksep -fore [lindex $diffcolors 2]\n-    $ctext tag conf d0 -fore [lindex $diffcolors 0]\n-    $ctext tag conf dresult -fore [lindex $diffcolors 1]\n-    $ctext tag conf m0 -fore [lindex $mergecolors 0]\n-    $ctext tag conf m1 -fore [lindex $mergecolors 1]\n-    $ctext tag conf m2 -fore [lindex $mergecolors 2]\n-    $ctext tag conf m3 -fore [lindex $mergecolors 3]\n-    $ctext tag conf m4 -fore [lindex $mergecolors 4]\n-    $ctext tag conf m5 -fore [lindex $mergecolors 5]\n-    $ctext tag conf m6 -fore [lindex $mergecolors 6]\n-    $ctext tag conf m7 -fore [lindex $mergecolors 7]\n-    $ctext tag conf m8 -fore [lindex $mergecolors 8]\n-    $ctext tag conf m9 -fore [lindex $mergecolors 9]\n-    $ctext tag conf m10 -fore [lindex $mergecolors 10]\n-    $ctext tag conf m11 -fore [lindex $mergecolors 11]\n-    $ctext tag conf m12 -fore [lindex $mergecolors 12]\n-    $ctext tag conf m13 -fore [lindex $mergecolors 13]\n-    $ctext tag conf m14 -fore [lindex $mergecolors 14]\n-    $ctext tag conf m15 -fore [lindex $mergecolors 15]\n-    $ctext tag conf mmax -fore darkgrey\n-    set mergemax 16\n-    $ctext tag conf mresult -font textfontbold\n-    $ctext tag conf msep -font textfontbold\n-    $ctext tag conf found -back $foundbgcolor\n-    $ctext tag conf currentsearchhit -back $currentsearchhitbgcolor\n-    $ctext tag conf wwrap -wrap word -lmargin2 1c\n-    $ctext tag conf bold -font textfontbold\n-\n-    .pwbottom add .bleft\n-    if {!$use_ttk} {\n-\t.pwbottom paneconfigure .bleft -width $geometry(botwidth)\n-    }\n-\n-    # lower right\n-    ${NS}::frame .bright\n-    ${NS}::frame .bright.mode\n-    ${NS}::radiobutton .bright.mode.patch -text [mc \"Patch\"] \\\n-\t-command reselectline -variable cmitmode -value \"patch\"\n-    ${NS}::radiobutton .bright.mode.tree -text [mc \"Tree\"] \\\n-\t-command reselectline -variable cmitmode -value \"tree\"\n-    grid .bright.mode.patch .bright.mode.tree -sticky ew\n-    pack .bright.mode -side top -fill x\n-    set cflist .bright.cfiles\n-    set indent [font measure mainfont \"nn\"]\n-    text $cflist \\\n-\t-selectbackground $selectbgcolor \\\n-\t-background $bgcolor -foreground $fgcolor \\\n-\t-font mainfont \\\n-\t-tabs [list $indent [expr {2 * $indent}]] \\\n-\t-yscrollcommand \".bright.sb set\" \\\n-\t-cursor [. cget -cursor] \\\n-\t-spacing1 1 -spacing3 1\n-    lappend bglist $cflist\n-    lappend fglist $cflist\n-    ${NS}::scrollbar .bright.sb -command \"$cflist yview\"\n-    pack .bright.sb -side right -fill y\n-    pack $cflist -side left -fill both -expand 1\n-    $cflist tag configure highlight \\\n-\t-background [$cflist cget -selectbackground]\n-    $cflist tag configure bold -font mainfontbold\n-\n-    .pwbottom add .bright\n-    .ctop add .pwbottom\n-\n-    # restore window width & height if known\n-    if {[info exists geometry(main)]} {\n-\tif {[scan $geometry(main) \"%dx%d\" w h] >= 2} {\n-\t    if {$w > [winfo screenwidth .]} {\n-\t\tset w [winfo screenwidth .]\n-\t    }\n-\t    if {$h > [winfo screenheight .]} {\n-\t\tset h [winfo screenheight .]\n-\t    }\n-\t    wm geometry . \"${w}x$h\"\n+\tif {$use_ttk} {\n+\t\t# cover the non-themed toplevel with a themed frame.\n+\t\tplace [ttk::frame ._main_background] -x 0 -y 0 -relwidth 1 -relheight 1\n \t}\n-    }\n \n-    if {[info exists geometry(state)] && $geometry(state) eq \"zoomed\"} {\n-        wm state . $geometry(state)\n-    }\n+\t# the gui has upper and lower half, parts of a paned window.\n+\t${NS}::panedwindow .ctop -orient vertical\n \n-    if {[tk windowingsystem] eq {aqua}} {\n-        set M1B M1\n-        set ::BM \"3\"\n-    } else {\n-        set M1B Control\n-        set ::BM \"2\"\n-    }\n-\n-    if {$use_ttk} {\n-        bind .ctop <Map> {\n-            bind %W <Map> {}\n-            %W sashpos 0 $::geometry(topheight)\n-        }\n-        bind .pwbottom <Map> {\n-            bind %W <Map> {}\n-            %W sashpos 0 $::geometry(botwidth)\n-        }\n-\tbind .pwbottom <Configure> {resizecdetpanes %W %w}\n-    }\n-\n-    pack .ctop -fill both -expand 1\n-    bindall <1> {selcanvline %W %x %y}\n-    #bindall <B1-Motion> {selcanvline %W %x %y}\n-    if {[tk windowingsystem] == \"win32\"} {\n-\tbind . <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D }\n-\tbind $ctext <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D ; break }\n-    } else {\n-\tbindall <ButtonRelease-4> \"allcanvs yview scroll -5 units\"\n-\tbindall <ButtonRelease-5> \"allcanvs yview scroll 5 units\"\n-\tbind $ctext <Button> {\n-\t    if {\"%b\" eq 6} {\n-\t\t$ctext xview scroll -5 units\n-\t    } elseif {\"%b\" eq 7} {\n-\t\t$ctext xview scroll 5 units\n-\t    }\n+\t# possibly use assumed geometry\n+\tif {![info exists geometry(pwsash0)]} {\n+\t\tset geometry(topheight) [expr {15 * $linespc}]\n+\t\tset geometry(topwidth) [expr {80 * $charspc}]\n+\t\tset geometry(botheight) [expr {15 * $linespc}]\n+\t\tset geometry(botwidth) [expr {50 * $charspc}]\n+\t\tset geometry(pwsash0) [list [expr {40 * $charspc}] 2]\n+\t\tset geometry(pwsash1) [list [expr {60 * $charspc}] 2]\n \t}\n-        if {[tk windowingsystem] eq \"aqua\"} {\n-            bindall <MouseWheel> {\n-                set delta [expr {- (%D)}]\n-                allcanvs yview scroll $delta units\n-            }\n-            bindall <Shift-MouseWheel> {\n-                set delta [expr {- (%D)}]\n-                $canv xview scroll $delta units\n-            }\n-        }\n-    }\n-    bindall <$::BM> \"canvscan mark %W %x %y\"\n-    bindall <B$::BM-Motion> \"canvscan dragto %W %x %y\"\n-    bind all <$M1B-Key-w> {destroy [winfo toplevel %W]}\n-    bind . <$M1B-Key-w> doquit\n-    bindkey <Home> selfirstline\n-    bindkey <End> sellastline\n-    bind . <Key-Up> \"selnextline -1\"\n-    bind . <Key-Down> \"selnextline 1\"\n-    bind . <Shift-Key-Up> \"dofind -1 0\"\n-    bind . <Shift-Key-Down> \"dofind 1 0\"\n-    bindkey <Key-Right> \"goforw\"\n-    bindkey <Key-Left> \"goback\"\n-    bind . <Key-Prior> \"selnextpage -1\"\n-    bind . <Key-Next> \"selnextpage 1\"\n-    bind . <$M1B-Home> \"allcanvs yview moveto 0.0\"\n-    bind . <$M1B-End> \"allcanvs yview moveto 1.0\"\n-    bind . <$M1B-Key-Up> \"allcanvs yview scroll -1 units\"\n-    bind . <$M1B-Key-Down> \"allcanvs yview scroll 1 units\"\n-    bind . <$M1B-Key-Prior> \"allcanvs yview scroll -1 pages\"\n-    bind . <$M1B-Key-Next> \"allcanvs yview scroll 1 pages\"\n-    bindkey <Key-Delete> \"$ctext yview scroll -1 pages\"\n-    bindkey <Key-BackSpace> \"$ctext yview scroll -1 pages\"\n-    bindkey <Key-space> \"$ctext yview scroll 1 pages\"\n-    bindkey p \"selnextline -1\"\n-    bindkey n \"selnextline 1\"\n-    bindkey z \"goback\"\n-    bindkey x \"goforw\"\n-    bindkey k \"selnextline -1\"\n-    bindkey j \"selnextline 1\"\n-    bindkey h \"goback\"\n-    bindkey l \"goforw\"\n-    bindkey b prevfile\n-    bindkey d \"$ctext yview scroll 18 units\"\n-    bindkey u \"$ctext yview scroll -18 units\"\n-    bindkey g {$sha1entry delete 0 end; focus $sha1entry}\n-    bindkey / {focus $fstring}\n-    bindkey <Key-KP_Divide> {focus $fstring}\n-    bindkey <Key-Return> {dofind 1 1}\n-    bindkey ? {dofind -1 1}\n-    bindkey f nextfile\n-    bind . <F5> updatecommits\n-    bindmodfunctionkey Shift 5 reloadcommits\n-    bind . <F2> showrefs\n-    bindmodfunctionkey Shift 4 {newview 0}\n-    bind . <F4> edit_or_newview\n-    bind . <$M1B-q> doquit\n-    bind . <$M1B-f> {dofind 1 1}\n-    bind . <$M1B-g> {dofind 1 0}\n-    bind . <$M1B-r> dosearchback\n-    bind . <$M1B-s> dosearch\n-    bind . <$M1B-equal> {incrfont 1}\n-    bind . <$M1B-plus> {incrfont 1}\n-    bind . <$M1B-KP_Add> {incrfont 1}\n-    bind . <$M1B-minus> {incrfont -1}\n-    bind . <$M1B-KP_Subtract> {incrfont -1}\n-    wm protocol . WM_DELETE_WINDOW doquit\n-    bind . <Destroy> {stop_backends}\n-    bind . <Button-1> \"click %W\"\n-    bind $fstring <Key-Return> {dofind 1 1}\n-    bind $sha1entry <Key-Return> {gotocommit; break}\n-    bind $sha1entry <<PasteSelection>> clearsha1\n-    bind $sha1entry <<Paste>> clearsha1\n-    bind $cflist <1> {sel_flist %W %x %y; break}\n-    bind $cflist <B1-Motion> {sel_flist %W %x %y; break}\n-    bind $cflist <ButtonRelease-1> {treeclick %W %x %y}\n-    global ctxbut\n-    bind $cflist $ctxbut {pop_flist_menu %W %X %Y %x %y}\n-    bind $ctext $ctxbut {pop_diff_menu %W %X %Y %x %y}\n-    bind $ctext <Button-1> {focus %W}\n-    bind $ctext <<Selection>> rehighlight_search_results\n-    for {set i 1} {$i < 10} {incr i} {\n-\tbind . <$M1B-Key-$i> [list go_to_parent $i]\n-    }\n \n-    set maincursor [. cget -cursor]\n-    set textcursor [$ctext cget -cursor]\n-    set curtextcursor $textcursor\n+\t# the upper half will have a paned window, a scroll bar to the right, and some stuff below\n+\t${NS}::frame .tf -height $geometry(topheight) -width $geometry(topwidth)\n+\t${NS}::frame .tf.histframe\n+\t${NS}::panedwindow .tf.histframe.pwclist -orient horizontal\n+\tif {!$use_ttk} {\n+\t\t.tf.histframe.pwclist configure -sashpad 0 -handlesize 4\n+\t}\n \n-    set rowctxmenu .rowctxmenu\n-    makemenu $rowctxmenu {\n-\t{mc \"Diff this -> selected\" command {diffvssel 0}}\n-\t{mc \"Diff selected -> this\" command {diffvssel 1}}\n-\t{mc \"Make patch\" command mkpatch}\n-\t{mc \"Create tag\" command mktag}\n-\t{mc \"Copy commit reference\" command copyreference}\n-\t{mc \"Write commit to file\" command writecommit}\n-\t{mc \"Create new branch\" command mkbranch}\n-\t{mc \"Cherry-pick this commit\" command cherrypick}\n-\t{mc \"Reset HEAD branch to here\" command resethead}\n-\t{mc \"Mark this commit\" command markhere}\n-\t{mc \"Return to mark\" command gotomark}\n-\t{mc \"Find descendant of this and mark\" command find_common_desc}\n-\t{mc \"Compare with marked commit\" command compare_commits}\n-\t{mc \"Diff this -> marked commit\" command {diffvsmark 0}}\n-\t{mc \"Diff marked commit -> this\" command {diffvsmark 1}}\n-\t{mc \"Revert this commit\" command revert}\n-    }\n-    $rowctxmenu configure -tearoff 0\n+\t# create three canvases\n+\tset cscroll .tf.histframe.csb\n+\tset canv .tf.histframe.pwclist.canv\n+\tcanvas $canv \\\n+\t\t-selectbackground $selectbgcolor \\\n+\t\t-background $bgcolor -bd 0 \\\n+\t\t-yscrollincr $linespc -yscrollcommand \"scrollcanv $cscroll\"\n+\t.tf.histframe.pwclist add $canv\n+\tset canv2 .tf.histframe.pwclist.canv2\n+\tcanvas $canv2 \\\n+\t\t-selectbackground $selectbgcolor \\\n+\t\t-background $bgcolor -bd 0 -yscrollincr $linespc\n+\t.tf.histframe.pwclist add $canv2\n+\tset canv3 .tf.histframe.pwclist.canv3\n+\tcanvas $canv3 \\\n+\t\t-selectbackground $selectbgcolor \\\n+\t\t-background $bgcolor -bd 0 -yscrollincr $linespc\n+\t.tf.histframe.pwclist add $canv3\n+\tif {$use_ttk} {\n+\t\tbind .tf.histframe.pwclist <Map> {\n+\t\t\tbind %W <Map> {}\n+\t\t\t.tf.histframe.pwclist sashpos 1 [lindex $::geometry(pwsash1) 0]\n+\t\t\t.tf.histframe.pwclist sashpos 0 [lindex $::geometry(pwsash0) 0]\n+\t\t}\n+\t} else {\n+\t\teval .tf.histframe.pwclist sash place 0 $geometry(pwsash0)\n+\t\teval .tf.histframe.pwclist sash place 1 $geometry(pwsash1)\n+\t}\n \n-    set fakerowmenu .fakerowmenu\n-    makemenu $fakerowmenu {\n-\t{mc \"Diff this -> selected\" command {diffvssel 0}}\n-\t{mc \"Diff selected -> this\" command {diffvssel 1}}\n-\t{mc \"Make patch\" command mkpatch}\n-\t{mc \"Diff this -> marked commit\" command {diffvsmark 0}}\n-\t{mc \"Diff marked commit -> this\" command {diffvsmark 1}}\n-    }\n-    $fakerowmenu configure -tearoff 0\n+\t# a scroll bar to rule them\n+\t${NS}::scrollbar $cscroll -command {allcanvs yview}\n+\tif {!$use_ttk} {$cscroll configure -highlightthickness 0}\n+\tpack $cscroll -side right -fill y\n+\tbind .tf.histframe.pwclist <Configure> {resizeclistpanes %W %w}\n+\tlappend bglist $canv $canv2 $canv3\n+\tpack .tf.histframe.pwclist -fill both -expand 1 -side left\n \n-    set headctxmenu .headctxmenu\n-    makemenu $headctxmenu {\n-\t{mc \"Check out this branch\" command cobranch}\n-\t{mc \"Rename this branch\" command mvbranch}\n-\t{mc \"Remove this branch\" command rmbranch}\n-\t{mc \"Copy branch name\" command {clipboard clear; clipboard append $headmenuhead}}\n-    }\n-    $headctxmenu configure -tearoff 0\n+\t# we have two button bars at bottom of top frame. Bar 1\n+\t${NS}::frame .tf.bar\n+\t${NS}::frame .tf.lbar -height 15\n \n-    global flist_menu\n-    set flist_menu .flistctxmenu\n-    makemenu $flist_menu {\n-\t{mc \"Highlight this too\" command {flist_hl 0}}\n-\t{mc \"Highlight this only\" command {flist_hl 1}}\n-\t{mc \"External diff\" command {external_diff}}\n-\t{mc \"Blame parent commit\" command {external_blame 1}}\n-\t{mc \"Copy path\" command {clipboard clear; clipboard append $flist_menu_file}}\n-    }\n-    $flist_menu configure -tearoff 0\n+\tset sha1entry .tf.bar.sha1\n+\tset entries $sha1entry\n+\tset sha1but .tf.bar.sha1label\n+\tbutton $sha1but -text \"[mc \"SHA1 ID:\"] \" -state disabled -relief flat \\\n+\t\t-command gotocommit -width 8\n+\t$sha1but conf -disabledforeground [$sha1but cget -foreground]\n+\tpack .tf.bar.sha1label -side left\n+\t${NS}::entry $sha1entry -width 40 -font textfont -textvariable sha1string\n+\ttrace add variable sha1string write sha1change\n+\tpack $sha1entry -side left -pady 2\n \n-    global diff_menu\n-    set diff_menu .diffctxmenu\n-    makemenu $diff_menu {\n-\t{mc \"Show origin of this line\" command show_line_source}\n-\t{mc \"Run git gui blame on this line\" command {external_blame_diff}}\n-    }\n-    $diff_menu configure -tearoff 0\n+\tset bm_left_data {\n+\t\t#define left_width 16\n+\t\t#define left_height 16\n+\t\tstatic unsigned char left_bits[] = {\n+\t\t0x00, 0x00, 0xc0, 0x01, 0xe0, 0x00, 0x70, 0x00, 0x38, 0x00, 0x1c, 0x00,\n+\t\t0x0e, 0x00, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x0e, 0x00, 0x1c, 0x00,\n+\t\t0x38, 0x00, 0x70, 0x00, 0xe0, 0x00, 0xc0, 0x01};\n+\t}\n+\tset bm_right_data {\n+\t\t#define right_width 16\n+\t\t#define right_height 16\n+\t\tstatic unsigned char right_bits[] = {\n+\t\t0x00, 0x00, 0xc0, 0x01, 0x80, 0x03, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x1c,\n+\t\t0x00, 0x38, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x00, 0x38, 0x00, 0x1c,\n+\t\t0x00, 0x0e, 0x00, 0x07, 0x80, 0x03, 0xc0, 0x01};\n+\t}\n+\timage create bitmap bm-left -data $bm_left_data -foreground $uifgcolor\n+\timage create bitmap bm-left-gray -data $bm_left_data -foreground $uifgdisabledcolor\n+\timage create bitmap bm-right -data $bm_right_data -foreground $uifgcolor\n+\timage create bitmap bm-right-gray -data $bm_right_data -foreground $uifgdisabledcolor\n+\n+\t${NS}::button .tf.bar.leftbut -command goback -state disabled -width 26\n+\tif {$use_ttk} {\n+\t\t.tf.bar.leftbut configure -image [list bm-left disabled bm-left-gray]\n+\t} else {\n+\t\t.tf.bar.leftbut configure -image bm-left\n+\t}\n+\tpack .tf.bar.leftbut -side left -fill y\n+\t${NS}::button .tf.bar.rightbut -command goforw -state disabled -width 26\n+\tif {$use_ttk} {\n+\t\t.tf.bar.rightbut configure -image [list bm-right disabled bm-right-gray]\n+\t} else {\n+\t\t.tf.bar.rightbut configure -image bm-right\n+\t}\n+\tpack .tf.bar.rightbut -side left -fill y\n+\n+\t${NS}::label .tf.bar.rowlabel -text [mc \"Row\"]\n+\tset rownumsel {}\n+\t${NS}::label .tf.bar.rownum -width 7 -textvariable rownumsel \\\n+\t\t-relief sunken -anchor e\n+\t${NS}::label .tf.bar.rowlabel2 -text \"/\"\n+\t${NS}::label .tf.bar.numcommits -width 7 -textvariable numcommits \\\n+\t\t-relief sunken -anchor e\n+\tpack .tf.bar.rowlabel .tf.bar.rownum .tf.bar.rowlabel2 .tf.bar.numcommits \\\n+\t\t-side left\n+\tif {!$use_ttk} {\n+\t\tforeach w {rownum numcommits} {.tf.bar.$w configure -font textfont}\n+\t}\n+\tglobal selectedline\n+\ttrace add variable selectedline write selectedline_change\n+\n+\t# Status label and progress bar\n+\tset statusw .tf.bar.status\n+\t${NS}::label $statusw -width 15 -relief sunken\n+\tpack $statusw -side left -padx 5\n+\tif {$use_ttk} {\n+\t\tset progresscanv [ttk::progressbar .tf.bar.progress]\n+\t} else {\n+\t\tset h [expr {[font metrics uifont -linespace] + 2}]\n+\t\tset progresscanv .tf.bar.progress\n+\t\tcanvas $progresscanv -relief sunken -height $h -borderwidth 2\n+\t\tset progressitem [$progresscanv create rect -1 0 0 $h -fill \"#00ff00\"]\n+\t\tset fprogitem [$progresscanv create rect -1 0 0 $h -fill yellow]\n+\t\tset rprogitem [$progresscanv create rect -1 0 0 $h -fill red]\n+\t}\n+\tpack $progresscanv -side right -expand 1 -fill x -padx {0 2}\n+\tset progresscoords {0 0}\n+\tset fprogcoord 0\n+\tset rprogcoord 0\n+\tbind $progresscanv <Configure> adjustprogress\n+\tset lastprogupdate [clock clicks -milliseconds]\n+\tset progupdatepending 0\n+\n+\t# build up the bottom bar of upper window\n+\t${NS}::label .tf.lbar.flabel -text \"[mc \"Find\"] \"\n+\n+\tset bm_down_data {\n+\t\t#define down_width 16\n+\t\t#define down_height 16\n+\t\tstatic unsigned char down_bits[] = {\n+\t\t0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,\n+\t\t0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,\n+\t\t0x87, 0xe1, 0x8e, 0x71, 0x9c, 0x39, 0xb8, 0x1d,\n+\t\t0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01};\n+\t}\n+\timage create bitmap bm-down -data $bm_down_data -foreground $uifgcolor\n+\t${NS}::button .tf.lbar.fnext -width 26 -command {dofind 1 1}\n+\t.tf.lbar.fnext configure -image bm-down\n+\n+\tset bm_up_data {\n+\t\t#define up_width 16\n+\t\t#define up_height 16\n+\t\tstatic unsigned char up_bits[] = {\n+\t\t0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f,\n+\t\t0xb8, 0x1d, 0x9c, 0x39, 0x8e, 0x71, 0x87, 0xe1,\n+\t\t0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,\n+\t\t0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01};\n+\t}\n+\timage create bitmap bm-up -data $bm_up_data -foreground $uifgcolor\n+\t${NS}::button .tf.lbar.fprev -width 26 -command {dofind -1 1}\n+\t.tf.lbar.fprev configure -image bm-up\n+\n+\t${NS}::label .tf.lbar.flab2 -text \" [mc \"commit\"] \"\n+\n+\tpack .tf.lbar.flabel .tf.lbar.fnext .tf.lbar.fprev .tf.lbar.flab2 \\\n+\t\t-side left -fill y\n+\tset gdttype [mc \"containing:\"]\n+\tset gm [makedroplist .tf.lbar.gdttype gdttype \\\n+\t\t\t\t[mc \"containing:\"] \\\n+\t\t\t\t[mc \"touching paths:\"] \\\n+\t\t\t\t[mc \"adding/removing string:\"] \\\n+\t\t\t\t[mc \"changing lines matching:\"]]\n+\ttrace add variable gdttype write gdttype_change\n+\tpack .tf.lbar.gdttype -side left -fill y\n+\n+\tset findstring {}\n+\tset fstring .tf.lbar.findstring\n+\tlappend entries $fstring\n+\t${NS}::entry $fstring -width 30 -textvariable findstring\n+\ttrace add variable findstring write find_change\n+\tset findtype [mc \"Exact\"]\n+\tset findtypemenu [makedroplist .tf.lbar.findtype \\\n+\t\t\t\t\t\t  findtype [mc \"Exact\"] [mc \"IgnCase\"] [mc \"Regexp\"]]\n+\ttrace add variable findtype write findcom_change\n+\tset findloc [mc \"All fields\"]\n+\tmakedroplist .tf.lbar.findloc findloc [mc \"All fields\"] [mc \"Headline\"] \\\n+\t\t[mc \"Comments\"] [mc \"Author\"] [mc \"Committer\"]\n+\ttrace add variable findloc write find_change\n+\tpack .tf.lbar.findloc -side right\n+\tpack .tf.lbar.findtype -side right\n+\tpack $fstring -side left -expand 1 -fill x\n+\n+\t# Finish putting the upper half of the viewer together\n+\tpack .tf.lbar -in .tf -side bottom -fill x\n+\tpack .tf.bar -in .tf -side bottom -fill x\n+\tpack .tf.histframe -fill both -side top -expand 1\n+\t.ctop add .tf\n+\tif {!$use_ttk} {\n+\t\t.ctop paneconfigure .tf -height $geometry(topheight)\n+\t\t.ctop paneconfigure .tf -width $geometry(topwidth)\n+\t}\n+\n+\t# now build up the bottom\n+\t${NS}::panedwindow .pwbottom -orient horizontal\n+\n+\t# lower left, a text box over search bar, scroll bar to the right\n+\t# if we know window height, then that will set the lower text height, otherwise\n+\t# we set lower text height which will drive window height\n+\tif {[info exists geometry(main)]} {\n+\t\t${NS}::frame .bleft -width $geometry(botwidth)\n+\t} else {\n+\t\t${NS}::frame .bleft -width $geometry(botwidth) -height $geometry(botheight)\n+\t}\n+\t${NS}::frame .bleft.top\n+\t${NS}::frame .bleft.mid\n+\t${NS}::frame .bleft.bottom\n+\n+\t# gap between sub-widgets\n+\tset wgap [font measure uifont \"i\"]\n+\n+\t${NS}::button .bleft.top.search -text [mc \"Search\"] -command dosearch\n+\tpack .bleft.top.search -side left -padx 5\n+\tset sstring .bleft.top.sstring\n+\tset searchstring \"\"\n+\t${NS}::entry $sstring -width 20 -textvariable searchstring\n+\tlappend entries $sstring\n+\ttrace add variable searchstring write incrsearch\n+\tpack $sstring -side left -expand 1 -fill x\n+\t${NS}::radiobutton .bleft.mid.diff -text [mc \"Diff\"] \\\n+\t\t-command changediffdisp -variable diffelide -value {0 0}\n+\t${NS}::radiobutton .bleft.mid.old -text [mc \"Old version\"] \\\n+\t\t-command changediffdisp -variable diffelide -value {0 1}\n+\t${NS}::radiobutton .bleft.mid.new -text [mc \"New version\"] \\\n+\t\t-command changediffdisp -variable diffelide -value {1 0}\n+\n+\t${NS}::label .bleft.mid.labeldiffcontext -text \"\t  [mc \"Lines of context\"]: \"\n+\tpack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left -ipadx $wgap\n+\tspinbox .bleft.mid.diffcontext -width 5 \\\n+\t\t-from 0 -increment 1 -to 10000000 \\\n+\t\t-validate all -validatecommand \"diffcontextvalidate %P\" \\\n+\t\t-textvariable diffcontextstring\n+\t.bleft.mid.diffcontext set $diffcontext\n+\ttrace add variable diffcontextstring write diffcontextchange\n+\tlappend entries .bleft.mid.diffcontext\n+\tpack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left -ipadx $wgap\n+\t${NS}::checkbutton .bleft.mid.ignspace -text [mc \"Ignore space change\"] \\\n+\t\t-command changeignorespace -variable ignorespace\n+\tpack .bleft.mid.ignspace -side left -padx 5\n+\n+\tset worddiff [mc \"Line diff\"]\n+\tif {[package vcompare $git_version \"1.7.2\"] >= 0} {\n+\t\tmakedroplist .bleft.mid.worddiff worddiff [mc \"Line diff\"] \\\n+\t\t\t[mc \"Markup words\"] [mc \"Color words\"]\n+\t\ttrace add variable worddiff write changeworddiff\n+\t\tpack .bleft.mid.worddiff -side left -padx 5\n+\t}\n+\n+\tset ctext .bleft.bottom.ctext\n+\ttext $ctext -background $bgcolor -foreground $fgcolor \\\n+\t\t-state disabled -undo 0 -font textfont \\\n+\t\t-yscrollcommand scrolltext -wrap none \\\n+\t\t-xscrollcommand \".bleft.bottom.sbhorizontal set\"\n+\tif {$have_tk85} {\n+\t\t$ctext conf -tabstyle wordprocessor\n+\t}\n+\t${NS}::scrollbar .bleft.bottom.sb -command \"$ctext yview\"\n+\t${NS}::scrollbar .bleft.bottom.sbhorizontal -command \"$ctext xview\" -orient h\n+\tpack .bleft.top -side top -fill x\n+\tpack .bleft.mid -side top -fill x\n+\tgrid $ctext .bleft.bottom.sb -sticky nsew\n+\tgrid .bleft.bottom.sbhorizontal -sticky ew\n+\tgrid columnconfigure .bleft.bottom 0 -weight 1\n+\tgrid rowconfigure .bleft.bottom 0 -weight 1\n+\tgrid rowconfigure .bleft.bottom 1 -weight 0\n+\tpack .bleft.bottom -side top -fill both -expand 1\n+\tlappend bglist $ctext\n+\tlappend fglist $ctext\n+\n+\t$ctext tag conf comment -wrap $wrapcomment\n+\t$ctext tag conf filesep -font textfontbold -fore $filesepfgcolor -back $filesepbgcolor\n+\t$ctext tag conf hunksep -fore [lindex $diffcolors 2]\n+\t$ctext tag conf d0 -fore [lindex $diffcolors 0]\n+\t$ctext tag conf dresult -fore [lindex $diffcolors 1]\n+\t$ctext tag conf m0 -fore [lindex $mergecolors 0]\n+\t$ctext tag conf m1 -fore [lindex $mergecolors 1]\n+\t$ctext tag conf m2 -fore [lindex $mergecolors 2]\n+\t$ctext tag conf m3 -fore [lindex $mergecolors 3]\n+\t$ctext tag conf m4 -fore [lindex $mergecolors 4]\n+\t$ctext tag conf m5 -fore [lindex $mergecolors 5]\n+\t$ctext tag conf m6 -fore [lindex $mergecolors 6]\n+\t$ctext tag conf m7 -fore [lindex $mergecolors 7]\n+\t$ctext tag conf m8 -fore [lindex $mergecolors 8]\n+\t$ctext tag conf m9 -fore [lindex $mergecolors 9]\n+\t$ctext tag conf m10 -fore [lindex $mergecolors 10]\n+\t$ctext tag conf m11 -fore [lindex $mergecolors 11]\n+\t$ctext tag conf m12 -fore [lindex $mergecolors 12]\n+\t$ctext tag conf m13 -fore [lindex $mergecolors 13]\n+\t$ctext tag conf m14 -fore [lindex $mergecolors 14]\n+\t$ctext tag conf m15 -fore [lindex $mergecolors 15]\n+\t$ctext tag conf mmax -fore darkgrey\n+\tset mergemax 16\n+\t$ctext tag conf mresult -font textfontbold\n+\t$ctext tag conf msep -font textfontbold\n+\t$ctext tag conf found -back $foundbgcolor\n+\t$ctext tag conf currentsearchhit -back $currentsearchhitbgcolor\n+\t$ctext tag conf wwrap -wrap word -lmargin2 1c\n+\t$ctext tag conf bold -font textfontbold\n+\n+\t.pwbottom add .bleft\n+\tif {!$use_ttk} {\n+\t\t.pwbottom paneconfigure .bleft -width $geometry(botwidth)\n+\t}\n+\n+\t# lower right\n+\t${NS}::frame .bright\n+\t${NS}::frame .bright.mode\n+\t${NS}::radiobutton .bright.mode.patch -text [mc \"Patch\"] \\\n+\t\t-command reselectline -variable cmitmode -value \"patch\"\n+\t${NS}::radiobutton .bright.mode.tree -text [mc \"Tree\"] \\\n+\t\t-command reselectline -variable cmitmode -value \"tree\"\n+\tgrid .bright.mode.patch .bright.mode.tree -sticky ew\n+\tpack .bright.mode -side top -fill x\n+\tset cflist .bright.cfiles\n+\tset indent [font measure mainfont \"nn\"]\n+\ttext $cflist \\\n+\t\t-selectbackground $selectbgcolor \\\n+\t\t-background $bgcolor -foreground $fgcolor \\\n+\t\t-font mainfont \\\n+\t\t-tabs [list $indent [expr {2 * $indent}]] \\\n+\t\t-yscrollcommand \".bright.sb set\" \\\n+\t\t-cursor [. cget -cursor] \\\n+\t\t-spacing1 1 -spacing3 1\n+\tlappend bglist $cflist\n+\tlappend fglist $cflist\n+\t${NS}::scrollbar .bright.sb -command \"$cflist yview\"\n+\tpack .bright.sb -side right -fill y\n+\tpack $cflist -side left -fill both -expand 1\n+\t$cflist tag configure highlight \\\n+\t\t-background [$cflist cget -selectbackground]\n+\t$cflist tag configure bold -font mainfontbold\n+\n+\t.pwbottom add .bright\n+\t.ctop add .pwbottom\n+\n+\t# restore window width & height if known\n+\tif {[info exists geometry(main)]} {\n+\t\tif {[scan $geometry(main) \"%dx%d\" w h] >= 2} {\n+\t\t\tif {$w > [winfo screenwidth .]} {\n+\t\t\t\tset w [winfo screenwidth .]\n+\t\t\t}\n+\t\t\tif {$h > [winfo screenheight .]} {\n+\t\t\t\tset h [winfo screenheight .]\n+\t\t\t}\n+\t\t\twm geometry . \"${w}x$h\"\n+\t\t}\n+\t}\n+\n+\tif {[info exists geometry(state)] && $geometry(state) eq \"zoomed\"} {\n+\t\twm state . $geometry(state)\n+\t}\n+\n+\tif {[tk windowingsystem] eq {aqua}} {\n+\t\tset M1B M1\n+\t\tset ::BM \"3\"\n+\t} else {\n+\t\tset M1B Control\n+\t\tset ::BM \"2\"\n+\t}\n+\n+\tif {$use_ttk} {\n+\t\tbind .ctop <Map> {\n+\t\t\tbind %W <Map> {}\n+\t\t\t%W sashpos 0 $::geometry(topheight)\n+\t\t}\n+\t\tbind .pwbottom <Map> {\n+\t\t\tbind %W <Map> {}\n+\t\t\t%W sashpos 0 $::geometry(botwidth)\n+\t\t}\n+\t\tbind .pwbottom <Configure> {resizecdetpanes %W %w}\n+\t}\n+\n+\tpack .ctop -fill both -expand 1\n+\tbindall <1> {selcanvline %W %x %y}\n+\t#bindall <B1-Motion> {selcanvline %W %x %y}\n+\tif {[tk windowingsystem] == \"win32\"} {\n+\t\tbind . <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D }\n+\t\tbind $ctext <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D ; break }\n+\t} else {\n+\t\tbindall <ButtonRelease-4> \"allcanvs yview scroll -5 units\"\n+\t\tbindall <ButtonRelease-5> \"allcanvs yview scroll 5 units\"\n+\t\tbind $ctext <Button> {\n+\t\t\tif {\"%b\" eq 6} {\n+\t\t\t\t$ctext xview scroll -5 units\n+\t\t\t} elseif {\"%b\" eq 7} {\n+\t\t\t\t$ctext xview scroll 5 units\n+\t\t\t}\n+\t\t}\n+\t\tif {[tk windowingsystem] eq \"aqua\"} {\n+\t\t\tbindall <MouseWheel> {\n+\t\t\t\tset delta [expr {- (%D)}]\n+\t\t\t\tallcanvs yview scroll $delta units\n+\t\t\t}\n+\t\t\tbindall <Shift-MouseWheel> {\n+\t\t\t\tset delta [expr {- (%D)}]\n+\t\t\t\t$canv xview scroll $delta units\n+\t\t\t}\n+\t\t}\n+\t}\n+\tbindall <$::BM> \"canvscan mark %W %x %y\"\n+\tbindall <B$::BM-Motion> \"canvscan dragto %W %x %y\"\n+\tbind all <$M1B-Key-w> {destroy [winfo toplevel %W]}\n+\tbind . <$M1B-Key-w> doquit\n+\tbindkey <Home> selfirstline\n+\tbindkey <End> sellastline\n+\tbind . <Key-Up> \"selnextline -1\"\n+\tbind . <Key-Down> \"selnextline 1\"\n+\tbind . <Shift-Key-Up> \"dofind -1 0\"\n+\tbind . <Shift-Key-Down> \"dofind 1 0\"\n+\tbindkey <Key-Right> \"goforw\"\n+\tbindkey <Key-Left> \"goback\"\n+\tbind . <Key-Prior> \"selnextpage -1\"\n+\tbind . <Key-Next> \"selnextpage 1\"\n+\tbind . <$M1B-Home> \"allcanvs yview moveto 0.0\"\n+\tbind . <$M1B-End> \"allcanvs yview moveto 1.0\"\n+\tbind . <$M1B-Key-Up> \"allcanvs yview scroll -1 units\"\n+\tbind . <$M1B-Key-Down> \"allcanvs yview scroll 1 units\"\n+\tbind . <$M1B-Key-Prior> \"allcanvs yview scroll -1 pages\"\n+\tbind . <$M1B-Key-Next> \"allcanvs yview scroll 1 pages\"\n+\tbindkey <Key-Delete> \"$ctext yview scroll -1 pages\"\n+\tbindkey <Key-BackSpace> \"$ctext yview scroll -1 pages\"\n+\tbindkey <Key-space> \"$ctext yview scroll 1 pages\"\n+\tbindkey p \"selnextline -1\"\n+\tbindkey n \"selnextline 1\"\n+\tbindkey z \"goback\"\n+\tbindkey x \"goforw\"\n+\tbindkey k \"selnextline -1\"\n+\tbindkey j \"selnextline 1\"\n+\tbindkey h \"goback\"\n+\tbindkey l \"goforw\"\n+\tbindkey b prevfile\n+\tbindkey d \"$ctext yview scroll 18 units\"\n+\tbindkey u \"$ctext yview scroll -18 units\"\n+\tbindkey g {$sha1entry delete 0 end; focus $sha1entry}\n+\tbindkey / {focus $fstring}\n+\tbindkey <Key-KP_Divide> {focus $fstring}\n+\tbindkey <Key-Return> {dofind 1 1}\n+\tbindkey ? {dofind -1 1}\n+\tbindkey f nextfile\n+\tbind . <F5> updatecommits\n+\tbindmodfunctionkey Shift 5 reloadcommits\n+\tbind . <F2> showrefs\n+\tbindmodfunctionkey Shift 4 {newview 0}\n+\tbind . <F4> edit_or_newview\n+\tbind . <$M1B-q> doquit\n+\tbind . <$M1B-f> {dofind 1 1}\n+\tbind . <$M1B-g> {dofind 1 0}\n+\tbind . <$M1B-r> dosearchback\n+\tbind . <$M1B-s> dosearch\n+\tbind . <$M1B-equal> {incrfont 1}\n+\tbind . <$M1B-plus> {incrfont 1}\n+\tbind . <$M1B-KP_Add> {incrfont 1}\n+\tbind . <$M1B-minus> {incrfont -1}\n+\tbind . <$M1B-KP_Subtract> {incrfont -1}\n+\twm protocol . WM_DELETE_WINDOW doquit\n+\tbind . <Destroy> {stop_backends}\n+\tbind . <Button-1> \"click %W\"\n+\tbind $fstring <Key-Return> {dofind 1 1}\n+\tbind $sha1entry <Key-Return> {gotocommit; break}\n+\tbind $sha1entry <<PasteSelection>> clearsha1\n+\tbind $sha1entry <<Paste>> clearsha1\n+\tbind $cflist <1> {sel_flist %W %x %y; break}\n+\tbind $cflist <B1-Motion> {sel_flist %W %x %y; break}\n+\tbind $cflist <ButtonRelease-1> {treeclick %W %x %y}\n+\tglobal ctxbut\n+\tbind $cflist $ctxbut {pop_flist_menu %W %X %Y %x %y}\n+\tbind $ctext $ctxbut {pop_diff_menu %W %X %Y %x %y}\n+\tbind $ctext <Button-1> {focus %W}\n+\tbind $ctext <<Selection>> rehighlight_search_results\n+\tfor {set i 1} {$i < 10} {incr i} {\n+\t\tbind . <$M1B-Key-$i> [list go_to_parent $i]\n+\t}\n+\n+\tset maincursor [. cget -cursor]\n+\tset textcursor [$ctext cget -cursor]\n+\tset curtextcursor $textcursor\n+\n+\tset rowctxmenu .rowctxmenu\n+\tmakemenu $rowctxmenu {\n+\t\t{mc \"Diff this -> selected\" command {diffvssel 0}}\n+\t\t{mc \"Diff selected -> this\" command {diffvssel 1}}\n+\t\t{mc \"Make patch\" command mkpatch}\n+\t\t{mc \"Create tag\" command mktag}\n+\t\t{mc \"Copy commit reference\" command copyreference}\n+\t\t{mc \"Write commit to file\" command writecommit}\n+\t\t{mc \"Create new branch\" command mkbranch}\n+\t\t{mc \"Cherry-pick this commit\" command cherrypick}\n+\t\t{mc \"Reset HEAD branch to here\" command resethead}\n+\t\t{mc \"Mark this commit\" command markhere}\n+\t\t{mc \"Return to mark\" command gotomark}\n+\t\t{mc \"Find descendant of this and mark\" command find_common_desc}\n+\t\t{mc \"Compare with marked commit\" command compare_commits}\n+\t\t{mc \"Diff this -> marked commit\" command {diffvsmark 0}}\n+\t\t{mc \"Diff marked commit -> this\" command {diffvsmark 1}}\n+\t\t{mc \"Revert this commit\" command revert}\n+\t}\n+\t$rowctxmenu configure -tearoff 0\n+\n+\tset fakerowmenu .fakerowmenu\n+\tmakemenu $fakerowmenu {\n+\t\t{mc \"Diff this -> selected\" command {diffvssel 0}}\n+\t\t{mc \"Diff selected -> this\" command {diffvssel 1}}\n+\t\t{mc \"Make patch\" command mkpatch}\n+\t\t{mc \"Diff this -> marked commit\" command {diffvsmark 0}}\n+\t\t{mc \"Diff marked commit -> this\" command {diffvsmark 1}}\n+\t}\n+\t$fakerowmenu configure -tearoff 0\n+\n+\tset headctxmenu .headctxmenu\n+\tmakemenu $headctxmenu {\n+\t\t{mc \"Check out this branch\" command cobranch}\n+\t\t{mc \"Rename this branch\" command mvbranch}\n+\t\t{mc \"Remove this branch\" command rmbranch}\n+\t\t{mc \"Copy branch name\" command {clipboard clear; clipboard append $headmenuhead}}\n+\t}\n+\t$headctxmenu configure -tearoff 0\n+\n+\tglobal flist_menu\n+\tset flist_menu .flistctxmenu\n+\tmakemenu $flist_menu {\n+\t\t{mc \"Highlight this too\" command {flist_hl 0}}\n+\t\t{mc \"Highlight this only\" command {flist_hl 1}}\n+\t\t{mc \"External diff\" command {external_diff}}\n+\t\t{mc \"Blame parent commit\" command {external_blame 1}}\n+\t\t{mc \"Copy path\" command {clipboard clear; clipboard append $flist_menu_file}}\n+\t}\n+\t$flist_menu configure -tearoff 0\n+\n+\tglobal diff_menu\n+\tset diff_menu .diffctxmenu\n+\tmakemenu $diff_menu {\n+\t\t{mc \"Show origin of this line\" command show_line_source}\n+\t\t{mc \"Run git gui blame on this line\" command {external_blame_diff}}\n+\t}\n+\t$diff_menu configure -tearoff 0\n }\n \n # Windows sends all mouse wheel events to the current focused window, not\n # the one where the mouse hovers, so bind those events here and redirect\n # to the correct window\n proc windows_mousewheel_redirector {W X Y D} {\n-    global canv canv2 canv3\n-    set w [winfo containing -displayof $W $X $Y]\n-    if {$w ne \"\"} {\n-\tset u [expr {$D < 0 ? 5 : -5}]\n-\tif {$w == $canv || $w == $canv2 || $w == $canv3} {\n-\t    allcanvs yview scroll $u units\n-\t} else {\n-\t    catch {\n-\t\t$w yview scroll $u units\n-\t    }\n+\tglobal canv canv2 canv3\n+\tset w [winfo containing -displayof $W $X $Y]\n+\tif {$w ne \"\"} {\n+\t\tset u [expr {$D < 0 ? 5 : -5}]\n+\t\tif {$w == $canv || $w == $canv2 || $w == $canv3} {\n+\t\t\tallcanvs yview scroll $u units\n+\t\t} else {\n+\t\t\tcatch {\n+\t\t\t\t$w yview scroll $u units\n+\t\t\t}\n+\t\t}\n \t}\n-    }\n }\n \n # Update row number label when selectedline changes\n proc selectedline_change {n1 n2 op} {\n-    global selectedline rownumsel\n+\tglobal selectedline rownumsel\n \n-    if {$selectedline eq {}} {\n-\tset rownumsel {}\n-    } else {\n-\tset rownumsel [expr {$selectedline + 1}]\n-    }\n+\tif {$selectedline eq {}} {\n+\t\tset rownumsel {}\n+\t} else {\n+\t\tset rownumsel [expr {$selectedline + 1}]\n+\t}\n }\n \n # mouse-2 makes all windows scan vertically, but only the one\n # the cursor is in scans horizontally\n proc canvscan {op w x y} {\n-    global canv canv2 canv3\n-    foreach c [list $canv $canv2 $canv3] {\n-\tif {$c == $w} {\n-\t    $c scan $op $x $y\n-\t} else {\n-\t    $c scan $op 0 $y\n+\tglobal canv canv2 canv3\n+\tforeach c [list $canv $canv2 $canv3] {\n+\t\tif {$c == $w} {\n+\t\t\t$c scan $op $x $y\n+\t\t} else {\n+\t\t\t$c scan $op 0 $y\n+\t\t}\n \t}\n-    }\n }\n \n proc scrollcanv {cscroll f0 f1} {\n-    $cscroll set $f0 $f1\n-    drawvisible\n-    flushhighlights\n+\t$cscroll set $f0 $f1\n+\tdrawvisible\n+\tflushhighlights\n }\n \n # when we make a key binding for the toplevel, make sure\n # it doesn't get triggered when that key is pressed in the\n # find string entry widget.\n proc bindkey {ev script} {\n-    global entries\n-    bind . $ev $script\n-    set escript [bind Entry $ev]\n-    if {$escript == {}} {\n-\tset escript [bind Entry <Key>]\n-    }\n-    foreach e $entries {\n-\tbind $e $ev \"$escript; break\"\n-    }\n+\tglobal entries\n+\tbind . $ev $script\n+\tset escript [bind Entry $ev]\n+\tif {$escript == {}} {\n+\t\tset escript [bind Entry <Key>]\n+\t}\n+\tforeach e $entries {\n+\t\tbind $e $ev \"$escript; break\"\n+\t}\n }\n \n proc bindmodfunctionkey {mod n script} {\n-    bind . <$mod-F$n> $script\n-    catch { bind . <$mod-XF86_Switch_VT_$n> $script }\n+\tbind . <$mod-F$n> $script\n+\tcatch { bind . <$mod-XF86_Switch_VT_$n> $script }\n }\n \n # set the focus back to the toplevel for any click outside\n # the entry widgets\n proc click {w} {\n-    global ctext entries\n-    foreach e [concat $entries $ctext] {\n-\tif {$w == $e} return\n-    }\n-    focus .\n+\tglobal ctext entries\n+\tforeach e [concat $entries $ctext] {\n+\t\tif {$w == $e} return\n+\t}\n+\tfocus .\n }\n \n # Adjust the progress bar for a change in requested extent or canvas size\n proc adjustprogress {} {\n-    global progresscanv progressitem progresscoords\n-    global fprogitem fprogcoord lastprogupdate progupdatepending\n-    global rprogitem rprogcoord use_ttk\n+\tglobal progresscanv progressitem progresscoords\n+\tglobal fprogitem fprogcoord lastprogupdate progupdatepending\n+\tglobal rprogitem rprogcoord use_ttk\n \n-    if {$use_ttk} {\n-\t$progresscanv configure -value [expr {int($fprogcoord * 100)}]\n-\treturn\n-    }\n+\tif {$use_ttk} {\n+\t\t$progresscanv configure -value [expr {int($fprogcoord * 100)}]\n+\t\treturn\n+\t}\n \n-    set w [expr {[winfo width $progresscanv] - 4}]\n-    set x0 [expr {$w * [lindex $progresscoords 0]}]\n-    set x1 [expr {$w * [lindex $progresscoords 1]}]\n-    set h [winfo height $progresscanv]\n-    $progresscanv coords $progressitem $x0 0 $x1 $h\n-    $progresscanv coords $fprogitem 0 0 [expr {$w * $fprogcoord}] $h\n-    $progresscanv coords $rprogitem 0 0 [expr {$w * $rprogcoord}] $h\n-    set now [clock clicks -milliseconds]\n-    if {$now >= $lastprogupdate + 100} {\n-\tset progupdatepending 0\n-\tupdate\n-    } elseif {!$progupdatepending} {\n-\tset progupdatepending 1\n-\tafter [expr {$lastprogupdate + 100 - $now}] doprogupdate\n-    }\n+\tset w [expr {[winfo width $progresscanv] - 4}]\n+\tset x0 [expr {$w * [lindex $progresscoords 0]}]\n+\tset x1 [expr {$w * [lindex $progresscoords 1]}]\n+\tset h [winfo height $progresscanv]\n+\t$progresscanv coords $progressitem $x0 0 $x1 $h\n+\t$progresscanv coords $fprogitem 0 0 [expr {$w * $fprogcoord}] $h\n+\t$progresscanv coords $rprogitem 0 0 [expr {$w * $rprogcoord}] $h\n+\tset now [clock clicks -milliseconds]\n+\tif {$now >= $lastprogupdate + 100} {\n+\t\tset progupdatepending 0\n+\t\tupdate\n+\t} elseif {!$progupdatepending} {\n+\t\tset progupdatepending 1\n+\t\tafter [expr {$lastprogupdate + 100 - $now}] doprogupdate\n+\t}\n }\n \n proc doprogupdate {} {\n-    global lastprogupdate progupdatepending\n+\tglobal lastprogupdate progupdatepending\n \n-    if {$progupdatepending} {\n-\tset progupdatepending 0\n-\tset lastprogupdate [clock clicks -milliseconds]\n-\tupdate\n-    }\n+\tif {$progupdatepending} {\n+\t\tset progupdatepending 0\n+\t\tset lastprogupdate [clock clicks -milliseconds]\n+\t\tupdate\n+\t}\n }\n \n proc config_check_tmp_exists {tries_left} {\n-    global config_file_tmp\n+\tglobal config_file_tmp\n \n-    if {[file exists $config_file_tmp]} {\n-\tincr tries_left -1\n-\tif {$tries_left > 0} {\n-\t    after 100 [list config_check_tmp_exists $tries_left]\n-\t} else {\n-\t    error_popup \"There appears to be a stale $config_file_tmp\\\n+\tif {[file exists $config_file_tmp]} {\n+\t\tincr tries_left -1\n+\t\tif {$tries_left > 0} {\n+\t\t\tafter 100 [list config_check_tmp_exists $tries_left]\n+\t\t} else {\n+\t\t\terror_popup \"There appears to be a stale $config_file_tmp\\\n  file, which will prevent gitk from saving its configuration on exit.\\\n  Please remove it if it is not being used by any existing gitk process.\"\n+\t\t}\n \t}\n-    }\n }\n \n proc config_init_trace {name} {\n-    global config_variable_changed config_variable_original\n+\tglobal config_variable_changed config_variable_original\n \n-    upvar #0 $name var\n-    set config_variable_changed($name) 0\n-    set config_variable_original($name) $var\n+\tupvar #0 $name var\n+\tset config_variable_changed($name) 0\n+\tset config_variable_original($name) $var\n }\n \n proc config_variable_change_cb {name name2 op} {\n-    global config_variable_changed config_variable_original\n+\tglobal config_variable_changed config_variable_original\n \n-    upvar #0 $name var\n-    if {$op eq \"write\" &&\n-\t(![info exists config_variable_original($name)] ||\n-\t $config_variable_original($name) ne $var)} {\n-\tset config_variable_changed($name) 1\n-    }\n+\tupvar #0 $name var\n+\tif {$op eq \"write\" &&\n+\t\t(![info exists config_variable_original($name)] ||\n+\t\t $config_variable_original($name) ne $var)} {\n+\t\tset config_variable_changed($name) 1\n+\t}\n }\n \n proc savestuff {w} {\n-    global stuffsaved\n-    global config_file config_file_tmp\n-    global config_variables config_variable_changed\n-    global viewchanged\n+\tglobal stuffsaved\n+\tglobal config_file config_file_tmp\n+\tglobal config_variables config_variable_changed\n+\tglobal viewchanged\n \n-    upvar #0 viewname current_viewname\n-    upvar #0 viewfiles current_viewfiles\n-    upvar #0 viewargs current_viewargs\n-    upvar #0 viewargscmd current_viewargscmd\n-    upvar #0 viewperm current_viewperm\n-    upvar #0 nextviewnum current_nextviewnum\n-    upvar #0 use_ttk current_use_ttk\n+\tupvar #0 viewname current_viewname\n+\tupvar #0 viewfiles current_viewfiles\n+\tupvar #0 viewargs current_viewargs\n+\tupvar #0 viewargscmd current_viewargscmd\n+\tupvar #0 viewperm current_viewperm\n+\tupvar #0 nextviewnum current_nextviewnum\n+\tupvar #0 use_ttk current_use_ttk\n \n-    if {$stuffsaved} return\n-    if {![winfo viewable .]} return\n-    set remove_tmp 0\n-    if {[catch {\n-\tset try_count 0\n-\twhile {[catch {set f [open $config_file_tmp {WRONLY CREAT EXCL}]}]} {\n-\t    if {[incr try_count] > 50} {\n-\t\terror \"Unable to write config file: $config_file_tmp exists\"\n-\t    }\n-\t    after 100\n-\t}\n-\tset remove_tmp 1\n-\tif {$::tcl_platform(platform) eq {windows}} {\n-\t    file attributes $config_file_tmp -hidden true\n-\t}\n-\tif {[file exists $config_file]} {\n-\t    source $config_file\n-\t}\n-\tforeach var_name $config_variables {\n-\t    upvar #0 $var_name var\n-\t    upvar 0 $var_name old_var\n-\t    if {!$config_variable_changed($var_name) && [info exists old_var]} {\n-\t\tputs $f [list set $var_name $old_var]\n-\t    } else {\n-\t\tputs $f [list set $var_name $var]\n-\t    }\n-\t}\n-\n-\tputs $f \"set geometry(main) [wm geometry .]\"\n-\tputs $f \"set geometry(state) [wm state .]\"\n-\tputs $f \"set geometry(topwidth) [winfo width .tf]\"\n-\tputs $f \"set geometry(topheight) [winfo height .tf]\"\n-\tif {$current_use_ttk} {\n-\t    puts $f \"set geometry(pwsash0) \\\"[.tf.histframe.pwclist sashpos 0] 1\\\"\"\n-\t    puts $f \"set geometry(pwsash1) \\\"[.tf.histframe.pwclist sashpos 1] 1\\\"\"\n-\t} else {\n-\t    puts $f \"set geometry(pwsash0) \\\"[.tf.histframe.pwclist sash coord 0]\\\"\"\n-\t    puts $f \"set geometry(pwsash1) \\\"[.tf.histframe.pwclist sash coord 1]\\\"\"\n-\t}\n-\tputs $f \"set geometry(botwidth) [winfo width .bleft]\"\n-\tputs $f \"set geometry(botheight) [winfo height .bleft]\"\n-\n-\tarray set view_save {}\n-\tarray set views {}\n-\tif {![info exists permviews]} { set permviews {} }\n-\tforeach view $permviews {\n-\t    set view_save([lindex $view 0]) 1\n-\t    set views([lindex $view 0]) $view\n-\t}\n-\tputs -nonewline $f \"set permviews {\"\n-\tfor {set v 1} {$v < $current_nextviewnum} {incr v} {\n-\t    if {$viewchanged($v)} {\n-\t\tif {$current_viewperm($v)} {\n-\t\t    set views($current_viewname($v)) [list $current_viewname($v) $current_viewfiles($v) $current_viewargs($v) $current_viewargscmd($v)]\n-\t\t} else {\n-\t\t    set view_save($current_viewname($v)) 0\n-\t\t}\n-\t    }\n-\t}\n-\t# write old and updated view to their places and append remaining to the end\n-\tforeach view $permviews {\n-\t    set view_name [lindex $view 0]\n-\t    if {$view_save($view_name)} {\n-\t\tputs $f \"{$views($view_name)}\"\n-\t    }\n-\t    unset views($view_name)\n-\t}\n-\tforeach view_name [array names views] {\n-\t    puts $f \"{$views($view_name)}\"\n-\t}\n-\tputs $f \"}\"\n-\tclose $f\n-\tfile rename -force $config_file_tmp $config_file\n+\tif {$stuffsaved} return\n+\tif {![winfo viewable .]} return\n \tset remove_tmp 0\n-    } err]} {\n-        puts \"Error saving config: $err\"\n-    }\n-    if {$remove_tmp} {\n-\tfile delete -force $config_file_tmp\n-    }\n-    set stuffsaved 1\n+\tif {[catch {\n+\t\tset try_count 0\n+\t\twhile {[catch {set f [open $config_file_tmp {WRONLY CREAT EXCL}]}]} {\n+\t\t\tif {[incr try_count] > 50} {\n+\t\t\t\terror \"Unable to write config file: $config_file_tmp exists\"\n+\t\t\t}\n+\t\t\tafter 100\n+\t\t}\n+\t\tset remove_tmp 1\n+\t\tif {$::tcl_platform(platform) eq {windows}} {\n+\t\t\tfile attributes $config_file_tmp -hidden true\n+\t\t}\n+\t\tif {[file exists $config_file]} {\n+\t\t\tsource $config_file\n+\t\t}\n+\t\tforeach var_name $config_variables {\n+\t\t\tupvar #0 $var_name var\n+\t\t\tupvar 0 $var_name old_var\n+\t\t\tif {!$config_variable_changed($var_name) && [info exists old_var]} {\n+\t\t\t\tputs $f [list set $var_name $old_var]\n+\t\t\t} else {\n+\t\t\t\tputs $f [list set $var_name $var]\n+\t\t\t}\n+\t\t}\n+\n+\t\tputs $f \"set geometry(main) [wm geometry .]\"\n+\t\tputs $f \"set geometry(state) [wm state .]\"\n+\t\tputs $f \"set geometry(topwidth) [winfo width .tf]\"\n+\t\tputs $f \"set geometry(topheight) [winfo height .tf]\"\n+\t\tif {$current_use_ttk} {\n+\t\t\tputs $f \"set geometry(pwsash0) \\\"[.tf.histframe.pwclist sashpos 0] 1\\\"\"\n+\t\t\tputs $f \"set geometry(pwsash1) \\\"[.tf.histframe.pwclist sashpos 1] 1\\\"\"\n+\t\t} else {\n+\t\t\tputs $f \"set geometry(pwsash0) \\\"[.tf.histframe.pwclist sash coord 0]\\\"\"\n+\t\t\tputs $f \"set geometry(pwsash1) \\\"[.tf.histframe.pwclist sash coord 1]\\\"\"\n+\t\t}\n+\t\tputs $f \"set geometry(botwidth) [winfo width .bleft]\"\n+\t\tputs $f \"set geometry(botheight) [winfo height .bleft]\"\n+\n+\t\tarray set view_save {}\n+\t\tarray set views {}\n+\t\tif {![info exists permviews]} { set permviews {} }\n+\t\tforeach view $permviews {\n+\t\t\tset view_save([lindex $view 0]) 1\n+\t\t\tset views([lindex $view 0]) $view\n+\t\t}\n+\t\tputs -nonewline $f \"set permviews {\"\n+\t\tfor {set v 1} {$v < $current_nextviewnum} {incr v} {\n+\t\t\tif {$viewchanged($v)} {\n+\t\t\t\tif {$current_viewperm($v)} {\n+\t\t\t\t\tset views($current_viewname($v)) [list $current_viewname($v) $current_viewfiles($v) $current_viewargs($v) $current_viewargscmd($v)]\n+\t\t\t\t} else {\n+\t\t\t\t\tset view_save($current_viewname($v)) 0\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\t\t# write old and updated view to their places and append remaining to the end\n+\t\tforeach view $permviews {\n+\t\t\tset view_name [lindex $view 0]\n+\t\t\tif {$view_save($view_name)} {\n+\t\t\t\tputs $f \"{$views($view_name)}\"\n+\t\t\t}\n+\t\t\tunset views($view_name)\n+\t\t}\n+\t\tforeach view_name [array names views] {\n+\t\t\tputs $f \"{$views($view_name)}\"\n+\t\t}\n+\t\tputs $f \"}\"\n+\t\tclose $f\n+\t\tfile rename -force $config_file_tmp $config_file\n+\t\tset remove_tmp 0\n+\t} err]} {\n+\t\tputs \"Error saving config: $err\"\n+\t}\n+\tif {$remove_tmp} {\n+\t\tfile delete -force $config_file_tmp\n+\t}\n+\tset stuffsaved 1\n }\n \n proc resizeclistpanes {win w} {\n-    global oldwidth use_ttk\n-    if {[info exists oldwidth($win)]} {\n-\tif {$use_ttk} {\n-\t    set s0 [$win sashpos 0]\n-\t    set s1 [$win sashpos 1]\n-\t} else {\n-\t    set s0 [$win sash coord 0]\n-\t    set s1 [$win sash coord 1]\n-\t}\n-\tif {$w < 60} {\n-\t    set sash0 [expr {int($w/2 - 2)}]\n-\t    set sash1 [expr {int($w*5/6 - 2)}]\n-\t} else {\n-\t    set factor [expr {1.0 * $w / $oldwidth($win)}]\n-\t    set sash0 [expr {int($factor * [lindex $s0 0])}]\n-\t    set sash1 [expr {int($factor * [lindex $s1 0])}]\n-\t    if {$sash0 < 30} {\n-\t\tset sash0 30\n-\t    }\n-\t    if {$sash1 < $sash0 + 20} {\n-\t\tset sash1 [expr {$sash0 + 20}]\n-\t    }\n-\t    if {$sash1 > $w - 10} {\n-\t\tset sash1 [expr {$w - 10}]\n-\t\tif {$sash0 > $sash1 - 20} {\n-\t\t    set sash0 [expr {$sash1 - 20}]\n+\tglobal oldwidth use_ttk\n+\tif {[info exists oldwidth($win)]} {\n+\t\tif {$use_ttk} {\n+\t\t\tset s0 [$win sashpos 0]\n+\t\t\tset s1 [$win sashpos 1]\n+\t\t} else {\n+\t\t\tset s0 [$win sash coord 0]\n+\t\t\tset s1 [$win sash coord 1]\n+\t\t}\n+\t\tif {$w < 60} {\n+\t\t\tset sash0 [expr {int($w/2 - 2)}]\n+\t\t\tset sash1 [expr {int($w*5/6 - 2)}]\n+\t\t} else {\n+\t\t\tset factor [expr {1.0 * $w / $oldwidth($win)}]\n+\t\t\tset sash0 [expr {int($factor * [lindex $s0 0])}]\n+\t\t\tset sash1 [expr {int($factor * [lindex $s1 0])}]\n+\t\t\tif {$sash0 < 30} {\n+\t\t\t\tset sash0 30\n+\t\t\t}\n+\t\t\tif {$sash1 < $sash0 + 20} {\n+\t\t\t\tset sash1 [expr {$sash0 + 20}]\n+\t\t\t}\n+\t\t\tif {$sash1 > $w - 10} {\n+\t\t\t\tset sash1 [expr {$w - 10}]\n+\t\t\t\tif {$sash0 > $sash1 - 20} {\n+\t\t\t\t\tset sash0 [expr {$sash1 - 20}]\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\t\tif {$use_ttk} {\n+\t\t\t$win sashpos 0 $sash0\n+\t\t\t$win sashpos 1 $sash1\n+\t\t} else {\n+\t\t\t$win sash place 0 $sash0 [lindex $s0 1]\n+\t\t\t$win sash place 1 $sash1 [lindex $s1 1]\n \t\t}\n-\t    }\n \t}\n-\tif {$use_ttk} {\n-\t    $win sashpos 0 $sash0\n-\t    $win sashpos 1 $sash1\n-\t} else {\n-\t    $win sash place 0 $sash0 [lindex $s0 1]\n-\t    $win sash place 1 $sash1 [lindex $s1 1]\n-\t}\n-    }\n-    set oldwidth($win) $w\n+\tset oldwidth($win) $w\n }\n \n proc resizecdetpanes {win w} {\n-    global oldwidth use_ttk\n-    if {[info exists oldwidth($win)]} {\n-\tif {$use_ttk} {\n-\t    set s0 [$win sashpos 0]\n-\t} else {\n-\t    set s0 [$win sash coord 0]\n+\tglobal oldwidth use_ttk\n+\tif {[info exists oldwidth($win)]} {\n+\t\tif {$use_ttk} {\n+\t\t\tset s0 [$win sashpos 0]\n+\t\t} else {\n+\t\t\tset s0 [$win sash coord 0]\n+\t\t}\n+\t\tif {$w < 60} {\n+\t\t\tset sash0 [expr {int($w*3/4 - 2)}]\n+\t\t} else {\n+\t\t\tset factor [expr {1.0 * $w / $oldwidth($win)}]\n+\t\t\tset sash0 [expr {int($factor * [lindex $s0 0])}]\n+\t\t\tif {$sash0 < 45} {\n+\t\t\t\tset sash0 45\n+\t\t\t}\n+\t\t\tif {$sash0 > $w - 15} {\n+\t\t\t\tset sash0 [expr {$w - 15}]\n+\t\t\t}\n+\t\t}\n+\t\tif {$use_ttk} {\n+\t\t\t$win sashpos 0 $sash0\n+\t\t} else {\n+\t\t\t$win sash place 0 $sash0 [lindex $s0 1]\n+\t\t}\n \t}\n-\tif {$w < 60} {\n-\t    set sash0 [expr {int($w*3/4 - 2)}]\n-\t} else {\n-\t    set factor [expr {1.0 * $w / $oldwidth($win)}]\n-\t    set sash0 [expr {int($factor * [lindex $s0 0])}]\n-\t    if {$sash0 < 45} {\n-\t\tset sash0 45\n-\t    }\n-\t    if {$sash0 > $w - 15} {\n-\t\tset sash0 [expr {$w - 15}]\n-\t    }\n-\t}\n-\tif {$use_ttk} {\n-\t    $win sashpos 0 $sash0\n-\t} else {\n-\t    $win sash place 0 $sash0 [lindex $s0 1]\n-\t}\n-    }\n-    set oldwidth($win) $w\n+\tset oldwidth($win) $w\n }\n \n proc allcanvs args {\n-    global canv canv2 canv3\n-    eval $canv $args\n-    eval $canv2 $args\n-    eval $canv3 $args\n+\tglobal canv canv2 canv3\n+\teval $canv $args\n+\teval $canv2 $args\n+\teval $canv3 $args\n }\n \n proc bindall {event action} {\n-    global canv canv2 canv3\n-    bind $canv $event $action\n-    bind $canv2 $event $action\n-    bind $canv3 $event $action\n+\tglobal canv canv2 canv3\n+\tbind $canv $event $action\n+\tbind $canv2 $event $action\n+\tbind $canv3 $event $action\n }\n \n proc about {} {\n-    global bgcolor NS\n-    set w .about\n-    if {[winfo exists $w]} {\n-\traise $w\n-\treturn\n-    }\n-    ttk_toplevel $w\n-    wm title $w [mc \"About gitk\"]\n-    make_transient $w .\n-    message $w.m -text [mc \"\n+\tglobal bgcolor NS\n+\tset w .about\n+\tif {[winfo exists $w]} {\n+\t\traise $w\n+\t\treturn\n+\t}\n+\tttk_toplevel $w\n+\twm title $w [mc \"About gitk\"]\n+\tmake_transient $w .\n+\tmessage $w.m -text [mc \"\n Gitk - a commit viewer for git\n \n Copyright \\u00a9 2005-2016 Paul Mackerras\n \n Use and redistribute under the terms of the GNU General Public License\"] \\\n-\t    -justify center -aspect 400 -border 2 -bg $bgcolor -relief groove\n-    pack $w.m -side top -fill x -padx 2 -pady 2\n-    ${NS}::button $w.ok -text [mc \"Close\"] -command \"destroy $w\" -default active\n-    pack $w.ok -side bottom\n-    bind $w <Visibility> \"focus $w.ok\"\n-    bind $w <Key-Escape> \"destroy $w\"\n-    bind $w <Key-Return> \"destroy $w\"\n-    tk::PlaceWindow $w widget .\n+\t\t\t-justify center -aspect 400 -border 2 -bg $bgcolor -relief groove\n+\tpack $w.m -side top -fill x -padx 2 -pady 2\n+\t${NS}::button $w.ok -text [mc \"Close\"] -command \"destroy $w\" -default active\n+\tpack $w.ok -side bottom\n+\tbind $w <Visibility> \"focus $w.ok\"\n+\tbind $w <Key-Escape> \"destroy $w\"\n+\tbind $w <Key-Return> \"destroy $w\"\n+\ttk::PlaceWindow $w widget .\n }\n \n proc keys {} {\n-    global bgcolor NS\n-    set w .keys\n-    if {[winfo exists $w]} {\n-\traise $w\n-\treturn\n-    }\n-    if {[tk windowingsystem] eq {aqua}} {\n-\tset M1T Cmd\n-    } else {\n-\tset M1T Ctrl\n-    }\n-    ttk_toplevel $w\n-    wm title $w [mc \"Gitk key bindings\"]\n-    make_transient $w .\n-    message $w.m -text \"\n+\tglobal bgcolor NS\n+\tset w .keys\n+\tif {[winfo exists $w]} {\n+\t\traise $w\n+\t\treturn\n+\t}\n+\tif {[tk windowingsystem] eq {aqua}} {\n+\t\tset M1T Cmd\n+\t} else {\n+\t\tset M1T Ctrl\n+\t}\n+\tttk_toplevel $w\n+\twm title $w [mc \"Gitk key bindings\"]\n+\tmake_transient $w .\n+\tmessage $w.m -text \"\n [mc \"Gitk key bindings:\"]\n \n-[mc \"<%s-Q>\t\tQuit\" $M1T]\n-[mc \"<%s-W>\t\tClose window\" $M1T]\n-[mc \"<Home>\t\tMove to first commit\"]\n-[mc \"<End>\t\tMove to last commit\"]\n-[mc \"<Up>, p, k\tMove up one commit\"]\n-[mc \"<Down>, n, j\tMove down one commit\"]\n-[mc \"<Left>, z, h\tGo back in history list\"]\n-[mc \"<Right>, x, l\tGo forward in history list\"]\n-[mc \"<%s-n>\tGo to n-th parent of current commit in history list\" $M1T]\n+[mc \"<%s-Q>\t\t\t\tQuit\" $M1T]\n+[mc \"<%s-W>\t\t\t\tClose window\" $M1T]\n+[mc \"<Home>\t\t\t\tMove to first commit\"]\n+[mc \"<End>\t\t\t\tMove to last commit\"]\n+[mc \"<Up>, p, k Move up one commit\"]\n+[mc \"<Down>, n, j\t\tMove down one commit\"]\n+[mc \"<Left>, z, h\t\tGo back in history list\"]\n+[mc \"<Right>, x, l\t\tGo forward in history list\"]\n+[mc \"<%s-n>\t\tGo to n-th parent of current commit in history list\" $M1T]\n [mc \"<PageUp>\tMove up one page in commit list\"]\n-[mc \"<PageDown>\tMove down one page in commit list\"]\n+[mc \"<PageDown> Move down one page in commit list\"]\n [mc \"<%s-Home>\tScroll to top of commit list\" $M1T]\n [mc \"<%s-End>\tScroll to bottom of commit list\" $M1T]\n [mc \"<%s-Up>\tScroll commit list up one line\" $M1T]\n [mc \"<%s-Down>\tScroll commit list down one line\" $M1T]\n-[mc \"<%s-PageUp>\tScroll commit list up one page\" $M1T]\n-[mc \"<%s-PageDown>\tScroll commit list down one page\" $M1T]\n-[mc \"<Shift-Up>\tFind backwards (upwards, later commits)\"]\n-[mc \"<Shift-Down>\tFind forwards (downwards, earlier commits)\"]\n-[mc \"<Delete>, b\tScroll diff view up one page\"]\n-[mc \"<Backspace>\tScroll diff view up one page\"]\n-[mc \"<Space>\t\tScroll diff view down one page\"]\n-[mc \"u\t\tScroll diff view up 18 lines\"]\n-[mc \"d\t\tScroll diff view down 18 lines\"]\n-[mc \"<%s-F>\t\tFind\" $M1T]\n-[mc \"<%s-G>\t\tMove to next find hit\" $M1T]\n+[mc \"<%s-PageUp>\t\tScroll commit list up one page\" $M1T]\n+[mc \"<%s-PageDown>\t\tScroll commit list down one page\" $M1T]\n+[mc \"<Shift-Up> Find backwards (upwards, later commits)\"]\n+[mc \"<Shift-Down>\t\tFind forwards (downwards, earlier commits)\"]\n+[mc \"<Delete>, b\t\tScroll diff view up one page\"]\n+[mc \"<Backspace>\t\tScroll diff view up one page\"]\n+[mc \"<Space>\t\t\tScroll diff view down one page\"]\n+[mc \"u\t\t\tScroll diff view up 18 lines\"]\n+[mc \"d\t\t\tScroll diff view down 18 lines\"]\n+[mc \"<%s-F>\t\t\t\tFind\" $M1T]\n+[mc \"<%s-G>\t\t\t\tMove to next find hit\" $M1T]\n [mc \"<Return>\tMove to next find hit\"]\n-[mc \"g\t\tGo to commit\"]\n-[mc \"/\t\tFocus the search box\"]\n-[mc \"?\t\tMove to previous find hit\"]\n-[mc \"f\t\tScroll diff view to next file\"]\n-[mc \"<%s-S>\t\tSearch for next hit in diff view\" $M1T]\n-[mc \"<%s-R>\t\tSearch for previous hit in diff view\" $M1T]\n+[mc \"g\t\t\tGo to commit\"]\n+[mc \"/\t\t\tFocus the search box\"]\n+[mc \"?\t\t\tMove to previous find hit\"]\n+[mc \"f\t\t\tScroll diff view to next file\"]\n+[mc \"<%s-S>\t\t\t\tSearch for next hit in diff view\" $M1T]\n+[mc \"<%s-R>\t\t\t\tSearch for previous hit in diff view\" $M1T]\n [mc \"<%s-KP+>\tIncrease font size\" $M1T]\n [mc \"<%s-plus>\tIncrease font size\" $M1T]\n [mc \"<%s-KP->\tDecrease font size\" $M1T]\n-[mc \"<%s-minus>\tDecrease font size\" $M1T]\n-[mc \"<F5>\t\tUpdate\"]\n+[mc \"<%s-minus> Decrease font size\" $M1T]\n+[mc \"<F5>\t\t\t\tUpdate\"]\n \" \\\n-\t    -justify left -bg $bgcolor -border 2 -relief groove\n-    pack $w.m -side top -fill both -padx 2 -pady 2\n-    ${NS}::button $w.ok -text [mc \"Close\"] -command \"destroy $w\" -default active\n-    bind $w <Key-Escape> [list destroy $w]\n-    pack $w.ok -side bottom\n-    bind $w <Visibility> \"focus $w.ok\"\n-    bind $w <Key-Escape> \"destroy $w\"\n-    bind $w <Key-Return> \"destroy $w\"\n+\t\t\t-justify left -bg $bgcolor -border 2 -relief groove\n+\tpack $w.m -side top -fill both -padx 2 -pady 2\n+\t${NS}::button $w.ok -text [mc \"Close\"] -command \"destroy $w\" -default active\n+\tbind $w <Key-Escape> [list destroy $w]\n+\tpack $w.ok -side bottom\n+\tbind $w <Visibility> \"focus $w.ok\"\n+\tbind $w <Key-Escape> \"destroy $w\"\n+\tbind $w <Key-Return> \"destroy $w\"\n }\n \n # Procedures for manipulating the file list window at the\n # bottom right of the overall window.\n \n proc treeview {w l openlevs} {\n-    global treecontents treediropen treeheight treeparent treeindex\n+\tglobal treecontents treediropen treeheight treeparent treeindex\n \n-    set ix 0\n-    set treeindex() 0\n-    set lev 0\n-    set prefix {}\n-    set prefixend -1\n-    set prefendstack {}\n-    set htstack {}\n-    set ht 0\n-    set treecontents() {}\n-    $w conf -state normal\n-    foreach f $l {\n-\twhile {[string range $f 0 $prefixend] ne $prefix} {\n-\t    if {$lev <= $openlevs} {\n-\t\t$w mark set e:$treeindex($prefix) \"end -1c\"\n-\t\t$w mark gravity e:$treeindex($prefix) left\n-\t    }\n-\t    set treeheight($prefix) $ht\n-\t    incr ht [lindex $htstack end]\n-\t    set htstack [lreplace $htstack end end]\n-\t    set prefixend [lindex $prefendstack end]\n-\t    set prefendstack [lreplace $prefendstack end end]\n-\t    set prefix [string range $prefix 0 $prefixend]\n-\t    incr lev -1\n+\tset ix 0\n+\tset treeindex() 0\n+\tset lev 0\n+\tset prefix {}\n+\tset prefixend -1\n+\tset prefendstack {}\n+\tset htstack {}\n+\tset ht 0\n+\tset treecontents() {}\n+\t$w conf -state normal\n+\tforeach f $l {\n+\t\twhile {[string range $f 0 $prefixend] ne $prefix} {\n+\t\t\tif {$lev <= $openlevs} {\n+\t\t\t\t$w mark set e:$treeindex($prefix) \"end -1c\"\n+\t\t\t\t$w mark gravity e:$treeindex($prefix) left\n+\t\t\t}\n+\t\t\tset treeheight($prefix) $ht\n+\t\t\tincr ht [lindex $htstack end]\n+\t\t\tset htstack [lreplace $htstack end end]\n+\t\t\tset prefixend [lindex $prefendstack end]\n+\t\t\tset prefendstack [lreplace $prefendstack end end]\n+\t\t\tset prefix [string range $prefix 0 $prefixend]\n+\t\t\tincr lev -1\n+\t\t}\n+\t\tset tail [string range $f [expr {$prefixend+1}] end]\n+\t\twhile {[set slash [string first \"/\" $tail]] >= 0} {\n+\t\t\tlappend htstack $ht\n+\t\t\tset ht 0\n+\t\t\tlappend prefendstack $prefixend\n+\t\t\tincr prefixend [expr {$slash + 1}]\n+\t\t\tset d [string range $tail 0 $slash]\n+\t\t\tlappend treecontents($prefix) $d\n+\t\t\tset oldprefix $prefix\n+\t\t\tappend prefix $d\n+\t\t\tset treecontents($prefix) {}\n+\t\t\tset treeindex($prefix) [incr ix]\n+\t\t\tset treeparent($prefix) $oldprefix\n+\t\t\tset tail [string range $tail [expr {$slash+1}] end]\n+\t\t\tif {$lev <= $openlevs} {\n+\t\t\t\tset ht 1\n+\t\t\t\tset treediropen($prefix) [expr {$lev < $openlevs}]\n+\t\t\t\tset bm [expr {$lev == $openlevs? \"tri-rt\": \"tri-dn\"}]\n+\t\t\t\t$w mark set d:$ix \"end -1c\"\n+\t\t\t\t$w mark gravity d:$ix left\n+\t\t\t\tset str \"\\n\"\n+\t\t\t\tfor {set i 0} {$i < $lev} {incr i} {append str \"\\t\"}\n+\t\t\t\t$w insert end $str\n+\t\t\t\t$w image create end -align center -image $bm -padx 1 \\\n+\t\t\t\t\t-name a:$ix\n+\t\t\t\t$w insert end $d [highlight_tag $prefix]\n+\t\t\t\t$w mark set s:$ix \"end -1c\"\n+\t\t\t\t$w mark gravity s:$ix left\n+\t\t\t}\n+\t\t\tincr lev\n+\t\t}\n+\t\tif {$tail ne {}} {\n+\t\t\tif {$lev <= $openlevs} {\n+\t\t\t\tincr ht\n+\t\t\t\tset str \"\\n\"\n+\t\t\t\tfor {set i 0} {$i < $lev} {incr i} {append str \"\\t\"}\n+\t\t\t\t$w insert end $str\n+\t\t\t\t$w insert end $tail [highlight_tag $f]\n+\t\t\t}\n+\t\t\tlappend treecontents($prefix) $tail\n+\t\t}\n \t}\n-\tset tail [string range $f [expr {$prefixend+1}] end]\n-\twhile {[set slash [string first \"/\" $tail]] >= 0} {\n-\t    lappend htstack $ht\n-\t    set ht 0\n-\t    lappend prefendstack $prefixend\n-\t    incr prefixend [expr {$slash + 1}]\n-\t    set d [string range $tail 0 $slash]\n-\t    lappend treecontents($prefix) $d\n-\t    set oldprefix $prefix\n-\t    append prefix $d\n-\t    set treecontents($prefix) {}\n-\t    set treeindex($prefix) [incr ix]\n-\t    set treeparent($prefix) $oldprefix\n-\t    set tail [string range $tail [expr {$slash+1}] end]\n-\t    if {$lev <= $openlevs} {\n-\t\tset ht 1\n-\t\tset treediropen($prefix) [expr {$lev < $openlevs}]\n-\t\tset bm [expr {$lev == $openlevs? \"tri-rt\": \"tri-dn\"}]\n-\t\t$w mark set d:$ix \"end -1c\"\n-\t\t$w mark gravity d:$ix left\n-\t\tset str \"\\n\"\n-\t\tfor {set i 0} {$i < $lev} {incr i} {append str \"\\t\"}\n-\t\t$w insert end $str\n-\t\t$w image create end -align center -image $bm -padx 1 \\\n-\t\t    -name a:$ix\n-\t\t$w insert end $d [highlight_tag $prefix]\n-\t\t$w mark set s:$ix \"end -1c\"\n-\t\t$w mark gravity s:$ix left\n-\t    }\n-\t    incr lev\n+\twhile {$htstack ne {}} {\n+\t\tset treeheight($prefix) $ht\n+\t\tincr ht [lindex $htstack end]\n+\t\tset htstack [lreplace $htstack end end]\n+\t\tset prefixend [lindex $prefendstack end]\n+\t\tset prefendstack [lreplace $prefendstack end end]\n+\t\tset prefix [string range $prefix 0 $prefixend]\n \t}\n-\tif {$tail ne {}} {\n-\t    if {$lev <= $openlevs} {\n-\t\tincr ht\n-\t\tset str \"\\n\"\n-\t\tfor {set i 0} {$i < $lev} {incr i} {append str \"\\t\"}\n-\t\t$w insert end $str\n-\t\t$w insert end $tail [highlight_tag $f]\n-\t    }\n-\t    lappend treecontents($prefix) $tail\n-\t}\n-    }\n-    while {$htstack ne {}} {\n-\tset treeheight($prefix) $ht\n-\tincr ht [lindex $htstack end]\n-\tset htstack [lreplace $htstack end end]\n-\tset prefixend [lindex $prefendstack end]\n-\tset prefendstack [lreplace $prefendstack end end]\n-\tset prefix [string range $prefix 0 $prefixend]\n-    }\n-    $w conf -state disabled\n+\t$w conf -state disabled\n }\n \n proc linetoelt {l} {\n-    global treeheight treecontents\n+\tglobal treeheight treecontents\n \n-    set y 2\n-    set prefix {}\n-    while {1} {\n-\tforeach e $treecontents($prefix) {\n-\t    if {$y == $l} {\n-\t\treturn \"$prefix$e\"\n-\t    }\n-\t    set n 1\n-\t    if {[string index $e end] eq \"/\"} {\n-\t\tset n $treeheight($prefix$e)\n-\t\tif {$y + $n > $l} {\n-\t\t    append prefix $e\n-\t\t    incr y\n-\t\t    break\n+\tset y 2\n+\tset prefix {}\n+\twhile {1} {\n+\t\tforeach e $treecontents($prefix) {\n+\t\t\tif {$y == $l} {\n+\t\t\t\treturn \"$prefix$e\"\n+\t\t\t}\n+\t\t\tset n 1\n+\t\t\tif {[string index $e end] eq \"/\"} {\n+\t\t\t\tset n $treeheight($prefix$e)\n+\t\t\t\tif {$y + $n > $l} {\n+\t\t\t\t\tappend prefix $e\n+\t\t\t\t\tincr y\n+\t\t\t\t\tbreak\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tincr y $n\n \t\t}\n-\t    }\n-\t    incr y $n\n \t}\n-    }\n }\n \n proc highlight_tree {y prefix} {\n-    global treeheight treecontents cflist\n+\tglobal treeheight treecontents cflist\n \n-    foreach e $treecontents($prefix) {\n-\tset path $prefix$e\n-\tif {[highlight_tag $path] ne {}} {\n-\t    $cflist tag add bold $y.0 \"$y.0 lineend\"\n+\tforeach e $treecontents($prefix) {\n+\t\tset path $prefix$e\n+\t\tif {[highlight_tag $path] ne {}} {\n+\t\t\t$cflist tag add bold $y.0 \"$y.0 lineend\"\n+\t\t}\n+\t\tincr y\n+\t\tif {[string index $e end] eq \"/\" && $treeheight($path) > 1} {\n+\t\t\tset y [highlight_tree $y $path]\n+\t\t}\n \t}\n-\tincr y\n-\tif {[string index $e end] eq \"/\" && $treeheight($path) > 1} {\n-\t    set y [highlight_tree $y $path]\n-\t}\n-    }\n-    return $y\n+\treturn $y\n }\n \n proc treeclosedir {w dir} {\n-    global treediropen treeheight treeparent treeindex\n+\tglobal treediropen treeheight treeparent treeindex\n \n-    set ix $treeindex($dir)\n-    $w conf -state normal\n-    $w delete s:$ix e:$ix\n-    set treediropen($dir) 0\n-    $w image configure a:$ix -image tri-rt\n-    $w conf -state disabled\n-    set n [expr {1 - $treeheight($dir)}]\n-    while {$dir ne {}} {\n-\tincr treeheight($dir) $n\n-\tset dir $treeparent($dir)\n-    }\n+\tset ix $treeindex($dir)\n+\t$w conf -state normal\n+\t$w delete s:$ix e:$ix\n+\tset treediropen($dir) 0\n+\t$w image configure a:$ix -image tri-rt\n+\t$w conf -state disabled\n+\tset n [expr {1 - $treeheight($dir)}]\n+\twhile {$dir ne {}} {\n+\t\tincr treeheight($dir) $n\n+\t\tset dir $treeparent($dir)\n+\t}\n }\n \n proc treeopendir {w dir} {\n-    global treediropen treeheight treeparent treecontents treeindex\n+\tglobal treediropen treeheight treeparent treecontents treeindex\n \n-    set ix $treeindex($dir)\n-    $w conf -state normal\n-    $w image configure a:$ix -image tri-dn\n-    $w mark set e:$ix s:$ix\n-    $w mark gravity e:$ix right\n-    set lev 0\n-    set str \"\\n\"\n-    set n [llength $treecontents($dir)]\n-    for {set x $dir} {$x ne {}} {set x $treeparent($x)} {\n-\tincr lev\n-\tappend str \"\\t\"\n-\tincr treeheight($x) $n\n-    }\n-    foreach e $treecontents($dir) {\n-\tset de $dir$e\n-\tif {[string index $e end] eq \"/\"} {\n-\t    set iy $treeindex($de)\n-\t    $w mark set d:$iy e:$ix\n-\t    $w mark gravity d:$iy left\n-\t    $w insert e:$ix $str\n-\t    set treediropen($de) 0\n-\t    $w image create e:$ix -align center -image tri-rt -padx 1 \\\n-\t\t-name a:$iy\n-\t    $w insert e:$ix $e [highlight_tag $de]\n-\t    $w mark set s:$iy e:$ix\n-\t    $w mark gravity s:$iy left\n-\t    set treeheight($de) 1\n-\t} else {\n-\t    $w insert e:$ix $str\n-\t    $w insert e:$ix $e [highlight_tag $de]\n+\tset ix $treeindex($dir)\n+\t$w conf -state normal\n+\t$w image configure a:$ix -image tri-dn\n+\t$w mark set e:$ix s:$ix\n+\t$w mark gravity e:$ix right\n+\tset lev 0\n+\tset str \"\\n\"\n+\tset n [llength $treecontents($dir)]\n+\tfor {set x $dir} {$x ne {}} {set x $treeparent($x)} {\n+\t\tincr lev\n+\t\tappend str \"\\t\"\n+\t\tincr treeheight($x) $n\n \t}\n-    }\n-    $w mark gravity e:$ix right\n-    $w conf -state disabled\n-    set treediropen($dir) 1\n-    set top [lindex [split [$w index @0,0] .] 0]\n-    set ht [$w cget -height]\n-    set l [lindex [split [$w index s:$ix] .] 0]\n-    if {$l < $top} {\n-\t$w yview $l.0\n-    } elseif {$l + $n + 1 > $top + $ht} {\n-\tset top [expr {$l + $n + 2 - $ht}]\n+\tforeach e $treecontents($dir) {\n+\t\tset de $dir$e\n+\t\tif {[string index $e end] eq \"/\"} {\n+\t\t\tset iy $treeindex($de)\n+\t\t\t$w mark set d:$iy e:$ix\n+\t\t\t$w mark gravity d:$iy left\n+\t\t\t$w insert e:$ix $str\n+\t\t\tset treediropen($de) 0\n+\t\t\t$w image create e:$ix -align center -image tri-rt -padx 1 \\\n+\t\t\t\t-name a:$iy\n+\t\t\t$w insert e:$ix $e [highlight_tag $de]\n+\t\t\t$w mark set s:$iy e:$ix\n+\t\t\t$w mark gravity s:$iy left\n+\t\t\tset treeheight($de) 1\n+\t\t} else {\n+\t\t\t$w insert e:$ix $str\n+\t\t\t$w insert e:$ix $e [highlight_tag $de]\n+\t\t}\n+\t}\n+\t$w mark gravity e:$ix right\n+\t$w conf -state disabled\n+\tset treediropen($dir) 1\n+\tset top [lindex [split [$w index @0,0] .] 0]\n+\tset ht [$w cget -height]\n+\tset l [lindex [split [$w index s:$ix] .] 0]\n \tif {$l < $top} {\n-\t    set top $l\n+\t\t$w yview $l.0\n+\t} elseif {$l + $n + 1 > $top + $ht} {\n+\t\tset top [expr {$l + $n + 2 - $ht}]\n+\t\tif {$l < $top} {\n+\t\t\tset top $l\n+\t\t}\n+\t\t$w yview $top.0\n \t}\n-\t$w yview $top.0\n-    }\n }\n \n proc treeclick {w x y} {\n-    global treediropen cmitmode ctext cflist cflist_top\n+\tglobal treediropen cmitmode ctext cflist cflist_top\n \n-    if {$cmitmode ne \"tree\"} return\n-    if {![info exists cflist_top]} return\n-    set l [lindex [split [$w index \"@$x,$y\"] \".\"] 0]\n-    $cflist tag remove highlight $cflist_top.0 \"$cflist_top.0 lineend\"\n-    $cflist tag add highlight $l.0 \"$l.0 lineend\"\n-    set cflist_top $l\n-    if {$l == 1} {\n-\t$ctext yview 1.0\n-\treturn\n-    }\n-    set e [linetoelt $l]\n-    if {[string index $e end] ne \"/\"} {\n-\tshowfile $e\n-    } elseif {$treediropen($e)} {\n-\ttreeclosedir $w $e\n-    } else {\n-\ttreeopendir $w $e\n-    }\n+\tif {$cmitmode ne \"tree\"} return\n+\tif {![info exists cflist_top]} return\n+\tset l [lindex [split [$w index \"@$x,$y\"] \".\"] 0]\n+\t$cflist tag remove highlight $cflist_top.0 \"$cflist_top.0 lineend\"\n+\t$cflist tag add highlight $l.0 \"$l.0 lineend\"\n+\tset cflist_top $l\n+\tif {$l == 1} {\n+\t\t$ctext yview 1.0\n+\t\treturn\n+\t}\n+\tset e [linetoelt $l]\n+\tif {[string index $e end] ne \"/\"} {\n+\t\tshowfile $e\n+\t} elseif {$treediropen($e)} {\n+\t\ttreeclosedir $w $e\n+\t} else {\n+\t\ttreeopendir $w $e\n+\t}\n }\n \n proc setfilelist {id} {\n-    global treefilelist cflist jump_to_here\n+\tglobal treefilelist cflist jump_to_here\n \n-    treeview $cflist $treefilelist($id) 0\n-    if {$jump_to_here ne {}} {\n-\tset f [lindex $jump_to_here 0]\n-\tif {[lsearch -exact $treefilelist($id) $f] >= 0} {\n-\t    showfile $f\n+\ttreeview $cflist $treefilelist($id) 0\n+\tif {$jump_to_here ne {}} {\n+\t\tset f [lindex $jump_to_here 0]\n+\t\tif {[lsearch -exact $treefilelist($id) $f] >= 0} {\n+\t\t\tshowfile $f\n+\t\t}\n \t}\n-    }\n }\n \n image create bitmap tri-rt -background black -foreground blue -data {\n-    #define tri-rt_width 13\n-    #define tri-rt_height 13\n-    static unsigned char tri-rt_bits[] = {\n-       0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x00, 0x70, 0x00, 0xf0, 0x00,\n-       0xf0, 0x01, 0xf0, 0x00, 0x70, 0x00, 0x30, 0x00, 0x10, 0x00, 0x00, 0x00,\n-       0x00, 0x00};\n+\t#define tri-rt_width 13\n+\t#define tri-rt_height 13\n+\tstatic unsigned char tri-rt_bits[] = {\n+\t   0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x00, 0x70, 0x00, 0xf0, 0x00,\n+\t   0xf0, 0x01, 0xf0, 0x00, 0x70, 0x00, 0x30, 0x00, 0x10, 0x00, 0x00, 0x00,\n+\t   0x00, 0x00};\n } -maskdata {\n-    #define tri-rt-mask_width 13\n-    #define tri-rt-mask_height 13\n-    static unsigned char tri-rt-mask_bits[] = {\n-       0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, 0x00, 0xf8, 0x01,\n-       0xf8, 0x03, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0x38, 0x00, 0x18, 0x00,\n-       0x08, 0x00};\n+\t#define tri-rt-mask_width 13\n+\t#define tri-rt-mask_height 13\n+\tstatic unsigned char tri-rt-mask_bits[] = {\n+\t   0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, 0x00, 0xf8, 0x01,\n+\t   0xf8, 0x03, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0x38, 0x00, 0x18, 0x00,\n+\t   0x08, 0x00};\n }\n image create bitmap tri-dn -background black -foreground blue -data {\n-    #define tri-dn_width 13\n-    #define tri-dn_height 13\n-    static unsigned char tri-dn_bits[] = {\n-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xf8, 0x03,\n-       0xf0, 0x01, 0xe0, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n-       0x00, 0x00};\n+\t#define tri-dn_width 13\n+\t#define tri-dn_height 13\n+\tstatic unsigned char tri-dn_bits[] = {\n+\t   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xf8, 0x03,\n+\t   0xf0, 0x01, 0xe0, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t   0x00, 0x00};\n } -maskdata {\n-    #define tri-dn-mask_width 13\n-    #define tri-dn-mask_height 13\n-    static unsigned char tri-dn-mask_bits[] = {\n-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0xfe, 0x0f, 0xfc, 0x07,\n-       0xf8, 0x03, 0xf0, 0x01, 0xe0, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,\n-       0x00, 0x00};\n+\t#define tri-dn-mask_width 13\n+\t#define tri-dn-mask_height 13\n+\tstatic unsigned char tri-dn-mask_bits[] = {\n+\t   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0xfe, 0x0f, 0xfc, 0x07,\n+\t   0xf8, 0x03, 0xf0, 0x01, 0xe0, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t   0x00, 0x00};\n }\n \n image create bitmap reficon-T -background black -foreground yellow -data {\n-    #define tagicon_width 13\n-    #define tagicon_height 9\n-    static unsigned char tagicon_bits[] = {\n-       0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x07,\n-       0xfc, 0x07, 0xf8, 0x07, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00};\n+\t#define tagicon_width 13\n+\t#define tagicon_height 9\n+\tstatic unsigned char tagicon_bits[] = {\n+\t   0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x07,\n+\t   0xfc, 0x07, 0xf8, 0x07, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00};\n } -maskdata {\n-    #define tagicon-mask_width 13\n-    #define tagicon-mask_height 9\n-    static unsigned char tagicon-mask_bits[] = {\n-       0x00, 0x00, 0xf0, 0x0f, 0xf8, 0x0f, 0xfc, 0x0f,\n-       0xfe, 0x0f, 0xfc, 0x0f, 0xf8, 0x0f, 0xf0, 0x0f, 0x00, 0x00};\n+\t#define tagicon-mask_width 13\n+\t#define tagicon-mask_height 9\n+\tstatic unsigned char tagicon-mask_bits[] = {\n+\t   0x00, 0x00, 0xf0, 0x0f, 0xf8, 0x0f, 0xfc, 0x0f,\n+\t   0xfe, 0x0f, 0xfc, 0x0f, 0xf8, 0x0f, 0xf0, 0x0f, 0x00, 0x00};\n }\n set rectdata {\n-    #define headicon_width 13\n-    #define headicon_height 9\n-    static unsigned char headicon_bits[] = {\n-       0x00, 0x00, 0x00, 0x00, 0xf8, 0x07, 0xf8, 0x07,\n-       0xf8, 0x07, 0xf8, 0x07, 0xf8, 0x07, 0x00, 0x00, 0x00, 0x00};\n+\t#define headicon_width 13\n+\t#define headicon_height 9\n+\tstatic unsigned char headicon_bits[] = {\n+\t   0x00, 0x00, 0x00, 0x00, 0xf8, 0x07, 0xf8, 0x07,\n+\t   0xf8, 0x07, 0xf8, 0x07, 0xf8, 0x07, 0x00, 0x00, 0x00, 0x00};\n }\n set rectmask {\n-    #define headicon-mask_width 13\n-    #define headicon-mask_height 9\n-    static unsigned char headicon-mask_bits[] = {\n-       0x00, 0x00, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f,\n-       0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0x00, 0x00};\n+\t#define headicon-mask_width 13\n+\t#define headicon-mask_height 9\n+\tstatic unsigned char headicon-mask_bits[] = {\n+\t   0x00, 0x00, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f,\n+\t   0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0x00, 0x00};\n }\n image create bitmap reficon-H -background black -foreground \"#00ff00\" \\\n-    -data $rectdata -maskdata $rectmask\n+\t-data $rectdata -maskdata $rectmask\n image create bitmap reficon-R -background black -foreground \"#ffddaa\" \\\n-    -data $rectdata -maskdata $rectmask\n+\t-data $rectdata -maskdata $rectmask\n image create bitmap reficon-o -background black -foreground \"#ddddff\" \\\n-    -data $rectdata -maskdata $rectmask\n+\t-data $rectdata -maskdata $rectmask\n \n proc init_flist {first} {\n-    global cflist cflist_top difffilestart\n+\tglobal cflist cflist_top difffilestart\n \n-    $cflist conf -state normal\n-    $cflist delete 0.0 end\n-    if {$first ne {}} {\n-\t$cflist insert end $first\n-\tset cflist_top 1\n-\t$cflist tag add highlight 1.0 \"1.0 lineend\"\n-    } else {\n-\tunset -nocomplain cflist_top\n-    }\n-    $cflist conf -state disabled\n-    set difffilestart {}\n+\t$cflist conf -state normal\n+\t$cflist delete 0.0 end\n+\tif {$first ne {}} {\n+\t\t$cflist insert end $first\n+\t\tset cflist_top 1\n+\t\t$cflist tag add highlight 1.0 \"1.0 lineend\"\n+\t} else {\n+\t\tunset -nocomplain cflist_top\n+\t}\n+\t$cflist conf -state disabled\n+\tset difffilestart {}\n }\n \n proc highlight_tag {f} {\n-    global highlight_paths\n+\tglobal highlight_paths\n \n-    foreach p $highlight_paths {\n-\tif {[string match $p $f]} {\n-\t    return \"bold\"\n+\tforeach p $highlight_paths {\n+\t\tif {[string match $p $f]} {\n+\t\t\treturn \"bold\"\n+\t\t}\n \t}\n-    }\n-    return {}\n+\treturn {}\n }\n \n proc highlight_filelist {} {\n-    global cmitmode cflist\n+\tglobal cmitmode cflist\n \n-    $cflist conf -state normal\n-    if {$cmitmode ne \"tree\"} {\n-\tset end [lindex [split [$cflist index end] .] 0]\n-\tfor {set l 2} {$l < $end} {incr l} {\n-\t    set line [$cflist get $l.0 \"$l.0 lineend\"]\n-\t    if {[highlight_tag $line] ne {}} {\n-\t\t$cflist tag add bold $l.0 \"$l.0 lineend\"\n-\t    }\n+\t$cflist conf -state normal\n+\tif {$cmitmode ne \"tree\"} {\n+\t\tset end [lindex [split [$cflist index end] .] 0]\n+\t\tfor {set l 2} {$l < $end} {incr l} {\n+\t\t\tset line [$cflist get $l.0 \"$l.0 lineend\"]\n+\t\t\tif {[highlight_tag $line] ne {}} {\n+\t\t\t\t$cflist tag add bold $l.0 \"$l.0 lineend\"\n+\t\t\t}\n+\t\t}\n+\t} else {\n+\t\thighlight_tree 2 {}\n \t}\n-    } else {\n-\thighlight_tree 2 {}\n-    }\n-    $cflist conf -state disabled\n+\t$cflist conf -state disabled\n }\n \n proc unhighlight_filelist {} {\n-    global cflist\n+\tglobal cflist\n \n-    $cflist conf -state normal\n-    $cflist tag remove bold 1.0 end\n-    $cflist conf -state disabled\n+\t$cflist conf -state normal\n+\t$cflist tag remove bold 1.0 end\n+\t$cflist conf -state disabled\n }\n \n proc add_flist {fl} {\n-    global cflist\n+\tglobal cflist\n \n-    $cflist conf -state normal\n-    foreach f $fl {\n-\t$cflist insert end \"\\n\"\n-\t$cflist insert end $f [highlight_tag $f]\n-    }\n-    $cflist conf -state disabled\n+\t$cflist conf -state normal\n+\tforeach f $fl {\n+\t\t$cflist insert end \"\\n\"\n+\t\t$cflist insert end $f [highlight_tag $f]\n+\t}\n+\t$cflist conf -state disabled\n }\n \n proc sel_flist {w x y} {\n-    global ctext difffilestart cflist cflist_top cmitmode\n+\tglobal ctext difffilestart cflist cflist_top cmitmode\n \n-    if {$cmitmode eq \"tree\"} return\n-    if {![info exists cflist_top]} return\n-    set l [lindex [split [$w index \"@$x,$y\"] \".\"] 0]\n-    $cflist tag remove highlight $cflist_top.0 \"$cflist_top.0 lineend\"\n-    $cflist tag add highlight $l.0 \"$l.0 lineend\"\n-    set cflist_top $l\n-    if {$l == 1} {\n-\t$ctext yview 1.0\n-    } else {\n-\tcatch {$ctext yview [lindex $difffilestart [expr {$l - 2}]]}\n-    }\n-    suppress_highlighting_file_for_current_scrollpos\n+\tif {$cmitmode eq \"tree\"} return\n+\tif {![info exists cflist_top]} return\n+\tset l [lindex [split [$w index \"@$x,$y\"] \".\"] 0]\n+\t$cflist tag remove highlight $cflist_top.0 \"$cflist_top.0 lineend\"\n+\t$cflist tag add highlight $l.0 \"$l.0 lineend\"\n+\tset cflist_top $l\n+\tif {$l == 1} {\n+\t\t$ctext yview 1.0\n+\t} else {\n+\t\tcatch {$ctext yview [lindex $difffilestart [expr {$l - 2}]]}\n+\t}\n+\tsuppress_highlighting_file_for_current_scrollpos\n }\n \n proc pop_flist_menu {w X Y x y} {\n-    global ctext cflist cmitmode flist_menu flist_menu_file\n-    global treediffs diffids\n+\tglo"},{"id":"405323","messageId":"20200910083615.GA1407716@generichostname","threadId":"54220","inReplyTo":"cover.1599726439.git.liu.denton@gmail.com","subject":"Re: [PATCH 0/2] gitk: fix mix of tabs and spaces in indentation","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2020-09-10T08:36:15Z","receivedAt":"2020-09-10T08:38:37Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"On Thu, Sep 10, 2020 at 01:27:40AM -0700, Denton Liu wrote:\n> Denton Liu (2):\n>   gitk: replace spaces with tabs\n\nUnfortunately, the patch is too big to be sent by email. It can be\nretrieved from https://github.com/Denton-L/git.git\nsubmitted/gitk-whitespace~.\n\nIf you don't want to pull it, the commit without the body is included\nbelow. It can be fully reproduced by running the vim commands listed on\nthe gitk file.\n\n-- >8 --\n\nFrom: Denton Liu <liu.denton@gmail.com>\nDate: Wed, 9 Sep 2020 12:10:51 -0700\nSubject: [PATCH 1/2] gitk: replace spaces with tabs\nTo: Git Mailing List <git@vger.kernel.org>,\n    Paul Mackerras <paulus@ozlabs.org>\n\nThe source code is a mix of tabs and spaces. The indentation style\ncurrently is four spaces per indent level but uses tabs every other\nlevel (at eight spaces). Fix this inconsistent spacing and tabbing by\njust using a tab-indent for everything.\n\nThis was done mechanically using the following vim commands:\n\n\t:set tabstop=8\n\t:set expandtab\n\t:retab\n\t:set tabstop=4\n\t:set noexpandtab\n\t:retab!\n\t:set tabstop=8\n\nA future commit will manually clean up the code style errors introduced\nby this patch.\n\nThis patch should be empty with `--ignore-all-space`.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n gitk | 20408 ++++++++++++++++++++++++++++-----------------------------\n 1 file changed, 10204 insertions(+), 10204 deletions(-)\n"},{"id":"405324","messageId":"20200910091719.GB2537966@thinks.paulus.ozlabs.org","threadId":"54220","inReplyTo":"cover.1599726439.git.liu.denton@gmail.com","subject":"Re: [PATCH 0/2] gitk: fix mix of tabs and spaces in indentation","fromName":"Paul Mackerras","fromEmail":"paulus@ozlabs.org","sentAt":"2020-09-10T09:17:19Z","receivedAt":"2020-09-10T09:18:04Z","isPatch":true,"sender":{"key":"paulus@ozlabs.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"On Thu, Sep 10, 2020 at 01:27:40AM -0700, Denton Liu wrote:\n> The source code of gitk has some funny indentation. It uses four spaces\n> per level indent but uses tabs every other level (eight spaces).\n> Reindent gitk to just use tabs instead.\n\nI don't think I want to do this.  I would accept changing all the\nindentation to use just spaces - at least that's going to look OK\nregardless of the tab width setting.\n\nPaul.\n"},{"id":"405392","messageId":"cover.1599798976.git.liu.denton@gmail.com","threadId":"54220","inReplyTo":"cover.1599726439.git.liu.denton@gmail.com","subject":"[PATCH v2 0/2] gitk: fix mix of tabs and spaces in indentation","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2020-09-11T04:36:32Z","receivedAt":"2020-09-11T04:37:02Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The source code of gitk has some funny indentation. It uses four spaces\nper level indent but uses tabs every other level (eight spaces).\nReindent gitk to just use spaces instead.\n\nThis series should be empty with `--ignore-all-space`.\n\nChanges since v1:\n\n* Instead of using tabs, just use spaces\n\nDenton Liu (2):\n  gitk: replace tabs with spaces\n  gitk: replace commented tab with space\n\n gitk | 10570 ++++++++++++++++++++++++++++-----------------------------\n 1 file changed, 5285 insertions(+), 5285 deletions(-)\n\n-- \n2.28.0.618.gf4bc123cb7\n\n"},{"id":"405393","messageId":"85d669828bf9455ac101f8177a7f46a94d30a114.1599798976.git.liu.denton@gmail.com","threadId":"54220","inReplyTo":"cover.1599798976.git.liu.denton@gmail.com","subject":"[PATCH v2 2/2] gitk: replace commented tab with space","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2020-09-11T04:36:34Z","receivedAt":"2020-09-11T04:37:06Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In the previous commit, the tab indents were mechanically replaced with\nspaces. However, one tab, in particular, was missed. This tab was not\nconsidered an indentation because it's hidden behind a comment. Manually\nreplace this tab with spaces too.\n\nThe only tabs that remain in this file are in the \"Gitk key bindings\"\ntable where they are used for visual alignment in a user-facing table so\nleave those alone.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n gitk | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/gitk b/gitk\nindex 1dae9861ac..0380cd8976 100755\n--- a/gitk\n+++ b/gitk\n@@ -4451,7 +4451,7 @@ proc addviewmenu {n} {\n     .bar.view add radiobutton -label $viewname($n) \\\n         -command [list showview $n] -variable selectedview -value $n\n     #$viewhlmenu add radiobutton -label $viewname($n) \\\n-    #\t-command [list addvhighlight $n] -variable selectedhlview\n+    #    -command [list addvhighlight $n] -variable selectedhlview\n }\n \n proc showview {n} {\n-- \n2.28.0.618.gf4bc123cb7\n\n"},{"id":"405394","messageId":"ecdede5cf50bdb966f53bcf5171c80b5f8959d4b.1599798976.git.liu.denton@gmail.com","threadId":"54220","inReplyTo":"cover.1599798976.git.liu.denton@gmail.com","subject":"[PATCH v2 1/2] gitk: replace tabs with spaces","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2020-09-11T04:36:33Z","receivedAt":"2020-09-11T04:37:08Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The source code is a mix of tabs and spaces. The indentation style\ncurrently is four spaces per indent level but uses tabs every other\nlevel (at eight spaces). Fix this inconsistent spacing and tabbing by\njust using a space-indent for everything.\n\nThis was done mechanically by running:\n\n\t$ expand -i gitk >gitk.new\n\t$ mv gitk.new gitk\n\nThis patch should be empty with `--ignore-all-space`.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n gitk | 10568 ++++++++++++++++++++++++++++-----------------------------\n 1 file changed, 5284 insertions(+), 5284 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex da84e22dd4..1dae9861ac 100755\n--- a/gitk\n+++ b/gitk\n@@ -11,14 +11,14 @@ package require Tk\n \n proc hasworktree {} {\n     return [expr {[exec git rev-parse --is-bare-repository] == \"false\" &&\n-\t\t  [exec git rev-parse --is-inside-git-dir] == \"false\"}]\n+                  [exec git rev-parse --is-inside-git-dir] == \"false\"}]\n }\n \n proc reponame {} {\n     global gitdir\n     set n [file normalize $gitdir]\n     if {[string match \"*/.git\" $n]} {\n-\tset n [string range $n 0 end-5]\n+        set n [string range $n 0 end-5]\n     }\n     return [file tail $n]\n }\n@@ -26,7 +26,7 @@ proc reponame {} {\n proc gitworktree {} {\n     variable _gitworktree\n     if {[info exists _gitworktree]} {\n-\treturn $_gitworktree\n+        return $_gitworktree\n     }\n     # v1.7.0 introduced --show-toplevel to return the canonical work-tree\n     if {[catch {set _gitworktree [exec git rev-parse --show-toplevel]}]} {\n@@ -34,10 +34,10 @@ proc gitworktree {} {\n         # cdup to obtain a relative path to the top of the worktree. If\n         # run from the top, the ./ prefix ensures normalize expands pwd.\n         if {[catch { set _gitworktree $env(GIT_WORK_TREE) }]} {\n-\t    catch {set _gitworktree [exec git config --get core.worktree]}\n-\t    if {$_gitworktree eq \"\"} {\n-\t\tset _gitworktree [file normalize ./[exec git rev-parse --show-cdup]]\n-\t    }\n+            catch {set _gitworktree [exec git config --get core.worktree]}\n+            if {$_gitworktree eq \"\"} {\n+                set _gitworktree [file normalize ./[exec git rev-parse --show-cdup]]\n+            }\n         }\n     }\n     return $_gitworktree\n@@ -54,7 +54,7 @@ proc run args {\n     set script $args\n     if {[info exists isonrunq($script)]} return\n     if {$runq eq {} && ![info exists currunq]} {\n-\tafter idle dorunq\n+        after idle dorunq\n     }\n     lappend runq [list {} $script]\n     set isonrunq($script) 1\n@@ -69,7 +69,7 @@ proc filereadable {fd script} {\n \n     fileevent $fd readable {}\n     if {$runq eq {} && ![info exists currunq]} {\n-\tafter idle dorunq\n+        after idle dorunq\n     }\n     lappend runq [list $fd $script]\n }\n@@ -78,11 +78,11 @@ proc nukefile {fd} {\n     global runq\n \n     for {set i 0} {$i < [llength $runq]} {} {\n-\tif {[lindex $runq $i 0] eq $fd} {\n-\t    set runq [lreplace $runq $i $i]\n-\t} else {\n-\t    incr i\n-\t}\n+        if {[lindex $runq $i 0] eq $fd} {\n+            set runq [lreplace $runq $i $i]\n+        } else {\n+            incr i\n+        }\n     }\n }\n \n@@ -92,30 +92,30 @@ proc dorunq {} {\n     set tstart [clock clicks -milliseconds]\n     set t0 $tstart\n     while {[llength $runq] > 0} {\n-\tset fd [lindex $runq 0 0]\n-\tset script [lindex $runq 0 1]\n-\tset currunq [lindex $runq 0]\n-\tset runq [lrange $runq 1 end]\n-\tset repeat [eval $script]\n-\tunset currunq\n-\tset t1 [clock clicks -milliseconds]\n-\tset t [expr {$t1 - $t0}]\n-\tif {$repeat ne {} && $repeat} {\n-\t    if {$fd eq {} || $repeat == 2} {\n-\t\t# script returns 1 if it wants to be readded\n-\t\t# file readers return 2 if they could do more straight away\n-\t\tlappend runq [list $fd $script]\n-\t    } else {\n-\t\tfileevent $fd readable [list filereadable $fd $script]\n-\t    }\n-\t} elseif {$fd eq {}} {\n-\t    unset isonrunq($script)\n-\t}\n-\tset t0 $t1\n-\tif {$t1 - $tstart >= 80} break\n+        set fd [lindex $runq 0 0]\n+        set script [lindex $runq 0 1]\n+        set currunq [lindex $runq 0]\n+        set runq [lrange $runq 1 end]\n+        set repeat [eval $script]\n+        unset currunq\n+        set t1 [clock clicks -milliseconds]\n+        set t [expr {$t1 - $t0}]\n+        if {$repeat ne {} && $repeat} {\n+            if {$fd eq {} || $repeat == 2} {\n+                # script returns 1 if it wants to be readded\n+                # file readers return 2 if they could do more straight away\n+                lappend runq [list $fd $script]\n+            } else {\n+                fileevent $fd readable [list filereadable $fd $script]\n+            }\n+        } elseif {$fd eq {}} {\n+            unset isonrunq($script)\n+        }\n+        set t0 $t1\n+        if {$t1 - $tstart >= 80} break\n     }\n     if {$runq ne {}} {\n-\tafter idle dorunq\n+        after idle dorunq\n     }\n }\n \n@@ -135,20 +135,20 @@ proc unmerged_files {files} {\n     set mlist {}\n     set nr_unmerged 0\n     if {[catch {\n-\tset fd [open \"| git ls-files -u\" r]\n+        set fd [open \"| git ls-files -u\" r]\n     } err]} {\n-\tshow_error {} . \"[mc \"Couldn't get list of unmerged files:\"] $err\"\n-\texit 1\n+        show_error {} . \"[mc \"Couldn't get list of unmerged files:\"] $err\"\n+        exit 1\n     }\n     while {[gets $fd line] >= 0} {\n-\tset i [string first \"\\t\" $line]\n-\tif {$i < 0} continue\n-\tset fname [string range $line [expr {$i+1}] end]\n-\tif {[lsearch -exact $mlist $fname] >= 0} continue\n-\tincr nr_unmerged\n-\tif {$files eq {} || [path_filter $files $fname]} {\n-\t    lappend mlist $fname\n-\t}\n+        set i [string first \"\\t\" $line]\n+        if {$i < 0} continue\n+        set fname [string range $line [expr {$i+1}] end]\n+        if {[lsearch -exact $mlist $fname] >= 0} continue\n+        incr nr_unmerged\n+        if {$files eq {} || [path_filter $files $fname]} {\n+            lappend mlist $fname\n+        }\n     }\n     catch {close $fd}\n     return $mlist\n@@ -171,115 +171,115 @@ proc parseviewargs {n arglist} {\n     set filtered 0\n     set i -1\n     foreach arg $arglist {\n-\tincr i\n-\tif {$nextisval} {\n-\t    lappend glflags $arg\n-\t    set nextisval 0\n-\t    continue\n-\t}\n-\tswitch -glob -- $arg {\n-\t    \"-d\" -\n-\t    \"--date-order\" {\n-\t\tset vdatemode($n) 1\n-\t\t# remove from origargs in case we hit an unknown option\n-\t\tset origargs [lreplace $origargs $i $i]\n-\t\tincr i -1\n-\t    }\n-\t    \"-[puabwcrRBMC]\" -\n-\t    \"--no-renames\" - \"--full-index\" - \"--binary\" - \"--abbrev=*\" -\n-\t    \"--find-copies-harder\" - \"-l*\" - \"--ext-diff\" - \"--no-ext-diff\" -\n-\t    \"--src-prefix=*\" - \"--dst-prefix=*\" - \"--no-prefix\" -\n-\t    \"-O*\" - \"--text\" - \"--full-diff\" - \"--ignore-space-at-eol\" -\n-\t    \"--ignore-space-change\" - \"-U*\" - \"--unified=*\" {\n-\t\t# These request or affect diff output, which we don't want.\n-\t\t# Some could be used to set our defaults for diff display.\n-\t\tlappend diffargs $arg\n-\t    }\n-\t    \"--raw\" - \"--patch-with-raw\" - \"--patch-with-stat\" -\n-\t    \"--name-only\" - \"--name-status\" - \"--color\" -\n-\t    \"--log-size\" - \"--pretty=*\" - \"--decorate\" - \"--abbrev-commit\" -\n-\t    \"--cc\" - \"-z\" - \"--header\" - \"--parents\" - \"--boundary\" -\n-\t    \"--no-color\" - \"-g\" - \"--walk-reflogs\" - \"--no-walk\" -\n-\t    \"--timestamp\" - \"relative-date\" - \"--date=*\" - \"--stdin\" -\n-\t    \"--objects\" - \"--objects-edge\" - \"--reverse\" {\n-\t\t# These cause our parsing of git log's output to fail, or else\n-\t\t# they're options we want to set ourselves, so ignore them.\n-\t    }\n-\t    \"--color-words*\" - \"--word-diff=color\" {\n-\t\t# These trigger a word diff in the console interface,\n-\t\t# so help the user by enabling our own support\n-\t\tif {[package vcompare $git_version \"1.7.2\"] >= 0} {\n-\t\t    set worddiff [mc \"Color words\"]\n-\t\t}\n-\t    }\n-\t    \"--word-diff*\" {\n-\t\tif {[package vcompare $git_version \"1.7.2\"] >= 0} {\n-\t\t    set worddiff [mc \"Markup words\"]\n-\t\t}\n-\t    }\n-\t    \"--stat=*\" - \"--numstat\" - \"--shortstat\" - \"--summary\" -\n-\t    \"--check\" - \"--exit-code\" - \"--quiet\" - \"--topo-order\" -\n-\t    \"--full-history\" - \"--dense\" - \"--sparse\" -\n-\t    \"--follow\" - \"--left-right\" - \"--encoding=*\" {\n-\t\t# These are harmless, and some are even useful\n-\t\tlappend glflags $arg\n-\t    }\n-\t    \"--diff-filter=*\" - \"--no-merges\" - \"--unpacked\" -\n-\t    \"--max-count=*\" - \"--skip=*\" - \"--since=*\" - \"--after=*\" -\n-\t    \"--until=*\" - \"--before=*\" - \"--max-age=*\" - \"--min-age=*\" -\n-\t    \"--author=*\" - \"--committer=*\" - \"--grep=*\" - \"-[iE]\" -\n-\t    \"--remove-empty\" - \"--first-parent\" - \"--cherry-pick\" -\n-\t    \"-S*\" - \"-G*\" - \"--pickaxe-all\" - \"--pickaxe-regex\" -\n-\t    \"--simplify-by-decoration\" {\n-\t\t# These mean that we get a subset of the commits\n-\t\tset filtered 1\n-\t\tlappend glflags $arg\n-\t    }\n-\t    \"-L*\" {\n-\t\t# Line-log with 'stuck' argument (unstuck form is\n-\t\t# not supported)\n-\t\tset filtered 1\n-\t\tset vinlinediff($n) 1\n-\t\tset allknown 0\n-\t\tlappend glflags $arg\n-\t    }\n-\t    \"-n\" {\n-\t\t# This appears to be the only one that has a value as a\n-\t\t# separate word following it\n-\t\tset filtered 1\n-\t\tset nextisval 1\n-\t\tlappend glflags $arg\n-\t    }\n-\t    \"--not\" - \"--all\" {\n-\t\tlappend revargs $arg\n-\t    }\n-\t    \"--merge\" {\n-\t\tset vmergeonly($n) 1\n-\t\t# git rev-parse doesn't understand --merge\n-\t\tlappend revargs --gitk-symmetric-diff-marker MERGE_HEAD...HEAD\n-\t    }\n-\t    \"--no-replace-objects\" {\n-\t\tset env(GIT_NO_REPLACE_OBJECTS) \"1\"\n-\t    }\n-\t    \"-*\" {\n-\t\t# Other flag arguments including -<n>\n-\t\tif {[string is digit -strict [string range $arg 1 end]]} {\n-\t\t    set filtered 1\n-\t\t} else {\n-\t\t    # a flag argument that we don't recognize;\n-\t\t    # that means we can't optimize\n-\t\t    set allknown 0\n-\t\t}\n-\t\tlappend glflags $arg\n-\t    }\n-\t    default {\n-\t\t# Non-flag arguments specify commits or ranges of commits\n-\t\tif {[string match \"*...*\" $arg]} {\n-\t\t    lappend revargs --gitk-symmetric-diff-marker\n-\t\t}\n-\t\tlappend revargs $arg\n-\t    }\n-\t}\n+        incr i\n+        if {$nextisval} {\n+            lappend glflags $arg\n+            set nextisval 0\n+            continue\n+        }\n+        switch -glob -- $arg {\n+            \"-d\" -\n+            \"--date-order\" {\n+                set vdatemode($n) 1\n+                # remove from origargs in case we hit an unknown option\n+                set origargs [lreplace $origargs $i $i]\n+                incr i -1\n+            }\n+            \"-[puabwcrRBMC]\" -\n+            \"--no-renames\" - \"--full-index\" - \"--binary\" - \"--abbrev=*\" -\n+            \"--find-copies-harder\" - \"-l*\" - \"--ext-diff\" - \"--no-ext-diff\" -\n+            \"--src-prefix=*\" - \"--dst-prefix=*\" - \"--no-prefix\" -\n+            \"-O*\" - \"--text\" - \"--full-diff\" - \"--ignore-space-at-eol\" -\n+            \"--ignore-space-change\" - \"-U*\" - \"--unified=*\" {\n+                # These request or affect diff output, which we don't want.\n+                # Some could be used to set our defaults for diff display.\n+                lappend diffargs $arg\n+            }\n+            \"--raw\" - \"--patch-with-raw\" - \"--patch-with-stat\" -\n+            \"--name-only\" - \"--name-status\" - \"--color\" -\n+            \"--log-size\" - \"--pretty=*\" - \"--decorate\" - \"--abbrev-commit\" -\n+            \"--cc\" - \"-z\" - \"--header\" - \"--parents\" - \"--boundary\" -\n+            \"--no-color\" - \"-g\" - \"--walk-reflogs\" - \"--no-walk\" -\n+            \"--timestamp\" - \"relative-date\" - \"--date=*\" - \"--stdin\" -\n+            \"--objects\" - \"--objects-edge\" - \"--reverse\" {\n+                # These cause our parsing of git log's output to fail, or else\n+                # they're options we want to set ourselves, so ignore them.\n+            }\n+            \"--color-words*\" - \"--word-diff=color\" {\n+                # These trigger a word diff in the console interface,\n+                # so help the user by enabling our own support\n+                if {[package vcompare $git_version \"1.7.2\"] >= 0} {\n+                    set worddiff [mc \"Color words\"]\n+                }\n+            }\n+            \"--word-diff*\" {\n+                if {[package vcompare $git_version \"1.7.2\"] >= 0} {\n+                    set worddiff [mc \"Markup words\"]\n+                }\n+            }\n+            \"--stat=*\" - \"--numstat\" - \"--shortstat\" - \"--summary\" -\n+            \"--check\" - \"--exit-code\" - \"--quiet\" - \"--topo-order\" -\n+            \"--full-history\" - \"--dense\" - \"--sparse\" -\n+            \"--follow\" - \"--left-right\" - \"--encoding=*\" {\n+                # These are harmless, and some are even useful\n+                lappend glflags $arg\n+            }\n+            \"--diff-filter=*\" - \"--no-merges\" - \"--unpacked\" -\n+            \"--max-count=*\" - \"--skip=*\" - \"--since=*\" - \"--after=*\" -\n+            \"--until=*\" - \"--before=*\" - \"--max-age=*\" - \"--min-age=*\" -\n+            \"--author=*\" - \"--committer=*\" - \"--grep=*\" - \"-[iE]\" -\n+            \"--remove-empty\" - \"--first-parent\" - \"--cherry-pick\" -\n+            \"-S*\" - \"-G*\" - \"--pickaxe-all\" - \"--pickaxe-regex\" -\n+            \"--simplify-by-decoration\" {\n+                # These mean that we get a subset of the commits\n+                set filtered 1\n+                lappend glflags $arg\n+            }\n+            \"-L*\" {\n+                # Line-log with 'stuck' argument (unstuck form is\n+                # not supported)\n+                set filtered 1\n+                set vinlinediff($n) 1\n+                set allknown 0\n+                lappend glflags $arg\n+            }\n+            \"-n\" {\n+                # This appears to be the only one that has a value as a\n+                # separate word following it\n+                set filtered 1\n+                set nextisval 1\n+                lappend glflags $arg\n+            }\n+            \"--not\" - \"--all\" {\n+                lappend revargs $arg\n+            }\n+            \"--merge\" {\n+                set vmergeonly($n) 1\n+                # git rev-parse doesn't understand --merge\n+                lappend revargs --gitk-symmetric-diff-marker MERGE_HEAD...HEAD\n+            }\n+            \"--no-replace-objects\" {\n+                set env(GIT_NO_REPLACE_OBJECTS) \"1\"\n+            }\n+            \"-*\" {\n+                # Other flag arguments including -<n>\n+                if {[string is digit -strict [string range $arg 1 end]]} {\n+                    set filtered 1\n+                } else {\n+                    # a flag argument that we don't recognize;\n+                    # that means we can't optimize\n+                    set allknown 0\n+                }\n+                lappend glflags $arg\n+            }\n+            default {\n+                # Non-flag arguments specify commits or ranges of commits\n+                if {[string match \"*...*\" $arg]} {\n+                    lappend revargs --gitk-symmetric-diff-marker\n+                }\n+                lappend revargs $arg\n+            }\n+        }\n     }\n     set vdflags($n) $diffargs\n     set vflags($n) $glflags\n@@ -293,61 +293,61 @@ proc parseviewrevs {view revs} {\n     global vposids vnegids\n \n     if {$revs eq {}} {\n-\tset revs HEAD\n+        set revs HEAD\n     } elseif {[lsearch -exact $revs --all] >= 0} {\n-\tlappend revs HEAD\n+        lappend revs HEAD\n     }\n     if {[catch {set ids [eval exec git rev-parse $revs]} err]} {\n-\t# we get stdout followed by stderr in $err\n-\t# for an unknown rev, git rev-parse echoes it and then errors out\n-\tset errlines [split $err \"\\n\"]\n-\tset badrev {}\n-\tfor {set l 0} {$l < [llength $errlines]} {incr l} {\n-\t    set line [lindex $errlines $l]\n-\t    if {!([string length $line] == 40 && [string is xdigit $line])} {\n-\t\tif {[string match \"fatal:*\" $line]} {\n-\t\t    if {[string match \"fatal: ambiguous argument*\" $line]\n-\t\t\t&& $badrev ne {}} {\n-\t\t\tif {[llength $badrev] == 1} {\n-\t\t\t    set err \"unknown revision $badrev\"\n-\t\t\t} else {\n-\t\t\t    set err \"unknown revisions: [join $badrev \", \"]\"\n-\t\t\t}\n-\t\t    } else {\n-\t\t\tset err [join [lrange $errlines $l end] \"\\n\"]\n-\t\t    }\n-\t\t    break\n-\t\t}\n-\t\tlappend badrev $line\n-\t    }\n-\t}\n-\terror_popup \"[mc \"Error parsing revisions:\"] $err\"\n-\treturn {}\n+        # we get stdout followed by stderr in $err\n+        # for an unknown rev, git rev-parse echoes it and then errors out\n+        set errlines [split $err \"\\n\"]\n+        set badrev {}\n+        for {set l 0} {$l < [llength $errlines]} {incr l} {\n+            set line [lindex $errlines $l]\n+            if {!([string length $line] == 40 && [string is xdigit $line])} {\n+                if {[string match \"fatal:*\" $line]} {\n+                    if {[string match \"fatal: ambiguous argument*\" $line]\n+                        && $badrev ne {}} {\n+                        if {[llength $badrev] == 1} {\n+                            set err \"unknown revision $badrev\"\n+                        } else {\n+                            set err \"unknown revisions: [join $badrev \", \"]\"\n+                        }\n+                    } else {\n+                        set err [join [lrange $errlines $l end] \"\\n\"]\n+                    }\n+                    break\n+                }\n+                lappend badrev $line\n+            }\n+        }\n+        error_popup \"[mc \"Error parsing revisions:\"] $err\"\n+        return {}\n     }\n     set ret {}\n     set pos {}\n     set neg {}\n     set sdm 0\n     foreach id [split $ids \"\\n\"] {\n-\tif {$id eq \"--gitk-symmetric-diff-marker\"} {\n-\t    set sdm 4\n-\t} elseif {[string match \"^*\" $id]} {\n-\t    if {$sdm != 1} {\n-\t\tlappend ret $id\n-\t\tif {$sdm == 3} {\n-\t\t    set sdm 0\n-\t\t}\n-\t    }\n-\t    lappend neg [string range $id 1 end]\n-\t} else {\n-\t    if {$sdm != 2} {\n-\t\tlappend ret $id\n-\t    } else {\n-\t\tlset ret end $id...[lindex $ret end]\n-\t    }\n-\t    lappend pos $id\n-\t}\n-\tincr sdm -1\n+        if {$id eq \"--gitk-symmetric-diff-marker\"} {\n+            set sdm 4\n+        } elseif {[string match \"^*\" $id]} {\n+            if {$sdm != 1} {\n+                lappend ret $id\n+                if {$sdm == 3} {\n+                    set sdm 0\n+                }\n+            }\n+            lappend neg [string range $id 1 end]\n+        } else {\n+            if {$sdm != 2} {\n+                lappend ret $id\n+            } else {\n+                lset ret end $id...[lindex $ret end]\n+            }\n+            lappend pos $id\n+        }\n+        incr sdm -1\n     }\n     set vposids($view) $pos\n     set vnegids($view) $neg\n@@ -374,63 +374,63 @@ proc start_rev_list {view} {\n \n     set args $viewargs($view)\n     if {$viewargscmd($view) ne {}} {\n-\tif {[catch {\n-\t    set str [exec sh -c $viewargscmd($view)]\n-\t} err]} {\n-\t    error_popup \"[mc \"Error executing --argscmd command:\"] $err\"\n-\t    return 0\n-\t}\n-\tset args [concat $args [split $str \"\\n\"]]\n+        if {[catch {\n+            set str [exec sh -c $viewargscmd($view)]\n+        } err]} {\n+            error_popup \"[mc \"Error executing --argscmd command:\"] $err\"\n+            return 0\n+        }\n+        set args [concat $args [split $str \"\\n\"]]\n     }\n     set vcanopt($view) [parseviewargs $view $args]\n \n     set files $viewfiles($view)\n     if {$vmergeonly($view)} {\n-\tset files [unmerged_files $files]\n-\tif {$files eq {}} {\n-\t    global nr_unmerged\n-\t    if {$nr_unmerged == 0} {\n-\t\terror_popup [mc \"No files selected: --merge specified but\\\n-\t\t\t     no files are unmerged.\"]\n-\t    } else {\n-\t\terror_popup [mc \"No files selected: --merge specified but\\\n-\t\t\t     no unmerged files are within file limit.\"]\n-\t    }\n-\t    return 0\n-\t}\n+        set files [unmerged_files $files]\n+        if {$files eq {}} {\n+            global nr_unmerged\n+            if {$nr_unmerged == 0} {\n+                error_popup [mc \"No files selected: --merge specified but\\\n+                             no files are unmerged.\"]\n+            } else {\n+                error_popup [mc \"No files selected: --merge specified but\\\n+                             no unmerged files are within file limit.\"]\n+            }\n+            return 0\n+        }\n     }\n     set vfilelimit($view) $files\n \n     if {$vcanopt($view)} {\n-\tset revs [parseviewrevs $view $vrevs($view)]\n-\tif {$revs eq {}} {\n-\t    return 0\n-\t}\n-\tset args [concat $vflags($view) $revs]\n+        set revs [parseviewrevs $view $vrevs($view)]\n+        if {$revs eq {}} {\n+            return 0\n+        }\n+        set args [concat $vflags($view) $revs]\n     } else {\n-\tset args $vorigargs($view)\n+        set args $vorigargs($view)\n     }\n \n     if {[catch {\n-\tset fd [open [concat | git log --no-color -z --pretty=raw $show_notes \\\n-\t\t\t--parents --boundary $args \"--\" $files] r]\n+        set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \\\n+                        --parents --boundary $args \"--\" $files] r]\n     } err]} {\n-\terror_popup \"[mc \"Error executing git log:\"] $err\"\n-\treturn 0\n+        error_popup \"[mc \"Error executing git log:\"] $err\"\n+        return 0\n     }\n     set i [reg_instance $fd]\n     set viewinstances($view) [list $i]\n     set viewmainheadid($view) $mainheadid\n     set viewmainheadid_orig($view) $mainheadid\n     if {$files ne {} && $mainheadid ne {}} {\n-\tget_viewmainhead $view\n+        get_viewmainhead $view\n     }\n     if {$showlocalchanges && $viewmainheadid($view) ne {}} {\n-\tinterestedin $viewmainheadid($view) dodiffindex\n+        interestedin $viewmainheadid($view) dodiffindex\n     }\n     fconfigure $fd -blocking 0 -translation lf -eofchar {}\n     if {$tclencoding != {}} {\n-\tfconfigure $fd -encoding $tclencoding\n+        fconfigure $fd -encoding $tclencoding\n     }\n     filerun $fd [list getcommitlines $fd $i $view 0]\n     nowbusy $view [mc \"Reading\"]\n@@ -444,13 +444,13 @@ proc stop_instance {inst} {\n \n     set fd $commfd($inst)\n     catch {\n-\tset pid [pid $fd]\n+        set pid [pid $fd]\n \n-\tif {$::tcl_platform(platform) eq {windows}} {\n-\t    exec taskkill /pid $pid\n-\t} else {\n-\t    exec kill $pid\n-\t}\n+        if {$::tcl_platform(platform) eq {windows}} {\n+            exec taskkill /pid $pid\n+        } else {\n+            exec kill $pid\n+        }\n     }\n     catch {close $fd}\n     nukefile $fd\n@@ -462,7 +462,7 @@ proc stop_backends {} {\n     global commfd\n \n     foreach inst [array names commfd] {\n-\tstop_instance $inst\n+        stop_instance $inst\n     }\n }\n \n@@ -470,7 +470,7 @@ proc stop_rev_list {view} {\n     global viewinstances\n \n     foreach inst $viewinstances($view) {\n-\tstop_instance $inst\n+        stop_instance $inst\n     }\n     set viewinstances($view) {}\n }\n@@ -479,11 +479,11 @@ proc reset_pending_select {selid} {\n     global pending_select mainheadid selectheadid\n \n     if {$selid ne {}} {\n-\tset pending_select $selid\n+        set pending_select $selid\n     } elseif {$selectheadid ne {}} {\n-\tset pending_select $selectheadid\n+        set pending_select $selectheadid\n     } else {\n-\tset pending_select $mainheadid\n+        set pending_select $mainheadid\n     }\n }\n \n@@ -492,11 +492,11 @@ proc getcommits {selid} {\n \n     initlayout\n     if {[start_rev_list $curview]} {\n-\treset_pending_select $selid\n-\tshow_status [mc \"Reading commits...\"]\n-\tset need_redisplay 1\n+        reset_pending_select $selid\n+        show_status [mc \"Reading commits...\"]\n+        set need_redisplay 1\n     } else {\n-\tshow_status [mc \"No commits selected\"]\n+        show_status [mc \"No commits selected\"]\n     }\n }\n \n@@ -513,67 +513,67 @@ proc updatecommits {} {\n     rereadrefs\n     set view $curview\n     if {$mainheadid ne $viewmainheadid_orig($view)} {\n-\tif {$showlocalchanges} {\n-\t    dohidelocalchanges\n-\t}\n-\tset viewmainheadid($view) $mainheadid\n-\tset viewmainheadid_orig($view) $mainheadid\n-\tif {$vfilelimit($view) ne {}} {\n-\t    get_viewmainhead $view\n-\t}\n+        if {$showlocalchanges} {\n+            dohidelocalchanges\n+        }\n+        set viewmainheadid($view) $mainheadid\n+        set viewmainheadid_orig($view) $mainheadid\n+        if {$vfilelimit($view) ne {}} {\n+            get_viewmainhead $view\n+        }\n     }\n     if {$showlocalchanges} {\n-\tdoshowlocalchanges\n+        doshowlocalchanges\n     }\n     if {$vcanopt($view)} {\n-\tset oldpos $vposids($view)\n-\tset oldneg $vnegids($view)\n-\tset revs [parseviewrevs $view $vrevs($view)]\n-\tif {$revs eq {}} {\n-\t    return\n-\t}\n-\t# note: getting the delta when negative refs change is hard,\n-\t# and could require multiple git log invocations, so in that\n-\t# case we ask git log for all the commits (not just the delta)\n-\tif {$oldneg eq $vnegids($view)} {\n-\t    set newrevs {}\n-\t    set npos 0\n-\t    # take out positive refs that we asked for before or\n-\t    # that we have already seen\n-\t    foreach rev $revs {\n-\t\tif {[string length $rev] == 40} {\n-\t\t    if {[lsearch -exact $oldpos $rev] < 0\n-\t\t\t&& ![info exists varcid($view,$rev)]} {\n-\t\t\tlappend newrevs $rev\n-\t\t\tincr npos\n-\t\t    }\n-\t\t} else {\n-\t\t    lappend $newrevs $rev\n-\t\t}\n-\t    }\n-\t    if {$npos == 0} return\n-\t    set revs $newrevs\n-\t    set vposids($view) [lsort -unique [concat $oldpos $vposids($view)]]\n-\t}\n-\tset args [concat $vflags($view) $revs --not $oldpos]\n+        set oldpos $vposids($view)\n+        set oldneg $vnegids($view)\n+        set revs [parseviewrevs $view $vrevs($view)]\n+        if {$revs eq {}} {\n+            return\n+        }\n+        # note: getting the delta when negative refs change is hard,\n+        # and could require multiple git log invocations, so in that\n+        # case we ask git log for all the commits (not just the delta)\n+        if {$oldneg eq $vnegids($view)} {\n+            set newrevs {}\n+            set npos 0\n+            # take out positive refs that we asked for before or\n+            # that we have already seen\n+            foreach rev $revs {\n+                if {[string length $rev] == 40} {\n+                    if {[lsearch -exact $oldpos $rev] < 0\n+                        && ![info exists varcid($view,$rev)]} {\n+                        lappend newrevs $rev\n+                        incr npos\n+                    }\n+                } else {\n+                    lappend $newrevs $rev\n+                }\n+            }\n+            if {$npos == 0} return\n+            set revs $newrevs\n+            set vposids($view) [lsort -unique [concat $oldpos $vposids($view)]]\n+        }\n+        set args [concat $vflags($view) $revs --not $oldpos]\n     } else {\n-\tset args $vorigargs($view)\n+        set args $vorigargs($view)\n     }\n     if {[catch {\n-\tset fd [open [concat | git log --no-color -z --pretty=raw $show_notes \\\n-\t\t\t--parents --boundary $args \"--\" $vfilelimit($view)] r]\n+        set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \\\n+                        --parents --boundary $args \"--\" $vfilelimit($view)] r]\n     } err]} {\n-\terror_popup \"[mc \"Error executing git log:\"] $err\"\n-\treturn\n+        error_popup \"[mc \"Error executing git log:\"] $err\"\n+        return\n     }\n     if {$viewactive($view) == 0} {\n-\tset startmsecs [clock clicks -milliseconds]\n+        set startmsecs [clock clicks -milliseconds]\n     }\n     set i [reg_instance $fd]\n     lappend viewinstances($view) $i\n     fconfigure $fd -blocking 0 -translation lf -eofchar {}\n     if {$tclencoding != {}} {\n-\tfconfigure $fd -encoding $tclencoding\n+        fconfigure $fd -encoding $tclencoding\n     }\n     filerun $fd [list getcommitlines $fd $i $view 1]\n     incr viewactive($view)\n@@ -581,7 +581,7 @@ proc updatecommits {} {\n     reset_pending_select {}\n     nowbusy $view [mc \"Reading\"]\n     if {$showneartags} {\n-\tgetallcommits\n+        getallcommits\n     }\n }\n \n@@ -592,11 +592,11 @@ proc reloadcommits {} {\n \n     set selid {}\n     if {$selectedline ne {}} {\n-\tset selid $currentid\n+        set selid $currentid\n     }\n \n     if {!$viewcomplete($curview)} {\n-\tstop_rev_list $curview\n+        stop_rev_list $curview\n     }\n     resetvarcs $curview\n     set selectedline {}\n@@ -606,7 +606,7 @@ proc reloadcommits {} {\n     readrefs\n     changedrefs\n     if {$showneartags} {\n-\tgetallcommits\n+        getallcommits\n     }\n     clear_display\n     unset -nocomplain commitinfo\n@@ -622,11 +622,11 @@ proc reloadcommits {} {\n # sorts as a string in numerical order\n proc strrep {n} {\n     if {$n < 16} {\n-\treturn [format \"%x\" $n]\n+        return [format \"%x\" $n]\n     } elseif {$n < 256} {\n-\treturn [format \"x%.2x\" $n]\n+        return [format \"x%.2x\" $n]\n     } elseif {$n < 65536} {\n-\treturn [format \"y%.4x\" $n]\n+        return [format \"y%.4x\" $n]\n     }\n     return [format \"z%.8x\" $n]\n }\n@@ -657,22 +657,22 @@ proc resetvarcs {view} {\n     global vshortids\n \n     foreach vid [array names varcid $view,*] {\n-\tunset varcid($vid)\n-\tunset children($vid)\n-\tunset parents($vid)\n+        unset varcid($vid)\n+        unset children($vid)\n+        unset parents($vid)\n     }\n     foreach vid [array names vshortids $view,*] {\n-\tunset vshortids($vid)\n+        unset vshortids($vid)\n     }\n     # some commits might have children but haven't been seen yet\n     foreach vid [array names children $view,*] {\n-\tunset children($vid)\n+        unset children($vid)\n     }\n     foreach va [array names varccommits $view,*] {\n-\tunset varccommits($va)\n+        unset varccommits($va)\n     }\n     foreach vd [array names vseedcount $view,*] {\n-\tunset vseedcount($vd)\n+        unset vseedcount($vd)\n     }\n     unset -nocomplain ordertok\n }\n@@ -684,8 +684,8 @@ proc seeds {v} {\n     set ret {}\n     set a [lindex $vdownptr($v) 0]\n     while {$a != 0} {\n-\tlappend ret [lindex $varcstart($v) $a]\n-\tset a [lindex $vleftptr($v) $a]\n+        lappend ret [lindex $varcstart($v) $a]\n+        set a [lindex $vleftptr($v) $a]\n     }\n     return $ret\n }\n@@ -698,60 +698,60 @@ proc newvarc {view id} {\n     set a [llength $varctok($view)]\n     set vid $view,$id\n     if {[llength $children($vid)] == 0 || $vdatemode($view)} {\n-\tif {![info exists commitinfo($id)]} {\n-\t    parsecommit $id $commitdata($id) 1\n-\t}\n-\tset cdate [lindex [lindex $commitinfo($id) 4] 0]\n-\tif {![string is integer -strict $cdate]} {\n-\t    set cdate 0\n-\t}\n-\tif {![info exists vseedcount($view,$cdate)]} {\n-\t    set vseedcount($view,$cdate) -1\n-\t}\n-\tset c [incr vseedcount($view,$cdate)]\n-\tset cdate [expr {$cdate ^ 0xffffffff}]\n-\tset tok \"s[strrep $cdate][strrep $c]\"\n+        if {![info exists commitinfo($id)]} {\n+            parsecommit $id $commitdata($id) 1\n+        }\n+        set cdate [lindex [lindex $commitinfo($id) 4] 0]\n+        if {![string is integer -strict $cdate]} {\n+            set cdate 0\n+        }\n+        if {![info exists vseedcount($view,$cdate)]} {\n+            set vseedcount($view,$cdate) -1\n+        }\n+        set c [incr vseedcount($view,$cdate)]\n+        set cdate [expr {$cdate ^ 0xffffffff}]\n+        set tok \"s[strrep $cdate][strrep $c]\"\n     } else {\n-\tset tok {}\n+        set tok {}\n     }\n     set ka 0\n     if {[llength $children($vid)] > 0} {\n-\tset kid [lindex $children($vid) end]\n-\tset k $varcid($view,$kid)\n-\tif {[string compare [lindex $varctok($view) $k] $tok] > 0} {\n-\t    set ki $kid\n-\t    set ka $k\n-\t    set tok [lindex $varctok($view) $k]\n-\t}\n+        set kid [lindex $children($vid) end]\n+        set k $varcid($view,$kid)\n+        if {[string compare [lindex $varctok($view) $k] $tok] > 0} {\n+            set ki $kid\n+            set ka $k\n+            set tok [lindex $varctok($view) $k]\n+        }\n     }\n     if {$ka != 0} {\n-\tset i [lsearch -exact $parents($view,$ki) $id]\n-\tset j [expr {[llength $parents($view,$ki)] - 1 - $i}]\n-\tappend tok [strrep $j]\n+        set i [lsearch -exact $parents($view,$ki) $id]\n+        set j [expr {[llength $parents($view,$ki)] - 1 - $i}]\n+        append tok [strrep $j]\n     }\n     set c [lindex $vlastins($view) $ka]\n     if {$c == 0 || [string compare $tok [lindex $varctok($view) $c]] < 0} {\n-\tset c $ka\n-\tset b [lindex $vdownptr($view) $ka]\n+        set c $ka\n+        set b [lindex $vdownptr($view) $ka]\n     } else {\n-\tset b [lindex $vleftptr($view) $c]\n+        set b [lindex $vleftptr($view) $c]\n     }\n     while {$b != 0 && [string compare $tok [lindex $varctok($view) $b]] >= 0} {\n-\tset c $b\n-\tset b [lindex $vleftptr($view) $c]\n+        set c $b\n+        set b [lindex $vleftptr($view) $c]\n     }\n     if {$c == $ka} {\n-\tlset vdownptr($view) $ka $a\n-\tlappend vbackptr($view) 0\n+        lset vdownptr($view) $ka $a\n+        lappend vbackptr($view) 0\n     } else {\n-\tlset vleftptr($view) $c $a\n-\tlappend vbackptr($view) $c\n+        lset vleftptr($view) $c $a\n+        lappend vbackptr($view) $c\n     }\n     lset vlastins($view) $ka $a\n     lappend vupptr($view) $ka\n     lappend vleftptr($view) $b\n     if {$b != 0} {\n-\tlset vbackptr($view) $b $a\n+        lset vbackptr($view) $b $a\n     }\n     lappend varctok($view) $tok\n     lappend varcstart($view) $id\n@@ -782,7 +782,7 @@ proc splitvarc {p v} {\n     set varccommits($v,$na) [lrange $ac $i end]\n     lappend varcstart($v) $p\n     foreach id $varccommits($v,$na) {\n-\tset varcid($v,$id) $na\n+        set varcid($v,$id) $na\n     }\n     lappend vdownptr($v) [lindex $vdownptr($v) $oa]\n     lappend vlastins($v) [lindex $vlastins($v) $oa]\n@@ -792,10 +792,10 @@ proc splitvarc {p v} {\n     lappend vleftptr($v) 0\n     lappend vbackptr($v) 0\n     for {set b [lindex $vdownptr($v) $na]} {$b != 0} {set b [lindex $vleftptr($v) $b]} {\n-\tlset vupptr($v) $b $na\n+        lset vupptr($v) $b $na\n     }\n     if {[string compare $otok $vtokmod($v)] <= 0} {\n-\tmodify_arc $v $oa\n+        modify_arc $v $oa\n     }\n }\n \n@@ -809,120 +809,120 @@ proc renumbervarc {a v} {\n     set kidchanged($a) 1\n     set ntot 0\n     while {$a != 0} {\n-\tif {[info exists isrelated($a)]} {\n-\t    lappend todo $a\n-\t    set id [lindex $varccommits($v,$a) end]\n-\t    foreach p $parents($v,$id) {\n-\t\tif {[info exists varcid($v,$p)]} {\n-\t\t    set isrelated($varcid($v,$p)) 1\n-\t\t}\n-\t    }\n-\t}\n-\tincr ntot\n-\tset b [lindex $vdownptr($v) $a]\n-\tif {$b == 0} {\n-\t    while {$a != 0} {\n-\t\tset b [lindex $vleftptr($v) $a]\n-\t\tif {$b != 0} break\n-\t\tset a [lindex $vupptr($v) $a]\n-\t    }\n-\t}\n-\tset a $b\n+        if {[info exists isrelated($a)]} {\n+            lappend todo $a\n+            set id [lindex $varccommits($v,$a) end]\n+            foreach p $parents($v,$id) {\n+                if {[info exists varcid($v,$p)]} {\n+                    set isrelated($varcid($v,$p)) 1\n+                }\n+            }\n+        }\n+        incr ntot\n+        set b [lindex $vdownptr($v) $a]\n+        if {$b == 0} {\n+            while {$a != 0} {\n+                set b [lindex $vleftptr($v) $a]\n+                if {$b != 0} break\n+                set a [lindex $vupptr($v) $a]\n+            }\n+        }\n+        set a $b\n     }\n     foreach a $todo {\n-\tif {![info exists kidchanged($a)]} continue\n-\tset id [lindex $varcstart($v) $a]\n-\tif {[llength $children($v,$id)] > 1} {\n-\t    set children($v,$id) [lsort -command [list vtokcmp $v] \\\n-\t\t\t\t      $children($v,$id)]\n-\t}\n-\tset oldtok [lindex $varctok($v) $a]\n-\tif {!$vdatemode($v)} {\n-\t    set tok {}\n-\t} else {\n-\t    set tok $oldtok\n-\t}\n-\tset ka 0\n-\tset kid [last_real_child $v,$id]\n-\tif {$kid ne {}} {\n-\t    set k $varcid($v,$kid)\n-\t    if {[string compare [lindex $varctok($v) $k] $tok] > 0} {\n-\t\tset ki $kid\n-\t\tset ka $k\n-\t\tset tok [lindex $varctok($v) $k]\n-\t    }\n-\t}\n-\tif {$ka != 0} {\n-\t    set i [lsearch -exact $parents($v,$ki) $id]\n-\t    set j [expr {[llength $parents($v,$ki)] - 1 - $i}]\n-\t    append tok [strrep $j]\n-\t}\n-\tif {$tok eq $oldtok} {\n-\t    continue\n-\t}\n-\tset id [lindex $varccommits($v,$a) end]\n-\tforeach p $parents($v,$id) {\n-\t    if {[info exists varcid($v,$p)]} {\n-\t\tset kidchanged($varcid($v,$p)) 1\n-\t    } else {\n-\t\tset sortkids($p) 1\n-\t    }\n-\t}\n-\tlset varctok($v) $a $tok\n-\tset b [lindex $vupptr($v) $a]\n-\tif {$b != $ka} {\n-\t    if {[string compare [lindex $varctok($v) $ka] $vtokmod($v)] < 0} {\n-\t\tmodify_arc $v $ka\n-\t    }\n-\t    if {[string compare [lindex $varctok($v) $b] $vtokmod($v)] < 0} {\n-\t\tmodify_arc $v $b\n-\t    }\n-\t    set c [lindex $vbackptr($v) $a]\n-\t    set d [lindex $vleftptr($v) $a]\n-\t    if {$c == 0} {\n-\t\tlset vdownptr($v) $b $d\n-\t    } else {\n-\t\tlset vleftptr($v) $c $d\n-\t    }\n-\t    if {$d != 0} {\n-\t\tlset vbackptr($v) $d $c\n-\t    }\n-\t    if {[lindex $vlastins($v) $b] == $a} {\n-\t\tlset vlastins($v) $b $c\n-\t    }\n-\t    lset vupptr($v) $a $ka\n-\t    set c [lindex $vlastins($v) $ka]\n-\t    if {$c == 0 || \\\n-\t\t    [string compare $tok [lindex $varctok($v) $c]] < 0} {\n-\t\tset c $ka\n-\t\tset b [lindex $vdownptr($v) $ka]\n-\t    } else {\n-\t\tset b [lindex $vleftptr($v) $c]\n-\t    }\n-\t    while {$b != 0 && \\\n-\t\t      [string compare $tok [lindex $varctok($v) $b]] >= 0} {\n-\t\tset c $b\n-\t\tset b [lindex $vleftptr($v) $c]\n-\t    }\n-\t    if {$c == $ka} {\n- \t\tlset vdownptr($v) $ka $a\n-\t\tlset vbackptr($v) $a 0\n-\t    } else {\n-\t\tlset vleftptr($v) $c $a\n-\t\tlset vbackptr($v) $a $c\n-\t    }\n-\t    lset vleftptr($v) $a $b\n-\t    if {$b != 0} {\n-\t\tlset vbackptr($v) $b $a\n-\t    }\n-\t    lset vlastins($v) $ka $a\n-\t}\n+        if {![info exists kidchanged($a)]} continue\n+        set id [lindex $varcstart($v) $a]\n+        if {[llength $children($v,$id)] > 1} {\n+            set children($v,$id) [lsort -command [list vtokcmp $v] \\\n+                                      $children($v,$id)]\n+        }\n+        set oldtok [lindex $varctok($v) $a]\n+        if {!$vdatemode($v)} {\n+            set tok {}\n+        } else {\n+            set tok $oldtok\n+        }\n+        set ka 0\n+        set kid [last_real_child $v,$id]\n+        if {$kid ne {}} {\n+            set k $varcid($v,$kid)\n+            if {[string compare [lindex $varctok($v) $k] $tok] > 0} {\n+                set ki $kid\n+                set ka $k\n+                set tok [lindex $varctok($v) $k]\n+            }\n+        }\n+        if {$ka != 0} {\n+            set i [lsearch -exact $parents($v,$ki) $id]\n+            set j [expr {[llength $parents($v,$ki)] - 1 - $i}]\n+            append tok [strrep $j]\n+        }\n+        if {$tok eq $oldtok} {\n+            continue\n+        }\n+        set id [lindex $varccommits($v,$a) end]\n+        foreach p $parents($v,$id) {\n+            if {[info exists varcid($v,$p)]} {\n+                set kidchanged($varcid($v,$p)) 1\n+            } else {\n+                set sortkids($p) 1\n+            }\n+        }\n+        lset varctok($v) $a $tok\n+        set b [lindex $vupptr($v) $a]\n+        if {$b != $ka} {\n+            if {[string compare [lindex $varctok($v) $ka] $vtokmod($v)] < 0} {\n+                modify_arc $v $ka\n+            }\n+            if {[string compare [lindex $varctok($v) $b] $vtokmod($v)] < 0} {\n+                modify_arc $v $b\n+            }\n+            set c [lindex $vbackptr($v) $a]\n+            set d [lindex $vleftptr($v) $a]\n+            if {$c == 0} {\n+                lset vdownptr($v) $b $d\n+            } else {\n+                lset vleftptr($v) $c $d\n+            }\n+            if {$d != 0} {\n+                lset vbackptr($v) $d $c\n+            }\n+            if {[lindex $vlastins($v) $b] == $a} {\n+                lset vlastins($v) $b $c\n+            }\n+            lset vupptr($v) $a $ka\n+            set c [lindex $vlastins($v) $ka]\n+            if {$c == 0 || \\\n+                    [string compare $tok [lindex $varctok($v) $c]] < 0} {\n+                set c $ka\n+                set b [lindex $vdownptr($v) $ka]\n+            } else {\n+                set b [lindex $vleftptr($v) $c]\n+            }\n+            while {$b != 0 && \\\n+                      [string compare $tok [lindex $varctok($v) $b]] >= 0} {\n+                set c $b\n+                set b [lindex $vleftptr($v) $c]\n+            }\n+            if {$c == $ka} {\n+                lset vdownptr($v) $ka $a\n+                lset vbackptr($v) $a 0\n+            } else {\n+                lset vleftptr($v) $c $a\n+                lset vbackptr($v) $a $c\n+            }\n+            lset vleftptr($v) $a $b\n+            if {$b != 0} {\n+                lset vbackptr($v) $b $a\n+            }\n+            lset vlastins($v) $ka $a\n+        }\n     }\n     foreach id [array names sortkids] {\n-\tif {[llength $children($v,$id)] > 1} {\n-\t    set children($v,$id) [lsort -command [list vtokcmp $v] \\\n-\t\t\t\t      $children($v,$id)]\n-\t}\n+        if {[llength $children($v,$id)] > 1} {\n+            set children($v,$id) [lsort -command [list vtokcmp $v] \\\n+                                      $children($v,$id)]\n+        }\n     }\n     set t2 [clock clicks -milliseconds]\n     #puts \"renumbervarc did [llength $todo] of $ntot arcs in [expr {$t2-$t1}]ms\"\n@@ -936,14 +936,14 @@ proc fix_reversal {p a v} {\n \n     set pa $varcid($v,$p)\n     if {$p ne [lindex $varcstart($v) $pa]} {\n-\tsplitvarc $p $v\n-\tset pa $varcid($v,$p)\n+        splitvarc $p $v\n+        set pa $varcid($v,$p)\n     }\n     # seeds always need to be renumbered\n     if {[lindex $vupptr($v) $pa] == 0 ||\n-\t[string compare [lindex $varctok($v) $a] \\\n-\t     [lindex $varctok($v) $pa]] > 0} {\n-\trenumbervarc $pa $v\n+        [string compare [lindex $varctok($v) $a] \\\n+             [lindex $varctok($v) $pa]] > 0} {\n+        renumbervarc $pa $v\n     }\n }\n \n@@ -961,24 +961,24 @@ proc insertrow {id p v} {\n     set varcid($vid) $a\n     lappend vshortids($v,[string range $id 0 3]) $id\n     if {[string compare [lindex $varctok($v) $a] $vtokmod($v)] < 0} {\n-\tmodify_arc $v $a\n+        modify_arc $v $a\n     }\n     lappend varccommits($v,$a) $id\n     set vp $v,$p\n     if {[llength [lappend children($vp) $id]] > 1} {\n-\tset children($vp) [lsort -command [list vtokcmp $v] $children($vp)]\n-\tunset -nocomplain ordertok\n+        set children($vp) [lsort -command [list vtokcmp $v] $children($vp)]\n+        unset -nocomplain ordertok\n     }\n     fix_reversal $p $a $v\n     incr commitidx($v)\n     if {$v == $curview} {\n-\tset numcommits $commitidx($v)\n-\tsetcanvscroll\n-\tif {[info exists targetid]} {\n-\t    if {![comes_before $targetid $p]} {\n-\t\tincr targetrow\n-\t    }\n-\t}\n+        set numcommits $commitidx($v)\n+        setcanvscroll\n+        if {[info exists targetid]} {\n+            if {![comes_before $targetid $p]} {\n+                incr targetrow\n+            }\n+        }\n     }\n }\n \n@@ -990,8 +990,8 @@ proc insertfakerow {id p} {\n     set a $varcid($v,$p)\n     set i [lsearch -exact $varccommits($v,$a) $p]\n     if {$i < 0} {\n-\tputs \"oops: insertfakerow can't find [shortids $p] on arc $a\"\n-\treturn\n+        puts \"oops: insertfakerow can't find [shortids $p] on arc $a\"\n+        return\n     }\n     set children($v,$id) {}\n     set parents($v,$id) [list $p]\n@@ -1003,9 +1003,9 @@ proc insertfakerow {id p} {\n     set varccommits($v,$a) [linsert $varccommits($v,$a) $i $id]\n     modify_arc $v $a $i\n     if {[info exists targetid]} {\n-\tif {![comes_before $targetid $p]} {\n-\t    incr targetrow\n-\t}\n+        if {![comes_before $targetid $p]} {\n+            incr targetrow\n+        }\n     }\n     setcanvscroll\n     drawvisible\n@@ -1018,15 +1018,15 @@ proc removefakerow {id} {\n \n     set v $curview\n     if {[llength $parents($v,$id)] != 1} {\n-\tputs \"oops: removefakerow [shortids $id] has [llength $parents($v,$id)] parents\"\n-\treturn\n+        puts \"oops: removefakerow [shortids $id] has [llength $parents($v,$id)] parents\"\n+        return\n     }\n     set p [lindex $parents($v,$id) 0]\n     set a $varcid($v,$id)\n     set i [lsearch -exact $varccommits($v,$a) $id]\n     if {$i < 0} {\n-\tputs \"oops: removefakerow can't find [shortids $id] on arc $a\"\n-\treturn\n+        puts \"oops: removefakerow can't find [shortids $id] on arc $a\"\n+        return\n     }\n     unset varcid($v,$id)\n     set varccommits($v,$a) [lreplace $varccommits($v,$a) $i $i]\n@@ -1036,15 +1036,15 @@ proc removefakerow {id} {\n     set numcommits [incr commitidx($v) -1]\n     set j [lsearch -exact $children($v,$p) $id]\n     if {$j >= 0} {\n-\tset children($v,$p) [lreplace $children($v,$p) $j $j]\n+        set children($v,$p) [lreplace $children($v,$p) $j $j]\n     }\n     modify_arc $v $a $i\n     if {[info exist currentid] && $id eq $currentid} {\n-\tunset currentid\n-\tset selectedline {}\n+        unset currentid\n+        set selectedline {}\n     }\n     if {[info exists targetid] && $targetid eq $id} {\n-\tset targetid $p\n+        set targetid $p\n     }\n     setcanvscroll\n     drawvisible\n@@ -1055,9 +1055,9 @@ proc real_children {vp} {\n \n     set kids {}\n     foreach id $children($vp) {\n-\tif {$id ne $nullid && $id ne $nullid2} {\n-\t    lappend kids $id\n-\t}\n+        if {$id ne $nullid && $id ne $nullid2} {\n+            lappend kids $id\n+        }\n     }\n     return $kids\n }\n@@ -1066,9 +1066,9 @@ proc first_real_child {vp} {\n     global children nullid nullid2\n \n     foreach id $children($vp) {\n-\tif {$id ne $nullid && $id ne $nullid2} {\n-\t    return $id\n-\t}\n+        if {$id ne $nullid && $id ne $nullid2} {\n+            return $id\n+        }\n     }\n     return {}\n }\n@@ -1078,10 +1078,10 @@ proc last_real_child {vp} {\n \n     set kids $children($vp)\n     for {set i [llength $kids]} {[incr i -1] >= 0} {} {\n-\tset id [lindex $kids $i]\n-\tif {$id ne $nullid && $id ne $nullid2} {\n-\t    return $id\n-\t}\n+        set id [lindex $kids $i]\n+        if {$id ne $nullid && $id ne $nullid2} {\n+            return $id\n+        }\n     }\n     return {}\n }\n@@ -1090,7 +1090,7 @@ proc vtokcmp {v a b} {\n     global varctok varcid\n \n     return [string compare [lindex $varctok($v) $varcid($v,$a)] \\\n-\t\t[lindex $varctok($v) $varcid($v,$b)]]\n+                [lindex $varctok($v) $varcid($v,$b)]]\n }\n \n # This assumes that if lim is not given, the caller has checked that\n@@ -1099,29 +1099,29 @@ proc modify_arc {v a {lim {}}} {\n     global varctok vtokmod varcmod varcrow vupptr curview vrowmod varccommits\n \n     if {$lim ne {}} {\n-\tset c [string compare [lindex $varctok($v) $a] $vtokmod($v)]\n-\tif {$c > 0} return\n-\tif {$c == 0} {\n-\t    set r [lindex $varcrow($v) $a]\n-\t    if {$r ne {} && $vrowmod($v) <= $r + $lim} return\n-\t}\n+        set c [string compare [lindex $varctok($v) $a] $vtokmod($v)]\n+        if {$c > 0} return\n+        if {$c == 0} {\n+            set r [lindex $varcrow($v) $a]\n+            if {$r ne {} && $vrowmod($v) <= $r + $lim} return\n+        }\n     }\n     set vtokmod($v) [lindex $varctok($v) $a]\n     set varcmod($v) $a\n     if {$v == $curview} {\n-\twhile {$a != 0 && [lindex $varcrow($v) $a] eq {}} {\n-\t    set a [lindex $vupptr($v) $a]\n-\t    set lim {}\n-\t}\n-\tset r 0\n-\tif {$a != 0} {\n-\t    if {$lim eq {}} {\n-\t\tset lim [llength $varccommits($v,$a)]\n-\t    }\n-\t    set r [expr {[lindex $varcrow($v) $a] + $lim}]\n-\t}\n-\tset vrowmod($v) $r\n-\tundolayout $r\n+        while {$a != 0 && [lindex $varcrow($v) $a] eq {}} {\n+            set a [lindex $vupptr($v) $a]\n+            set lim {}\n+        }\n+        set r 0\n+        if {$a != 0} {\n+            if {$lim eq {}} {\n+                set lim [llength $varccommits($v,$a)]\n+            }\n+            set r [expr {[lindex $varcrow($v) $a] + $lim}]\n+        }\n+        set vrowmod($v) $r\n+        undolayout $r\n     }\n }\n \n@@ -1133,62 +1133,62 @@ proc update_arcrows {v} {\n \n     if {$vrowmod($v) == $commitidx($v)} return\n     if {$v == $curview} {\n-\tif {[llength $displayorder] > $vrowmod($v)} {\n-\t    set displayorder [lrange $displayorder 0 [expr {$vrowmod($v) - 1}]]\n-\t    set parentlist [lrange $parentlist 0 [expr {$vrowmod($v) - 1}]]\n-\t}\n-\tunset -nocomplain cached_commitrow\n+        if {[llength $displayorder] > $vrowmod($v)} {\n+            set displayorder [lrange $displayorder 0 [expr {$vrowmod($v) - 1}]]\n+            set parentlist [lrange $parentlist 0 [expr {$vrowmod($v) - 1}]]\n+        }\n+        unset -nocomplain cached_commitrow\n     }\n     set narctot [expr {[llength $varctok($v)] - 1}]\n     set a $varcmod($v)\n     while {$a != 0 && [lindex $varcix($v) $a] eq {}} {\n-\t# go up the tree until we find something that has a row number,\n-\t# or we get to a seed\n-\tset a [lindex $vupptr($v) $a]\n+        # go up the tree until we find something that has a row number,\n+        # or we get to a seed\n+        set a [lindex $vupptr($v) $a]\n     }\n     if {$a == 0} {\n-\tset a [lindex $vdownptr($v) 0]\n-\tif {$a == 0} return\n-\tset vrownum($v) {0}\n-\tset varcorder($v) [list $a]\n-\tlset varcix($v) $a 0\n-\tlset varcrow($v) $a 0\n-\tset arcn 0\n-\tset row 0\n+        set a [lindex $vdownptr($v) 0]\n+        if {$a == 0} return\n+        set vrownum($v) {0}\n+        set varcorder($v) [list $a]\n+        lset varcix($v) $a 0\n+        lset varcrow($v) $a 0\n+        set arcn 0\n+        set row 0\n     } else {\n-\tset arcn [lindex $varcix($v) $a]\n-\tif {[llength $vrownum($v)] > $arcn + 1} {\n-\t    set vrownum($v) [lrange $vrownum($v) 0 $arcn]\n-\t    set varcorder($v) [lrange $varcorder($v) 0 $arcn]\n-\t}\n-\tset row [lindex $varcrow($v) $a]\n+        set arcn [lindex $varcix($v) $a]\n+        if {[llength $vrownum($v)] > $arcn + 1} {\n+            set vrownum($v) [lrange $vrownum($v) 0 $arcn]\n+            set varcorder($v) [lrange $varcorder($v) 0 $arcn]\n+        }\n+        set row [lindex $varcrow($v) $a]\n     }\n     while {1} {\n-\tset p $a\n-\tincr row [llength $varccommits($v,$a)]\n-\t# go down if possible\n-\tset b [lindex $vdownptr($v) $a]\n-\tif {$b == 0} {\n-\t    # if not, go left, or go up until we can go left\n-\t    while {$a != 0} {\n-\t\tset b [lindex $vleftptr($v) $a]\n-\t\tif {$b != 0} break\n-\t\tset a [lindex $vupptr($v) $a]\n-\t    }\n-\t    if {$a == 0} break\n-\t}\n-\tset a $b\n-\tincr arcn\n-\tlappend vrownum($v) $row\n-\tlappend varcorder($v) $a\n-\tlset varcix($v) $a $arcn\n-\tlset varcrow($v) $a $row\n+        set p $a\n+        incr row [llength $varccommits($v,$a)]\n+        # go down if possible\n+        set b [lindex $vdownptr($v) $a]\n+        if {$b == 0} {\n+            # if not, go left, or go up until we can go left\n+            while {$a != 0} {\n+                set b [lindex $vleftptr($v) $a]\n+                if {$b != 0} break\n+                set a [lindex $vupptr($v) $a]\n+            }\n+            if {$a == 0} break\n+        }\n+        set a $b\n+        incr arcn\n+        lappend vrownum($v) $row\n+        lappend varcorder($v) $a\n+        lset varcix($v) $a $arcn\n+        lset varcrow($v) $a $row\n     }\n     set vtokmod($v) [lindex $varctok($v) $p]\n     set varcmod($v) $p\n     set vrowmod($v) $row\n     if {[info exists currentid]} {\n-\tset selectedline [rowofcommit $currentid]\n+        set selectedline [rowofcommit $currentid]\n     }\n }\n \n@@ -1206,20 +1206,20 @@ proc rowofcommit {id} {\n \n     set v $curview\n     if {![info exists varcid($v,$id)]} {\n-\tputs \"oops rowofcommit no arc for [shortids $id]\"\n-\treturn {}\n+        puts \"oops rowofcommit no arc for [shortids $id]\"\n+        return {}\n     }\n     set a $varcid($v,$id)\n     if {[string compare [lindex $varctok($v) $a] $vtokmod($v)] >= 0} {\n-\tupdate_arcrows $v\n+        update_arcrows $v\n     }\n     if {[info exists cached_commitrow($id)]} {\n-\treturn $cached_commitrow($id)\n+        return $cached_commitrow($id)\n     }\n     set i [lsearch -exact $varccommits($v,$a) $id]\n     if {$i < 0} {\n-\tputs \"oops didn't find commit [shortids $id] in arc $a\"\n-\treturn {}\n+        puts \"oops didn't find commit [shortids $id] in arc $a\"\n+        return {}\n     }\n     incr i [lindex $varcrow($v) $a]\n     set cached_commitrow($id) $i\n@@ -1232,32 +1232,32 @@ proc comes_before {a b} {\n \n     set v $curview\n     if {$a eq $b || ![info exists varcid($v,$a)] || \\\n-\t    ![info exists varcid($v,$b)]} {\n-\treturn 0\n+            ![info exists varcid($v,$b)]} {\n+        return 0\n     }\n     if {$varcid($v,$a) != $varcid($v,$b)} {\n-\treturn [expr {[string compare [lindex $varctok($v) $varcid($v,$a)] \\\n-\t\t\t   [lindex $varctok($v) $varcid($v,$b)]] < 0}]\n+        return [expr {[string compare [lindex $varctok($v) $varcid($v,$a)] \\\n+                           [lindex $varctok($v) $varcid($v,$b)]] < 0}]\n     }\n     return [expr {[rowofcommit $a] < [rowofcommit $b]}]\n }\n \n proc bsearch {l elt} {\n     if {[llength $l] == 0 || $elt <= [lindex $l 0]} {\n-\treturn 0\n+        return 0\n     }\n     set lo 0\n     set hi [llength $l]\n     while {$hi - $lo > 1} {\n-\tset mid [expr {int(($lo + $hi) / 2)}]\n-\tset t [lindex $l $mid]\n-\tif {$elt < $t} {\n-\t    set hi $mid\n-\t} elseif {$elt > $t} {\n-\t    set lo $mid\n-\t} else {\n-\t    return $mid\n-\t}\n+        set mid [expr {int(($lo + $hi) / 2)}]\n+        set t [lindex $l $mid]\n+        if {$elt < $t} {\n+            set hi $mid\n+        } elseif {$elt > $t} {\n+            set lo $mid\n+        } else {\n+            return $mid\n+        }\n     }\n     return $lo\n }\n@@ -1269,37 +1269,37 @@ proc make_disporder {start end} {\n     global d_valid_start d_valid_end\n \n     if {$end > $vrowmod($curview)} {\n-\tupdate_arcrows $curview\n+        update_arcrows $curview\n     }\n     set ai [bsearch $vrownum($curview) $start]\n     set start [lindex $vrownum($curview) $ai]\n     set narc [llength $vrownum($curview)]\n     for {set r $start} {$ai < $narc && $r < $end} {incr ai} {\n-\tset a [lindex $varcorder($curview) $ai]\n-\tset l [llength $displayorder]\n-\tset al [llength $varccommits($curview,$a)]\n-\tif {$l < $r + $al} {\n-\t    if {$l < $r} {\n-\t\tset pad [ntimes [expr {$r - $l}] {}]\n-\t\tset displayorder [concat $displayorder $pad]\n-\t\tset parentlist [concat $parentlist $pad]\n-\t    } elseif {$l > $r} {\n-\t\tset displayorder [lrange $displayorder 0 [expr {$r - 1}]]\n-\t\tset parentlist [lrange $parentlist 0 [expr {$r - 1}]]\n-\t    }\n-\t    foreach id $varccommits($curview,$a) {\n-\t\tlappend displayorder $id\n-\t\tlappend parentlist $parents($curview,$id)\n-\t    }\n-\t} elseif {[lindex $displayorder [expr {$r + $al - 1}]] eq {}} {\n-\t    set i $r\n-\t    foreach id $varccommits($curview,$a) {\n-\t\tlset displayorder $i $id\n-\t\tlset parentlist $i $parents($curview,$id)\n-\t\tincr i\n-\t    }\n-\t}\n-\tincr r $al\n+        set a [lindex $varcorder($curview) $ai]\n+        set l [llength $displayorder]\n+        set al [llength $varccommits($curview,$a)]\n+        if {$l < $r + $al} {\n+            if {$l < $r} {\n+                set pad [ntimes [expr {$r - $l}] {}]\n+                set displayorder [concat $displayorder $pad]\n+                set parentlist [concat $parentlist $pad]\n+            } elseif {$l > $r} {\n+                set displayorder [lrange $displayorder 0 [expr {$r - 1}]]\n+                set parentlist [lrange $parentlist 0 [expr {$r - 1}]]\n+            }\n+            foreach id $varccommits($curview,$a) {\n+                lappend displayorder $id\n+                lappend parentlist $parents($curview,$id)\n+            }\n+        } elseif {[lindex $displayorder [expr {$r + $al - 1}]] eq {}} {\n+            set i $r\n+            foreach id $varccommits($curview,$a) {\n+                lset displayorder $i $id\n+                lset parentlist $i $parents($curview,$id)\n+                incr i\n+            }\n+        }\n+        incr r $al\n     }\n }\n \n@@ -1308,8 +1308,8 @@ proc commitonrow {row} {\n \n     set id [lindex $displayorder $row]\n     if {$id eq {}} {\n-\tmake_disporder $row [expr {$row + 1}]\n-\tset id [lindex $displayorder $row]\n+        make_disporder $row [expr {$row + 1}]\n+        set id [lindex $displayorder $row]\n     }\n     return $id\n }\n@@ -1322,35 +1322,35 @@ proc closevarcs {v} {\n     set scripts {}\n     set narcs [llength $varctok($v)]\n     for {set a 1} {$a < $narcs} {incr a} {\n-\tset id [lindex $varccommits($v,$a) end]\n-\tforeach p $parents($v,$id) {\n-\t    if {[info exists varcid($v,$p)]} continue\n-\t    # add p as a new commit\n-\t    incr missing_parents\n-\t    set cmitlisted($v,$p) 0\n-\t    set parents($v,$p) {}\n-\t    if {[llength $children($v,$p)] == 1 &&\n-\t\t[llength $parents($v,$id)] == 1} {\n-\t\tset b $a\n-\t    } else {\n-\t\tset b [newvarc $v $p]\n-\t    }\n-\t    set varcid($v,$p) $b\n-\t    if {[string compare [lindex $varctok($v) $b] $vtokmod($v)] < 0} {\n-\t\tmodify_arc $v $b\n-\t    }\n-\t    lappend varccommits($v,$b) $p\n-\t    incr commitidx($v)\n-\t    if {$v == $curview} {\n-\t\tset numcommits $commitidx($v)\n-\t    }\n-\t    set scripts [check_interest $p $scripts]\n-\t}\n+        set id [lindex $varccommits($v,$a) end]\n+        foreach p $parents($v,$id) {\n+            if {[info exists varcid($v,$p)]} continue\n+            # add p as a new commit\n+            incr missing_parents\n+            set cmitlisted($v,$p) 0\n+            set parents($v,$p) {}\n+            if {[llength $children($v,$p)] == 1 &&\n+                [llength $parents($v,$id)] == 1} {\n+                set b $a\n+            } else {\n+                set b [newvarc $v $p]\n+            }\n+            set varcid($v,$p) $b\n+            if {[string compare [lindex $varctok($v) $b] $vtokmod($v)] < 0} {\n+                modify_arc $v $b\n+            }\n+            lappend varccommits($v,$b) $p\n+            incr commitidx($v)\n+            if {$v == $curview} {\n+                set numcommits $commitidx($v)\n+            }\n+            set scripts [check_interest $p $scripts]\n+        }\n     }\n     if {$missing_parents > 0} {\n-\tforeach s $scripts {\n-\t    eval $s\n-\t}\n+        foreach s $scripts {\n+            eval $s\n+        }\n     }\n }\n \n@@ -1360,23 +1360,23 @@ proc rewrite_commit {v id rwid} {\n     global children parents varcid varctok vtokmod varccommits\n \n     foreach ch $children($v,$id) {\n-\t# make $rwid be $ch's parent in place of $id\n-\tset i [lsearch -exact $parents($v,$ch) $id]\n-\tif {$i < 0} {\n-\t    puts \"oops rewrite_commit didn't find $id in parent list for $ch\"\n-\t}\n-\tset parents($v,$ch) [lreplace $parents($v,$ch) $i $i $rwid]\n-\t# add $ch to $rwid's children and sort the list if necessary\n-\tif {[llength [lappend children($v,$rwid) $ch]] > 1} {\n-\t    set children($v,$rwid) [lsort -command [list vtokcmp $v] \\\n-\t\t\t\t\t$children($v,$rwid)]\n-\t}\n-\t# fix the graph after joining $id to $rwid\n-\tset a $varcid($v,$ch)\n-\tfix_reversal $rwid $a $v\n-\t# parentlist is wrong for the last element of arc $a\n-\t# even if displayorder is right, hence the 3rd arg here\n-\tmodify_arc $v $a [expr {[llength $varccommits($v,$a)] - 1}]\n+        # make $rwid be $ch's parent in place of $id\n+        set i [lsearch -exact $parents($v,$ch) $id]\n+        if {$i < 0} {\n+            puts \"oops rewrite_commit didn't find $id in parent list for $ch\"\n+        }\n+        set parents($v,$ch) [lreplace $parents($v,$ch) $i $i $rwid]\n+        # add $ch to $rwid's children and sort the list if necessary\n+        if {[llength [lappend children($v,$rwid) $ch]] > 1} {\n+            set children($v,$rwid) [lsort -command [list vtokcmp $v] \\\n+                                        $children($v,$rwid)]\n+        }\n+        # fix the graph after joining $id to $rwid\n+        set a $varcid($v,$ch)\n+        fix_reversal $rwid $a $v\n+        # parentlist is wrong for the last element of arc $a\n+        # even if displayorder is right, hence the 3rd arg here\n+        modify_arc $v $a [expr {[llength $varccommits($v,$a)] - 1}]\n     }\n }\n \n@@ -1396,19 +1396,19 @@ proc check_interest {id scripts} {\n \n     set prefix [string range $id 0 3]\n     if {[info exists commitinterest($prefix)]} {\n-\tset newlist {}\n-\tforeach {i script} $commitinterest($prefix) {\n-\t    if {[string match \"$i*\" $id]} {\n-\t\tlappend scripts [string map [list \"%I\" $id \"%P\" $i] $script]\n-\t    } else {\n-\t\tlappend newlist $i $script\n-\t    }\n-\t}\n-\tif {$newlist ne {}} {\n-\t    set commitinterest($prefix) $newlist\n-\t} else {\n-\t    unset commitinterest($prefix)\n-\t}\n+        set newlist {}\n+        foreach {i script} $commitinterest($prefix) {\n+            if {[string match \"$i*\" $id]} {\n+                lappend scripts [string map [list \"%I\" $id \"%P\" $i] $script]\n+            } else {\n+                lappend newlist $i $script\n+            }\n+        }\n+        if {$newlist ne {}} {\n+            set commitinterest($prefix) $newlist\n+        } else {\n+            unset commitinterest($prefix)\n+        }\n     }\n     return $scripts\n }\n@@ -1423,192 +1423,192 @@ proc getcommitlines {fd inst view updating}  {\n     set stuff [read $fd 500000]\n     # git log doesn't terminate the last commit with a null...\n     if {$stuff == {} && $leftover($inst) ne {} && [eof $fd]} {\n-\tset stuff \"\\0\"\n+        set stuff \"\\0\"\n     }\n     if {$stuff == {}} {\n-\tif {![eof $fd]} {\n-\t    return 1\n-\t}\n-\tglobal commfd viewcomplete viewactive viewname\n-\tglobal viewinstances\n-\tunset commfd($inst)\n-\tset i [lsearch -exact $viewinstances($view) $inst]\n-\tif {$i >= 0} {\n-\t    set viewinstances($view) [lreplace $viewinstances($view) $i $i]\n-\t}\n-\t# set it blocking so we wait for the process to terminate\n-\tfconfigure $fd -blocking 1\n-\tif {[catch {close $fd} err]} {\n-\t    set fv {}\n-\t    if {$view != $curview} {\n-\t\tset fv \" for the \\\"$viewname($view)\\\" view\"\n-\t    }\n-\t    if {[string range $err 0 4] == \"usage\"} {\n-\t\tset err \"Gitk: error reading commits$fv:\\\n-\t\t\tbad arguments to git log.\"\n-\t\tif {$viewname($view) eq [mc \"Command line\"]} {\n-\t\t    append err \\\n-\t\t\t\"  (Note: arguments to gitk are passed to git log\\\n-\t\t\t to allow selection of commits to be displayed.)\"\n-\t\t}\n-\t    } else {\n-\t\tset err \"Error reading commits$fv: $err\"\n-\t    }\n-\t    error_popup $err\n-\t}\n-\tif {[incr viewactive($view) -1] <= 0} {\n-\t    set viewcomplete($view) 1\n-\t    # Check if we have seen any ids listed as parents that haven't\n-\t    # appeared in the list\n-\t    closevarcs $view\n-\t    notbusy $view\n-\t}\n-\tif {$view == $curview} {\n-\t    run chewcommits\n-\t}\n-\treturn 0\n+        if {![eof $fd]} {\n+            return 1\n+        }\n+        global commfd viewcomplete viewactive viewname\n+        global viewinstances\n+        unset commfd($inst)\n+        set i [lsearch -exact $viewinstances($view) $inst]\n+        if {$i >= 0} {\n+            set viewinstances($view) [lreplace $viewinstances($view) $i $i]\n+        }\n+        # set it blocking so we wait for the process to terminate\n+        fconfigure $fd -blocking 1\n+        if {[catch {close $fd} err]} {\n+            set fv {}\n+            if {$view != $curview} {\n+                set fv \" for the \\\"$viewname($view)\\\" view\"\n+            }\n+            if {[string range $err 0 4] == \"usage\"} {\n+                set err \"Gitk: error reading commits$fv:\\\n+                        bad arguments to git log.\"\n+                if {$viewname($view) eq [mc \"Command line\"]} {\n+                    append err \\\n+                        \"  (Note: arguments to gitk are passed to git log\\\n+                         to allow selection of commits to be displayed.)\"\n+                }\n+            } else {\n+                set err \"Error reading commits$fv: $err\"\n+            }\n+            error_popup $err\n+        }\n+        if {[incr viewactive($view) -1] <= 0} {\n+            set viewcomplete($view) 1\n+            # Check if we have seen any ids listed as parents that haven't\n+            # appeared in the list\n+            closevarcs $view\n+            notbusy $view\n+        }\n+        if {$view == $curview} {\n+            run chewcommits\n+        }\n+        return 0\n     }\n     set start 0\n     set gotsome 0\n     set scripts {}\n     while 1 {\n-\tset i [string first \"\\0\" $stuff $start]\n-\tif {$i < 0} {\n-\t    append leftover($inst) [string range $stuff $start end]\n-\t    break\n-\t}\n-\tif {$start == 0} {\n-\t    set cmit $leftover($inst)\n-\t    append cmit [string range $stuff 0 [expr {$i - 1}]]\n-\t    set leftover($inst) {}\n-\t} else {\n-\t    set cmit [string range $stuff $start [expr {$i - 1}]]\n-\t}\n-\tset start [expr {$i + 1}]\n-\tset j [string first \"\\n\" $cmit]\n-\tset ok 0\n-\tset listed 1\n-\tif {$j >= 0 && [string match \"commit *\" $cmit]} {\n-\t    set ids [string range $cmit 7 [expr {$j - 1}]]\n-\t    if {[string match {[-^<>]*} $ids]} {\n-\t\tswitch -- [string index $ids 0] {\n-\t\t    \"-\" {set listed 0}\n-\t\t    \"^\" {set listed 2}\n-\t\t    \"<\" {set listed 3}\n-\t\t    \">\" {set listed 4}\n-\t\t}\n-\t\tset ids [string range $ids 1 end]\n-\t    }\n-\t    set ok 1\n-\t    foreach id $ids {\n-\t\tif {[string length $id] != 40} {\n-\t\t    set ok 0\n-\t\t    break\n-\t\t}\n-\t    }\n-\t}\n-\tif {!$ok} {\n-\t    set shortcmit $cmit\n-\t    if {[string length $shortcmit] > 80} {\n-\t\tset shortcmit \"[string range $shortcmit 0 80]...\"\n-\t    }\n-\t    error_popup \"[mc \"Can't parse git log output:\"] {$shortcmit}\"\n-\t    exit 1\n-\t}\n-\tset id [lindex $ids 0]\n-\tset vid $view,$id\n+        set i [string first \"\\0\" $stuff $start]\n+        if {$i < 0} {\n+            append leftover($inst) [string range $stuff $start end]\n+            break\n+        }\n+        if {$start == 0} {\n+            set cmit $leftover($inst)\n+            append cmit [string range $stuff 0 [expr {$i - 1}]]\n+            set leftover($inst) {}\n+        } else {\n+            set cmit [string range $stuff $start [expr {$i - 1}]]\n+        }\n+        set start [expr {$i + 1}]\n+        set j [string first \"\\n\" $cmit]\n+        set ok 0\n+        set listed 1\n+        if {$j >= 0 && [string match \"commit *\" $cmit]} {\n+            set ids [string range $cmit 7 [expr {$j - 1}]]\n+            if {[string match {[-^<>]*} $ids]} {\n+                switch -- [string index $ids 0] {\n+                    \"-\" {set listed 0}\n+                    \"^\" {set listed 2}\n+                    \"<\" {set listed 3}\n+                    \">\" {set listed 4}\n+                }\n+                set ids [string range $ids 1 end]\n+            }\n+            set ok 1\n+            foreach id $ids {\n+                if {[string length $id] != 40} {\n+                    set ok 0\n+                    break\n+                }\n+            }\n+        }\n+        if {!$ok} {\n+            set shortcmit $cmit\n+            if {[string length $shortcmit] > 80} {\n+                set shortcmit \"[string range $shortcmit 0 80]...\"\n+            }\n+            error_popup \"[mc \"Can't parse git log output:\"] {$shortcmit}\"\n+            exit 1\n+        }\n+        set id [lindex $ids 0]\n+        set vid $view,$id\n \n-\tlappend vshortids($view,[string range $id 0 3]) $id\n+        lappend vshortids($view,[string range $id 0 3]) $id\n \n-\tif {!$listed && $updating && ![info exists varcid($vid)] &&\n-\t    $vfilelimit($view) ne {}} {\n-\t    # git log doesn't rewrite parents for unlisted commits\n-\t    # when doing path limiting, so work around that here\n-\t    # by working out the rewritten parent with git rev-list\n-\t    # and if we already know about it, using the rewritten\n-\t    # parent as a substitute parent for $id's children.\n-\t    if {![catch {\n-\t\tset rwid [exec git rev-list --first-parent --max-count=1 \\\n-\t\t\t      $id -- $vfilelimit($view)]\n-\t    }]} {\n-\t\tif {$rwid ne {} && [info exists varcid($view,$rwid)]} {\n-\t\t    # use $rwid in place of $id\n-\t\t    rewrite_commit $view $id $rwid\n-\t\t    continue\n-\t\t}\n-\t    }\n-\t}\n+        if {!$listed && $updating && ![info exists varcid($vid)] &&\n+            $vfilelimit($view) ne {}} {\n+            # git log doesn't rewrite parents for unlisted commits\n+            # when doing path limiting, so work around that here\n+            # by working out the rewritten parent with git rev-list\n+            # and if we already know about it, using the rewritten\n+            # parent as a substitute parent for $id's children.\n+            if {![catch {\n+                set rwid [exec git rev-list --first-parent --max-count=1 \\\n+                              $id -- $vfilelimit($view)]\n+            }]} {\n+                if {$rwid ne {} && [info exists varcid($view,$rwid)]} {\n+                    # use $rwid in place of $id\n+                    rewrite_commit $view $id $rwid\n+                    continue\n+                }\n+            }\n+        }\n \n-\tset a 0\n-\tif {[info exists varcid($vid)]} {\n-\t    if {$cmitlisted($vid) || !$listed} continue\n-\t    set a $varcid($vid)\n-\t}\n-\tif {$listed} {\n-\t    set olds [lrange $ids 1 end]\n-\t} else {\n-\t    set olds {}\n-\t}\n-\tset commitdata($id) [string range $cmit [expr {$j + 1}] end]\n-\tset cmitlisted($vid) $listed\n-\tset parents($vid) $olds\n-\tif {![info exists children($vid)]} {\n-\t    set children($vid) {}\n-\t} elseif {$a == 0 && [llength $children($vid)] == 1} {\n-\t    set k [lindex $children($vid) 0]\n-\t    if {[llength $parents($view,$k)] == 1 &&\n-\t\t(!$vdatemode($view) ||\n-\t\t $varcid($view,$k) == [llength $varctok($view)] - 1)} {\n-\t\tset a $varcid($view,$k)\n-\t    }\n-\t}\n-\tif {$a == 0} {\n-\t    # new arc\n-\t    set a [newvarc $view $id]\n-\t}\n-\tif {[string compare [lindex $varctok($view) $a] $vtokmod($view)] < 0} {\n-\t    modify_arc $view $a\n-\t}\n-\tif {![info exists varcid($vid)]} {\n-\t    set varcid($vid) $a\n-\t    lappend varccommits($view,$a) $id\n-\t    incr commitidx($view)\n-\t}\n+        set a 0\n+        if {[info exists varcid($vid)]} {\n+            if {$cmitlisted($vid) || !$listed} continue\n+            set a $varcid($vid)\n+        }\n+        if {$listed} {\n+            set olds [lrange $ids 1 end]\n+        } else {\n+            set olds {}\n+        }\n+        set commitdata($id) [string range $cmit [expr {$j + 1}] end]\n+        set cmitlisted($vid) $listed\n+        set parents($vid) $olds\n+        if {![info exists children($vid)]} {\n+            set children($vid) {}\n+        } elseif {$a == 0 && [llength $children($vid)] == 1} {\n+            set k [lindex $children($vid) 0]\n+            if {[llength $parents($view,$k)] == 1 &&\n+                (!$vdatemode($view) ||\n+                 $varcid($view,$k) == [llength $varctok($view)] - 1)} {\n+                set a $varcid($view,$k)\n+            }\n+        }\n+        if {$a == 0} {\n+            # new arc\n+            set a [newvarc $view $id]\n+        }\n+        if {[string compare [lindex $varctok($view) $a] $vtokmod($view)] < 0} {\n+            modify_arc $view $a\n+        }\n+        if {![info exists varcid($vid)]} {\n+            set varcid($vid) $a\n+            lappend varccommits($view,$a) $id\n+            incr commitidx($view)\n+        }\n \n-\tset i 0\n-\tforeach p $olds {\n-\t    if {$i == 0 || [lsearch -exact $olds $p] >= $i} {\n-\t\tset vp $view,$p\n-\t\tif {[llength [lappend children($vp) $id]] > 1 &&\n-\t\t    [vtokcmp $view [lindex $children($vp) end-1] $id] > 0} {\n-\t\t    set children($vp) [lsort -command [list vtokcmp $view] \\\n-\t\t\t\t\t   $children($vp)]\n-\t\t    unset -nocomplain ordertok\n-\t\t}\n-\t\tif {[info exists varcid($view,$p)]} {\n-\t\t    fix_reversal $p $a $view\n-\t\t}\n-\t    }\n-\t    incr i\n-\t}\n+        set i 0\n+        foreach p $olds {\n+            if {$i == 0 || [lsearch -exact $olds $p] >= $i} {\n+                set vp $view,$p\n+                if {[llength [lappend children($vp) $id]] > 1 &&\n+                    [vtokcmp $view [lindex $children($vp) end-1] $id] > 0} {\n+                    set children($vp) [lsort -command [list vtokcmp $view] \\\n+                                           $children($vp)]\n+                    unset -nocomplain ordertok\n+                }\n+                if {[info exists varcid($view,$p)]} {\n+                    fix_reversal $p $a $view\n+                }\n+            }\n+            incr i\n+        }\n \n-\tset scripts [check_interest $id $scripts]\n-\tset gotsome 1\n+        set scripts [check_interest $id $scripts]\n+        set gotsome 1\n     }\n     if {$gotsome} {\n-\tglobal numcommits hlview\n+        global numcommits hlview\n \n-\tif {$view == $curview} {\n-\t    set numcommits $commitidx($view)\n-\t    run chewcommits\n-\t}\n-\tif {[info exists hlview] && $view == $hlview} {\n-\t    # we never actually get here...\n-\t    run vhighlightmore\n-\t}\n-\tforeach s $scripts {\n-\t    eval $s\n-\t}\n+        if {$view == $curview} {\n+            set numcommits $commitidx($view)\n+            run chewcommits\n+        }\n+        if {[info exists hlview] && $view == $hlview} {\n+            # we never actually get here...\n+            run vhighlightmore\n+        }\n+        foreach s $scripts {\n+            eval $s\n+        }\n     }\n     return 2\n }\n@@ -1619,28 +1619,28 @@ proc chewcommits {} {\n \n     layoutmore\n     if {$viewcomplete($curview)} {\n-\tglobal commitidx varctok\n-\tglobal numcommits startmsecs\n+        global commitidx varctok\n+        global numcommits startmsecs\n \n-\tif {[info exists pending_select]} {\n-\t    update\n-\t    reset_pending_select {}\n+        if {[info exists pending_select]} {\n+            update\n+            reset_pending_select {}\n \n-\t    if {[commitinview $pending_select $curview]} {\n-\t\tselectline [rowofcommit $pending_select] 1\n-\t    } else {\n-\t\tset row [first_real_row]\n-\t\tselectline $row 1\n-\t    }\n-\t}\n-\tif {$commitidx($curview) > 0} {\n-\t    #set ms [expr {[clock clicks -milliseconds] - $startmsecs}]\n-\t    #puts \"overall $ms ms for $numcommits commits\"\n-\t    #puts \"[llength $varctok($view)] arcs, $commitidx($view) commits\"\n-\t} else {\n-\t    show_status [mc \"No commits selected\"]\n-\t}\n-\tnotbusy layout\n+            if {[commitinview $pending_select $curview]} {\n+                selectline [rowofcommit $pending_select] 1\n+            } else {\n+                set row [first_real_row]\n+                selectline $row 1\n+            }\n+        }\n+        if {$commitidx($curview) > 0} {\n+            #set ms [expr {[clock clicks -milliseconds] - $startmsecs}]\n+            #puts \"overall $ms ms for $numcommits commits\"\n+            #puts \"[llength $varctok($view)] arcs, $commitidx($view) commits\"\n+        } else {\n+            show_status [mc \"No commits selected\"]\n+        }\n+        notbusy layout\n     }\n     return 0\n }\n@@ -1653,7 +1653,7 @@ proc do_readcommit {id} {\n     # Read the results using i18n.logoutputencoding\n     fconfigure $fd -translation lf -eofchar {}\n     if {$tclencoding != {}} {\n-\tfconfigure $fd -encoding $tclencoding\n+        fconfigure $fd -encoding $tclencoding\n     }\n     set contents [read $fd]\n     close $fd\n@@ -1680,44 +1680,44 @@ proc parsecommit {id contents listed} {\n     set comdate {}\n     set hdrend [string first \"\\n\\n\" $contents]\n     if {$hdrend < 0} {\n-\t# should never happen...\n-\tset hdrend [string length $contents]\n+        # should never happen...\n+        set hdrend [string length $contents]\n     }\n     set header [string range $contents 0 [expr {$hdrend - 1}]]\n     set comment [string range $contents [expr {$hdrend + 2}] end]\n     foreach line [split $header \"\\n\"] {\n-\tset line [split $line \" \"]\n-\tset tag [lindex $line 0]\n-\tif {$tag == \"author\"} {\n-\t    set audate [lrange $line end-1 end]\n-\t    set auname [join [lrange $line 1 end-2] \" \"]\n-\t} elseif {$tag == \"committer\"} {\n-\t    set comdate [lrange $line end-1 end]\n-\t    set comname [join [lrange $line 1 end-2] \" \"]\n-\t}\n+        set line [split $line \" \"]\n+        set tag [lindex $line 0]\n+        if {$tag == \"author\"} {\n+            set audate [lrange $line end-1 end]\n+            set auname [join [lrange $line 1 end-2] \" \"]\n+        } elseif {$tag == \"committer\"} {\n+            set comdate [lrange $line end-1 end]\n+            set comname [join [lrange $line 1 end-2] \" \"]\n+        }\n     }\n     set headline {}\n     # take the first non-blank line of the comment as the headline\n     set headline [string trimleft $comment]\n     set i [string first \"\\n\" $headline]\n     if {$i >= 0} {\n-\tset headline [string range $headline 0 $i]\n+        set headline [string range $headline 0 $i]\n     }\n     set headline [string trimright $headline]\n     set i [string first \"\\r\" $headline]\n     if {$i >= 0} {\n-\tset headline [string trimright [string range $headline 0 $i]]\n+        set headline [string trimright [string range $headline 0 $i]]\n     }\n     if {!$listed} {\n-\t# git log indents the comment by 4 spaces;\n-\t# if we got this via git cat-file, add the indentation\n-\tset newcomment {}\n-\tforeach line [split $comment \"\\n\"] {\n-\t    append newcomment \"    \"\n-\t    append newcomment $line\n-\t    append newcomment \"\\n\"\n-\t}\n-\tset comment $newcomment\n+        # git log indents the comment by 4 spaces;\n+        # if we got this via git cat-file, add the indentation\n+        set newcomment {}\n+        foreach line [split $comment \"\\n\"] {\n+            append newcomment \"    \"\n+            append newcomment $line\n+            append newcomment \"\\n\"\n+        }\n+        set comment $newcomment\n     }\n     set hasnote [string first \"\\nNotes:\\n\" $contents]\n     set diff \"\"\n@@ -1726,23 +1726,23 @@ proc parsecommit {id contents listed} {\n     # diff.\n     set i [string first \"\\n\\ndiff\" $comment]\n     if {$i >= 0} {\n-\tset diff [string range $comment $i+1 end]\n-\tset comment [string range $comment 0 $i-1]\n+        set diff [string range $comment $i+1 end]\n+        set comment [string range $comment 0 $i-1]\n     }\n     set commitinfo($id) [list $headline $auname $audate \\\n-\t\t\t     $comname $comdate $comment $hasnote $diff]\n+                             $comname $comdate $comment $hasnote $diff]\n }\n \n proc getcommit {id} {\n     global commitdata commitinfo\n \n     if {[info exists commitdata($id)]} {\n-\tparsecommit $id $commitdata($id) 1\n+        parsecommit $id $commitdata($id) 1\n     } else {\n-\treadcommit $id\n-\tif {![info exists commitinfo($id)]} {\n-\t    set commitinfo($id) [list [mc \"No commit information available\"]]\n-\t}\n+        readcommit $id\n+        if {![info exists commitinfo($id)]} {\n+            set commitinfo($id) [list [mc \"No commit information available\"]]\n+        }\n     }\n     return 1\n }\n@@ -1755,22 +1755,22 @@ proc longid {prefix} {\n \n     set ids {}\n     if {[string length $prefix] >= 4} {\n-\tset vshortid $curview,[string range $prefix 0 3]\n-\tif {[info exists vshortids($vshortid)]} {\n-\t    foreach id $vshortids($vshortid) {\n-\t\tif {[string match \"$prefix*\" $id]} {\n-\t\t    if {[lsearch -exact $ids $id] < 0} {\n-\t\t\tlappend ids $id\n-\t\t\tif {[llength $ids] >= 2} break\n-\t\t    }\n-\t\t}\n-\t    }\n-\t}\n+        set vshortid $curview,[string range $prefix 0 3]\n+        if {[info exists vshortids($vshortid)]} {\n+            foreach id $vshortids($vshortid) {\n+                if {[string match \"$prefix*\" $id]} {\n+                    if {[lsearch -exact $ids $id] < 0} {\n+                        lappend ids $id\n+                        if {[llength $ids] >= 2} break\n+                    }\n+                }\n+            }\n+        }\n     } else {\n-\tforeach match [array names varcid \"$curview,$prefix*\"] {\n-\t    lappend ids [lindex [split $match \",\"] 1]\n-\t    if {[llength $ids] >= 2} break\n-\t}\n+        foreach match [array names varcid \"$curview,$prefix*\"] {\n+            lappend ids [lindex [split $match \",\"] 1]\n+            if {[llength $ids] >= 2} break\n+        }\n     }\n     return $ids\n }\n@@ -1783,58 +1783,58 @@ proc readrefs {} {\n     global tclencoding\n \n     foreach v {tagids idtags headids idheads otherrefids idotherrefs} {\n-\tunset -nocomplain $v\n+        unset -nocomplain $v\n     }\n     set refd [open [list | git show-ref -d] r]\n     if {$tclencoding != {}} {\n-\tfconfigure $refd -encoding $tclencoding\n+        fconfigure $refd -encoding $tclencoding\n     }\n     while {[gets $refd line] >= 0} {\n-\tif {[string index $line 40] ne \" \"} continue\n-\tset id [string range $line 0 39]\n-\tset ref [string range $line 41 end]\n-\tif {![string match \"refs/*\" $ref]} continue\n-\tset name [string range $ref 5 end]\n-\tif {[string match \"remotes/*\" $name]} {\n-\t    if {![string match \"*/HEAD\" $name] && !$hideremotes} {\n-\t\tset headids($name) $id\n-\t\tlappend idheads($id) $name\n-\t    }\n-\t} elseif {[string match \"heads/*\" $name]} {\n-\t    set name [string range $name 6 end]\n-\t    set headids($name) $id\n-\t    lappend idheads($id) $name\n-\t} elseif {[string match \"tags/*\" $name]} {\n-\t    # this lets refs/tags/foo^{} overwrite refs/tags/foo,\n-\t    # which is what we want since the former is the commit ID\n-\t    set name [string range $name 5 end]\n-\t    if {[string match \"*^{}\" $name]} {\n-\t\tset name [string range $name 0 end-3]\n-\t    } else {\n-\t\tset tagobjid($name) $id\n-\t    }\n-\t    set tagids($name) $id\n-\t    lappend idtags($id) $name\n-\t} else {\n-\t    set otherrefids($name) $id\n-\t    lappend idotherrefs($id) $name\n-\t}\n+        if {[string index $line 40] ne \" \"} continue\n+        set id [string range $line 0 39]\n+        set ref [string range $line 41 end]\n+        if {![string match \"refs/*\" $ref]} continue\n+        set name [string range $ref 5 end]\n+        if {[string match \"remotes/*\" $name]} {\n+            if {![string match \"*/HEAD\" $name] && !$hideremotes} {\n+                set headids($name) $id\n+                lappend idheads($id) $name\n+            }\n+        } elseif {[string match \"heads/*\" $name]} {\n+            set name [string range $name 6 end]\n+            set headids($name) $id\n+            lappend idheads($id) $name\n+        } elseif {[string match \"tags/*\" $name]} {\n+            # this lets refs/tags/foo^{} overwrite refs/tags/foo,\n+            # which is what we want since the former is the commit ID\n+            set name [string range $name 5 end]\n+            if {[string match \"*^{}\" $name]} {\n+                set name [string range $name 0 end-3]\n+            } else {\n+                set tagobjid($name) $id\n+            }\n+            set tagids($name) $id\n+            lappend idtags($id) $name\n+        } else {\n+            set otherrefids($name) $id\n+            lappend idotherrefs($id) $name\n+        }\n     }\n     catch {close $refd}\n     set mainhead {}\n     set mainheadid {}\n     catch {\n-\tset mainheadid [exec git rev-parse HEAD]\n-\tset thehead [exec git symbolic-ref HEAD]\n-\tif {[string match \"refs/heads/*\" $thehead]} {\n-\t    set mainhead [string range $thehead 11 end]\n-\t}\n+        set mainheadid [exec git rev-parse HEAD]\n+        set thehead [exec git symbolic-ref HEAD]\n+        if {[string match \"refs/heads/*\" $thehead]} {\n+            set mainhead [string range $thehead 11 end]\n+        }\n     }\n     set selectheadid {}\n     if {$selecthead ne {}} {\n-\tcatch {\n-\t    set selectheadid [exec git rev-parse --verify $selecthead]\n-\t}\n+        catch {\n+            set selectheadid [exec git rev-parse --verify $selecthead]\n+        }\n     }\n }\n \n@@ -1843,10 +1843,10 @@ proc first_real_row {} {\n     global nullid nullid2 numcommits\n \n     for {set row 0} {$row < $numcommits} {incr row} {\n-\tset id [commitonrow $row]\n-\tif {$id ne $nullid && $id ne $nullid2} {\n-\t    break\n-\t}\n+        set id [commitonrow $row]\n+        if {$id ne $nullid && $id ne $nullid2} {\n+            break\n+        }\n     }\n     return $row\n }\n@@ -1865,12 +1865,12 @@ proc removehead {id name} {\n     global headids idheads\n \n     if {$idheads($id) eq $name} {\n-\tunset idheads($id)\n+        unset idheads($id)\n     } else {\n-\tset i [lsearch -exact $idheads($id) $name]\n-\tif {$i >= 0} {\n-\t    set idheads($id) [lreplace $idheads($id) $i $i]\n-\t}\n+        set i [lsearch -exact $idheads($id) $name]\n+        if {$i >= 0} {\n+            set idheads($id) [lreplace $idheads($id) $i $i]\n+        }\n     }\n     unset headids($name)\n }\n@@ -1898,7 +1898,7 @@ proc make_transient {window origin} {\n     # Windows fails to place transient windows normally, so\n     # schedule a callback to center them on the parent.\n     if {[tk windowingsystem] eq {win32}} {\n-\tafter idle [list tk::PlaceWindow $window widget $origin]\n+        after idle [list tk::PlaceWindow $window widget $origin]\n     }\n }\n \n@@ -1998,41 +1998,41 @@ proc setttkstyle {} {\n proc makemenu {m items} {\n     menu $m\n     if {[tk windowingsystem] eq {aqua}} {\n-\tset Meta1 Cmd\n+        set Meta1 Cmd\n     } else {\n-\tset Meta1 Ctrl\n+        set Meta1 Ctrl\n     }\n     foreach i $items {\n-\tset name [mc [lindex $i 1]]\n-\tset type [lindex $i 2]\n-\tset thing [lindex $i 3]\n-\tset params [list $type]\n-\tif {$name ne {}} {\n-\t    set u [string first \"&\" [string map {&& x} $name]]\n-\t    lappend params -label [string map {&& & & {}} $name]\n-\t    if {$u >= 0} {\n-\t\tlappend params -underline $u\n-\t    }\n-\t}\n-\tswitch -- $type {\n-\t    \"cascade\" {\n-\t\tset submenu [string tolower [string map {& \"\"} [lindex $i 1]]]\n-\t\tlappend params -menu $m.$submenu\n-\t    }\n-\t    \"command\" {\n-\t\tlappend params -command $thing\n-\t    }\n-\t    \"radiobutton\" {\n-\t\tlappend params -variable [lindex $thing 0] \\\n-\t\t    -value [lindex $thing 1]\n-\t    }\n-\t}\n-\tset tail [lrange $i 4 end]\n-\tregsub -all {\\yMeta1\\y} $tail $Meta1 tail\n-\teval $m add $params $tail\n-\tif {$type eq \"cascade\"} {\n-\t    makemenu $m.$submenu $thing\n-\t}\n+        set name [mc [lindex $i 1]]\n+        set type [lindex $i 2]\n+        set thing [lindex $i 3]\n+        set params [list $type]\n+        if {$name ne {}} {\n+            set u [string first \"&\" [string map {&& x} $name]]\n+            lappend params -label [string map {&& & & {}} $name]\n+            if {$u >= 0} {\n+                lappend params -underline $u\n+            }\n+        }\n+        switch -- $type {\n+            \"cascade\" {\n+                set submenu [string tolower [string map {& \"\"} [lindex $i 1]]]\n+                lappend params -menu $m.$submenu\n+            }\n+            \"command\" {\n+                lappend params -command $thing\n+            }\n+            \"radiobutton\" {\n+                lappend params -variable [lindex $thing 0] \\\n+                    -value [lindex $thing 1]\n+            }\n+        }\n+        set tail [lrange $i 4 end]\n+        regsub -all {\\yMeta1\\y} $tail $Meta1 tail\n+        eval $m add $params $tail\n+        if {$type eq \"cascade\"} {\n+            makemenu $m.$submenu $thing\n+        }\n     }\n }\n \n@@ -2052,12 +2052,12 @@ proc makedroplist {w varname args} {\n             set cx [string length $label]\n             if {$cx > $width} {set width $cx}\n         }\n-\tset gm [ttk::combobox $w -width $width -state readonly\\\n-\t\t    -textvariable $varname -values $args \\\n-\t\t    -exportselection false]\n-\tbind $gm <<ComboboxSelected>> [list $gm selection clear]\n+        set gm [ttk::combobox $w -width $width -state readonly\\\n+                    -textvariable $varname -values $args \\\n+                    -exportselection false]\n+        bind $gm <<ComboboxSelected>> [list $gm selection clear]\n     } else {\n-\tset gm [eval [linsert $args 0 tk_optionMenu $w $varname]]\n+        set gm [eval [linsert $args 0 tk_optionMenu $w $varname]]\n     }\n     return $gm\n }\n@@ -2087,49 +2087,49 @@ proc makewindow {} {\n     # The \"mc\" arguments here are purely so that xgettext\n     # sees the following string as needing to be translated\n     set file {\n-\tmc \"&File\" cascade {\n-\t    {mc \"&Update\" command updatecommits -accelerator F5}\n-\t    {mc \"&Reload\" command reloadcommits -accelerator Shift-F5}\n-\t    {mc \"Reread re&ferences\" command rereadrefs}\n-\t    {mc \"&List references\" command showrefs -accelerator F2}\n-\t    {xx \"\" separator}\n-\t    {mc \"Start git &gui\" command {exec git gui &}}\n-\t    {xx \"\" separator}\n-\t    {mc \"&Quit\" command doquit -accelerator Meta1-Q}\n-\t}}\n+        mc \"&File\" cascade {\n+            {mc \"&Update\" command updatecommits -accelerator F5}\n+            {mc \"&Reload\" command reloadcommits -accelerator Shift-F5}\n+            {mc \"Reread re&ferences\" command rereadrefs}\n+            {mc \"&List references\" command showrefs -accelerator F2}\n+            {xx \"\" separator}\n+            {mc \"Start git &gui\" command {exec git gui &}}\n+            {xx \"\" separator}\n+            {mc \"&Quit\" command doquit -accelerator Meta1-Q}\n+        }}\n     set edit {\n-\tmc \"&Edit\" cascade {\n-\t    {mc \"&Preferences\" command doprefs}\n-\t}}\n+        mc \"&Edit\" cascade {\n+            {mc \"&Preferences\" command doprefs}\n+        }}\n     set view {\n-\tmc \"&View\" cascade {\n-\t    {mc \"&New view...\" command {newview 0} -accelerator Shift-F4}\n-\t    {mc \"&Edit view...\" command editview -state disabled -accelerator F4}\n-\t    {mc \"&Delete view\" command delview -state disabled}\n-\t    {xx \"\" separator}\n-\t    {mc \"&All files\" radiobutton {selectedview 0} -command {showview 0}}\n-\t}}\n+        mc \"&View\" cascade {\n+            {mc \"&New view...\" command {newview 0} -accelerator Shift-F4}\n+            {mc \"&Edit view...\" command editview -state disabled -accelerator F4}\n+            {mc \"&Delete view\" command delview -state disabled}\n+            {xx \"\" separator}\n+            {mc \"&All files\" radiobutton {selectedview 0} -command {showview 0}}\n+        }}\n     if {[tk windowingsystem] ne \"aqua\"} {\n-\tset help {\n-\tmc \"&Help\" cascade {\n-\t    {mc \"&About gitk\" command about}\n-\t    {mc \"&Key bindings\" command keys}\n-\t}}\n-\tset bar [list $file $edit $view $help]\n+        set help {\n+        mc \"&Help\" cascade {\n+            {mc \"&About gitk\" command about}\n+            {mc \"&Key bindings\" command keys}\n+        }}\n+        set bar [list $file $edit $view $help]\n     } else {\n-\tproc ::tk::mac::ShowPreferences {} {doprefs}\n-\tproc ::tk::mac::Quit {} {doquit}\n-\tlset file end [lreplace [lindex $file end] end-1 end]\n-\tset apple {\n-\txx \"&Apple\" cascade {\n-\t    {mc \"&About gitk\" command about}\n-\t    {xx \"\" separator}\n-\t}}\n-\tset help {\n-\tmc \"&Help\" cascade {\n-\t    {mc \"&Key bindings\" command keys}\n-\t}}\n-\tset bar [list $apple $file $view $help]\n+        proc ::tk::mac::ShowPreferences {} {doprefs}\n+        proc ::tk::mac::Quit {} {doquit}\n+        lset file end [lreplace [lindex $file end] end-1 end]\n+        set apple {\n+        xx \"&Apple\" cascade {\n+            {mc \"&About gitk\" command about}\n+            {xx \"\" separator}\n+        }}\n+        set help {\n+        mc \"&Help\" cascade {\n+            {mc \"&Key bindings\" command keys}\n+        }}\n+        set bar [list $apple $file $view $help]\n     }\n     makemenu .bar $bar\n     . configure -menu .bar\n@@ -2157,36 +2157,36 @@ proc makewindow {} {\n     ${NS}::frame .tf.histframe\n     ${NS}::panedwindow .tf.histframe.pwclist -orient horizontal\n     if {!$use_ttk} {\n-\t.tf.histframe.pwclist configure -sashpad 0 -handlesize 4\n+        .tf.histframe.pwclist configure -sashpad 0 -handlesize 4\n     }\n \n     # create three canvases\n     set cscroll .tf.histframe.csb\n     set canv .tf.histframe.pwclist.canv\n     canvas $canv \\\n-\t-selectbackground $selectbgcolor \\\n-\t-background $bgcolor -bd 0 \\\n-\t-yscrollincr $linespc -yscrollcommand \"scrollcanv $cscroll\"\n+        -selectbackground $selectbgcolor \\\n+        -background $bgcolor -bd 0 \\\n+        -yscrollincr $linespc -yscrollcommand \"scrollcanv $cscroll\"\n     .tf.histframe.pwclist add $canv\n     set canv2 .tf.histframe.pwclist.canv2\n     canvas $canv2 \\\n-\t-selectbackground $selectbgcolor \\\n-\t-background $bgcolor -bd 0 -yscrollincr $linespc\n+        -selectbackground $selectbgcolor \\\n+        -background $bgcolor -bd 0 -yscrollincr $linespc\n     .tf.histframe.pwclist add $canv2\n     set canv3 .tf.histframe.pwclist.canv3\n     canvas $canv3 \\\n-\t-selectbackground $selectbgcolor \\\n-\t-background $bgcolor -bd 0 -yscrollincr $linespc\n+        -selectbackground $selectbgcolor \\\n+        -background $bgcolor -bd 0 -yscrollincr $linespc\n     .tf.histframe.pwclist add $canv3\n     if {$use_ttk} {\n-\tbind .tf.histframe.pwclist <Map> {\n-\t    bind %W <Map> {}\n-\t    .tf.histframe.pwclist sashpos 1 [lindex $::geometry(pwsash1) 0]\n-\t    .tf.histframe.pwclist sashpos 0 [lindex $::geometry(pwsash0) 0]\n-\t}\n+        bind .tf.histframe.pwclist <Map> {\n+            bind %W <Map> {}\n+            .tf.histframe.pwclist sashpos 1 [lindex $::geometry(pwsash1) 0]\n+            .tf.histframe.pwclist sashpos 0 [lindex $::geometry(pwsash0) 0]\n+        }\n     } else {\n-\teval .tf.histframe.pwclist sash place 0 $geometry(pwsash0)\n-\teval .tf.histframe.pwclist sash place 1 $geometry(pwsash1)\n+        eval .tf.histframe.pwclist sash place 0 $geometry(pwsash0)\n+        eval .tf.histframe.pwclist sash place 1 $geometry(pwsash1)\n     }\n \n     # a scroll bar to rule them\n@@ -2205,7 +2205,7 @@ proc makewindow {} {\n     set entries $sha1entry\n     set sha1but .tf.bar.sha1label\n     button $sha1but -text \"[mc \"SHA1 ID:\"] \" -state disabled -relief flat \\\n-\t-command gotocommit -width 8\n+        -command gotocommit -width 8\n     $sha1but conf -disabledforeground [$sha1but cget -foreground]\n     pack .tf.bar.sha1label -side left\n     ${NS}::entry $sha1entry -width 40 -font textfont -textvariable sha1string\n@@ -2213,20 +2213,20 @@ proc makewindow {} {\n     pack $sha1entry -side left -pady 2\n \n     set bm_left_data {\n-\t#define left_width 16\n-\t#define left_height 16\n-\tstatic unsigned char left_bits[] = {\n-\t0x00, 0x00, 0xc0, 0x01, 0xe0, 0x00, 0x70, 0x00, 0x38, 0x00, 0x1c, 0x00,\n-\t0x0e, 0x00, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x0e, 0x00, 0x1c, 0x00,\n-\t0x38, 0x00, 0x70, 0x00, 0xe0, 0x00, 0xc0, 0x01};\n+        #define left_width 16\n+        #define left_height 16\n+        static unsigned char left_bits[] = {\n+        0x00, 0x00, 0xc0, 0x01, 0xe0, 0x00, 0x70, 0x00, 0x38, 0x00, 0x1c, 0x00,\n+        0x0e, 0x00, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x0e, 0x00, 0x1c, 0x00,\n+        0x38, 0x00, 0x70, 0x00, 0xe0, 0x00, 0xc0, 0x01};\n     }\n     set bm_right_data {\n-\t#define right_width 16\n-\t#define right_height 16\n-\tstatic unsigned char right_bits[] = {\n-\t0x00, 0x00, 0xc0, 0x01, 0x80, 0x03, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x1c,\n-\t0x00, 0x38, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x00, 0x38, 0x00, 0x1c,\n-\t0x00, 0x0e, 0x00, 0x07, 0x80, 0x03, 0xc0, 0x01};\n+        #define right_width 16\n+        #define right_height 16\n+        static unsigned char right_bits[] = {\n+        0x00, 0x00, 0xc0, 0x01, 0x80, 0x03, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x1c,\n+        0x00, 0x38, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x00, 0x38, 0x00, 0x1c,\n+        0x00, 0x0e, 0x00, 0x07, 0x80, 0x03, 0xc0, 0x01};\n     }\n     image create bitmap bm-left -data $bm_left_data -foreground $uifgcolor\n     image create bitmap bm-left-gray -data $bm_left_data -foreground $uifgdisabledcolor\n@@ -2235,28 +2235,28 @@ proc makewindow {} {\n \n     ${NS}::button .tf.bar.leftbut -command goback -state disabled -width 26\n     if {$use_ttk} {\n-\t.tf.bar.leftbut configure -image [list bm-left disabled bm-left-gray]\n+        .tf.bar.leftbut configure -image [list bm-left disabled bm-left-gray]\n     } else {\n-\t.tf.bar.leftbut configure -image bm-left\n+        .tf.bar.leftbut configure -image bm-left\n     }\n     pack .tf.bar.leftbut -side left -fill y\n     ${NS}::button .tf.bar.rightbut -command goforw -state disabled -width 26\n     if {$use_ttk} {\n-\t.tf.bar.rightbut configure -image [list bm-right disabled bm-right-gray]\n+        .tf.bar.rightbut configure -image [list bm-right disabled bm-right-gray]\n     } else {\n-\t.tf.bar.rightbut configure -image bm-right\n+        .tf.bar.rightbut configure -image bm-right\n     }\n     pack .tf.bar.rightbut -side left -fill y\n \n     ${NS}::label .tf.bar.rowlabel -text [mc \"Row\"]\n     set rownumsel {}\n     ${NS}::label .tf.bar.rownum -width 7 -textvariable rownumsel \\\n-\t-relief sunken -anchor e\n+        -relief sunken -anchor e\n     ${NS}::label .tf.bar.rowlabel2 -text \"/\"\n     ${NS}::label .tf.bar.numcommits -width 7 -textvariable numcommits \\\n-\t-relief sunken -anchor e\n+        -relief sunken -anchor e\n     pack .tf.bar.rowlabel .tf.bar.rownum .tf.bar.rowlabel2 .tf.bar.numcommits \\\n-\t-side left\n+        -side left\n     if {!$use_ttk} {\n         foreach w {rownum numcommits} {.tf.bar.$w configure -font textfont}\n     }\n@@ -2268,14 +2268,14 @@ proc makewindow {} {\n     ${NS}::label $statusw -width 15 -relief sunken\n     pack $statusw -side left -padx 5\n     if {$use_ttk} {\n-\tset progresscanv [ttk::progressbar .tf.bar.progress]\n+        set progresscanv [ttk::progressbar .tf.bar.progress]\n     } else {\n-\tset h [expr {[font metrics uifont -linespace] + 2}]\n-\tset progresscanv .tf.bar.progress\n-\tcanvas $progresscanv -relief sunken -height $h -borderwidth 2\n-\tset progressitem [$progresscanv create rect -1 0 0 $h -fill \"#00ff00\"]\n-\tset fprogitem [$progresscanv create rect -1 0 0 $h -fill yellow]\n-\tset rprogitem [$progresscanv create rect -1 0 0 $h -fill red]\n+        set h [expr {[font metrics uifont -linespace] + 2}]\n+        set progresscanv .tf.bar.progress\n+        canvas $progresscanv -relief sunken -height $h -borderwidth 2\n+        set progressitem [$progresscanv create rect -1 0 0 $h -fill \"#00ff00\"]\n+        set fprogitem [$progresscanv create rect -1 0 0 $h -fill yellow]\n+        set rprogitem [$progresscanv create rect -1 0 0 $h -fill red]\n     }\n     pack $progresscanv -side right -expand 1 -fill x -padx {0 2}\n     set progresscoords {0 0}\n@@ -2289,26 +2289,26 @@ proc makewindow {} {\n     ${NS}::label .tf.lbar.flabel -text \"[mc \"Find\"] \"\n \n     set bm_down_data {\n-\t#define down_width 16\n-\t#define down_height 16\n-\tstatic unsigned char down_bits[] = {\n-\t0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,\n-\t0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,\n-\t0x87, 0xe1, 0x8e, 0x71, 0x9c, 0x39, 0xb8, 0x1d,\n-\t0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01};\n+        #define down_width 16\n+        #define down_height 16\n+        static unsigned char down_bits[] = {\n+        0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,\n+        0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,\n+        0x87, 0xe1, 0x8e, 0x71, 0x9c, 0x39, 0xb8, 0x1d,\n+        0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01};\n     }\n     image create bitmap bm-down -data $bm_down_data -foreground $uifgcolor\n     ${NS}::button .tf.lbar.fnext -width 26 -command {dofind 1 1}\n     .tf.lbar.fnext configure -image bm-down\n \n     set bm_up_data {\n-\t#define up_width 16\n-\t#define up_height 16\n-\tstatic unsigned char up_bits[] = {\n-\t0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f,\n-\t0xb8, 0x1d, 0x9c, 0x39, 0x8e, 0x71, 0x87, 0xe1,\n-\t0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,\n-\t0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01};\n+        #define up_width 16\n+        #define up_height 16\n+        static unsigned char up_bits[] = {\n+        0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f,\n+        0xb8, 0x1d, 0x9c, 0x39, 0x8e, 0x71, 0x87, 0xe1,\n+        0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,\n+        0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01};\n     }\n     image create bitmap bm-up -data $bm_up_data -foreground $uifgcolor\n     ${NS}::button .tf.lbar.fprev -width 26 -command {dofind -1 1}\n@@ -2317,13 +2317,13 @@ proc makewindow {} {\n     ${NS}::label .tf.lbar.flab2 -text \" [mc \"commit\"] \"\n \n     pack .tf.lbar.flabel .tf.lbar.fnext .tf.lbar.fprev .tf.lbar.flab2 \\\n-\t-side left -fill y\n+        -side left -fill y\n     set gdttype [mc \"containing:\"]\n     set gm [makedroplist .tf.lbar.gdttype gdttype \\\n-\t\t[mc \"containing:\"] \\\n-\t\t[mc \"touching paths:\"] \\\n-\t\t[mc \"adding/removing string:\"] \\\n-\t\t[mc \"changing lines matching:\"]]\n+                [mc \"containing:\"] \\\n+                [mc \"touching paths:\"] \\\n+                [mc \"adding/removing string:\"] \\\n+                [mc \"changing lines matching:\"]]\n     trace add variable gdttype write gdttype_change\n     pack .tf.lbar.gdttype -side left -fill y\n \n@@ -2334,11 +2334,11 @@ proc makewindow {} {\n     trace add variable findstring write find_change\n     set findtype [mc \"Exact\"]\n     set findtypemenu [makedroplist .tf.lbar.findtype \\\n-\t\t\t  findtype [mc \"Exact\"] [mc \"IgnCase\"] [mc \"Regexp\"]]\n+                          findtype [mc \"Exact\"] [mc \"IgnCase\"] [mc \"Regexp\"]]\n     trace add variable findtype write findcom_change\n     set findloc [mc \"All fields\"]\n     makedroplist .tf.lbar.findloc findloc [mc \"All fields\"] [mc \"Headline\"] \\\n-\t[mc \"Comments\"] [mc \"Author\"] [mc \"Committer\"]\n+        [mc \"Comments\"] [mc \"Author\"] [mc \"Committer\"]\n     trace add variable findloc write find_change\n     pack .tf.lbar.findloc -side right\n     pack .tf.lbar.findtype -side right\n@@ -2350,8 +2350,8 @@ proc makewindow {} {\n     pack .tf.histframe -fill both -side top -expand 1\n     .ctop add .tf\n     if {!$use_ttk} {\n-\t.ctop paneconfigure .tf -height $geometry(topheight)\n-\t.ctop paneconfigure .tf -width $geometry(topwidth)\n+        .ctop paneconfigure .tf -height $geometry(topheight)\n+        .ctop paneconfigure .tf -width $geometry(topwidth)\n     }\n \n     # now build up the bottom\n@@ -2361,9 +2361,9 @@ proc makewindow {} {\n     # if we know window height, then that will set the lower text height, otherwise\n     # we set lower text height which will drive window height\n     if {[info exists geometry(main)]} {\n-\t${NS}::frame .bleft -width $geometry(botwidth)\n+        ${NS}::frame .bleft -width $geometry(botwidth)\n     } else {\n-\t${NS}::frame .bleft -width $geometry(botwidth) -height $geometry(botheight)\n+        ${NS}::frame .bleft -width $geometry(botwidth) -height $geometry(botheight)\n     }\n     ${NS}::frame .bleft.top\n     ${NS}::frame .bleft.mid\n@@ -2381,41 +2381,41 @@ proc makewindow {} {\n     trace add variable searchstring write incrsearch\n     pack $sstring -side left -expand 1 -fill x\n     ${NS}::radiobutton .bleft.mid.diff -text [mc \"Diff\"] \\\n-\t-command changediffdisp -variable diffelide -value {0 0}\n+        -command changediffdisp -variable diffelide -value {0 0}\n     ${NS}::radiobutton .bleft.mid.old -text [mc \"Old version\"] \\\n-\t-command changediffdisp -variable diffelide -value {0 1}\n+        -command changediffdisp -variable diffelide -value {0 1}\n     ${NS}::radiobutton .bleft.mid.new -text [mc \"New version\"] \\\n-\t-command changediffdisp -variable diffelide -value {1 0}\n+        -command changediffdisp -variable diffelide -value {1 0}\n \n     ${NS}::label .bleft.mid.labeldiffcontext -text \"      [mc \"Lines of context\"]: \"\n     pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left -ipadx $wgap\n     spinbox .bleft.mid.diffcontext -width 5 \\\n-\t-from 0 -increment 1 -to 10000000 \\\n-\t-validate all -validatecommand \"diffcontextvalidate %P\" \\\n-\t-textvariable diffcontextstring\n+        -from 0 -increment 1 -to 10000000 \\\n+        -validate all -validatecommand \"diffcontextvalidate %P\" \\\n+        -textvariable diffcontextstring\n     .bleft.mid.diffcontext set $diffcontext\n     trace add variable diffcontextstring write diffcontextchange\n     lappend entries .bleft.mid.diffcontext\n     pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left -ipadx $wgap\n     ${NS}::checkbutton .bleft.mid.ignspace -text [mc \"Ignore space change\"] \\\n-\t-command changeignorespace -variable ignorespace\n+        -command changeignorespace -variable ignorespace\n     pack .bleft.mid.ignspace -side left -padx 5\n \n     set worddiff [mc \"Line diff\"]\n     if {[package vcompare $git_version \"1.7.2\"] >= 0} {\n-\tmakedroplist .bleft.mid.worddiff worddiff [mc \"Line diff\"] \\\n-\t    [mc \"Markup words\"] [mc \"Color words\"]\n-\ttrace add variable worddiff write changeworddiff\n-\tpack .bleft.mid.worddiff -side left -padx 5\n+        makedroplist .bleft.mid.worddiff worddiff [mc \"Line diff\"] \\\n+            [mc \"Markup words\"] [mc \"Color words\"]\n+        trace add variable worddiff write changeworddiff\n+        pack .bleft.mid.worddiff -side left -padx 5\n     }\n \n     set ctext .bleft.bottom.ctext\n     text $ctext -background $bgcolor -foreground $fgcolor \\\n-\t-state disabled -undo 0 -font textfont \\\n-\t-yscrollcommand scrolltext -wrap none \\\n-\t-xscrollcommand \".bleft.bottom.sbhorizontal set\"\n+        -state disabled -undo 0 -font textfont \\\n+        -yscrollcommand scrolltext -wrap none \\\n+        -xscrollcommand \".bleft.bottom.sbhorizontal set\"\n     if {$have_tk85} {\n-\t$ctext conf -tabstyle wordprocessor\n+        $ctext conf -tabstyle wordprocessor\n     }\n     ${NS}::scrollbar .bleft.bottom.sb -command \"$ctext yview\"\n     ${NS}::scrollbar .bleft.bottom.sbhorizontal -command \"$ctext xview\" -orient h\n@@ -2462,35 +2462,35 @@ proc makewindow {} {\n \n     .pwbottom add .bleft\n     if {!$use_ttk} {\n-\t.pwbottom paneconfigure .bleft -width $geometry(botwidth)\n+        .pwbottom paneconfigure .bleft -width $geometry(botwidth)\n     }\n \n     # lower right\n     ${NS}::frame .bright\n     ${NS}::frame .bright.mode\n     ${NS}::radiobutton .bright.mode.patch -text [mc \"Patch\"] \\\n-\t-command reselectline -variable cmitmode -value \"patch\"\n+        -command reselectline -variable cmitmode -value \"patch\"\n     ${NS}::radiobutton .bright.mode.tree -text [mc \"Tree\"] \\\n-\t-command reselectline -variable cmitmode -value \"tree\"\n+        -command reselectline -variable cmitmode -value \"tree\"\n     grid .bright.mode.patch .bright.mode.tree -sticky ew\n     pack .bright.mode -side top -fill x\n     set cflist .bright.cfiles\n     set indent [font measure mainfont \"nn\"]\n     text $cflist \\\n-\t-selectbackground $selectbgcolor \\\n-\t-background $bgcolor -foreground $fgcolor \\\n-\t-font mainfont \\\n-\t-tabs [list $indent [expr {2 * $indent}]] \\\n-\t-yscrollcommand \".bright.sb set\" \\\n-\t-cursor [. cget -cursor] \\\n-\t-spacing1 1 -spacing3 1\n+        -selectbackground $selectbgcolor \\\n+        -background $bgcolor -foreground $fgcolor \\\n+        -font mainfont \\\n+        -tabs [list $indent [expr {2 * $indent}]] \\\n+        -yscrollcommand \".bright.sb set\" \\\n+        -cursor [. cget -cursor] \\\n+        -spacing1 1 -spacing3 1\n     lappend bglist $cflist\n     lappend fglist $cflist\n     ${NS}::scrollbar .bright.sb -command \"$cflist yview\"\n     pack .bright.sb -side right -fill y\n     pack $cflist -side left -fill both -expand 1\n     $cflist tag configure highlight \\\n-\t-background [$cflist cget -selectbackground]\n+        -background [$cflist cget -selectbackground]\n     $cflist tag configure bold -font mainfontbold\n \n     .pwbottom add .bright\n@@ -2498,15 +2498,15 @@ proc makewindow {} {\n \n     # restore window width & height if known\n     if {[info exists geometry(main)]} {\n-\tif {[scan $geometry(main) \"%dx%d\" w h] >= 2} {\n-\t    if {$w > [winfo screenwidth .]} {\n-\t\tset w [winfo screenwidth .]\n-\t    }\n-\t    if {$h > [winfo screenheight .]} {\n-\t\tset h [winfo screenheight .]\n-\t    }\n-\t    wm geometry . \"${w}x$h\"\n-\t}\n+        if {[scan $geometry(main) \"%dx%d\" w h] >= 2} {\n+            if {$w > [winfo screenwidth .]} {\n+                set w [winfo screenwidth .]\n+            }\n+            if {$h > [winfo screenheight .]} {\n+                set h [winfo screenheight .]\n+            }\n+            wm geometry . \"${w}x$h\"\n+        }\n     }\n \n     if {[info exists geometry(state)] && $geometry(state) eq \"zoomed\"} {\n@@ -2530,25 +2530,25 @@ proc makewindow {} {\n             bind %W <Map> {}\n             %W sashpos 0 $::geometry(botwidth)\n         }\n-\tbind .pwbottom <Configure> {resizecdetpanes %W %w}\n+        bind .pwbottom <Configure> {resizecdetpanes %W %w}\n     }\n \n     pack .ctop -fill both -expand 1\n     bindall <1> {selcanvline %W %x %y}\n     #bindall <B1-Motion> {selcanvline %W %x %y}\n     if {[tk windowingsystem] == \"win32\"} {\n-\tbind . <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D }\n-\tbind $ctext <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D ; break }\n+        bind . <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D }\n+        bind $ctext <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D ; break }\n     } else {\n-\tbindall <ButtonRelease-4> \"allcanvs yview scroll -5 units\"\n-\tbindall <ButtonRelease-5> \"allcanvs yview scroll 5 units\"\n-\tbind $ctext <Button> {\n-\t    if {\"%b\" eq 6} {\n-\t\t$ctext xview scroll -5 units\n-\t    } elseif {\"%b\" eq 7} {\n-\t\t$ctext xview scroll 5 units\n-\t    }\n-\t}\n+        bindall <ButtonRelease-4> \"allcanvs yview scroll -5 units\"\n+        bindall <ButtonRelease-5> \"allcanvs yview scroll 5 units\"\n+        bind $ctext <Button> {\n+            if {\"%b\" eq 6} {\n+                $ctext xview scroll -5 units\n+            } elseif {\"%b\" eq 7} {\n+                $ctext xview scroll 5 units\n+            }\n+        }\n         if {[tk windowingsystem] eq \"aqua\"} {\n             bindall <MouseWheel> {\n                 set delta [expr {- (%D)}]\n@@ -2631,7 +2631,7 @@ proc makewindow {} {\n     bind $ctext <Button-1> {focus %W}\n     bind $ctext <<Selection>> rehighlight_search_results\n     for {set i 1} {$i < 10} {incr i} {\n-\tbind . <$M1B-Key-$i> [list go_to_parent $i]\n+        bind . <$M1B-Key-$i> [list go_to_parent $i]\n     }\n \n     set maincursor [. cget -cursor]\n@@ -2640,60 +2640,60 @@ proc makewindow {} {\n \n     set rowctxmenu .rowctxmenu\n     makemenu $rowctxmenu {\n-\t{mc \"Diff this -> selected\" command {diffvssel 0}}\n-\t{mc \"Diff selected -> this\" command {diffvssel 1}}\n-\t{mc \"Make patch\" command mkpatch}\n-\t{mc \"Create tag\" command mktag}\n-\t{mc \"Copy commit reference\" command copyreference}\n-\t{mc \"Write commit to file\" command writecommit}\n-\t{mc \"Create new branch\" command mkbranch}\n-\t{mc \"Cherry-pick this commit\" command cherrypick}\n-\t{mc \"Reset HEAD branch to here\" command resethead}\n-\t{mc \"Mark this commit\" command markhere}\n-\t{mc \"Return to mark\" command gotomark}\n-\t{mc \"Find descendant of this and mark\" command find_common_desc}\n-\t{mc \"Compare with marked commit\" command compare_commits}\n-\t{mc \"Diff this -> marked commit\" command {diffvsmark 0}}\n-\t{mc \"Diff marked commit -> this\" command {diffvsmark 1}}\n-\t{mc \"Revert this commit\" command revert}\n+        {mc \"Diff this -> selected\" command {diffvssel 0}}\n+        {mc \"Diff selected -> this\" command {diffvssel 1}}\n+        {mc \"Make patch\" command mkpatch}\n+        {mc \"Create tag\" command mktag}\n+        {mc \"Copy commit reference\" command copyreference}\n+        {mc \"Write commit to file\" command writecommit}\n+        {mc \"Create new branch\" command mkbranch}\n+        {mc \"Cherry-pick this commit\" command cherrypick}\n+        {mc \"Reset HEAD branch to here\" command resethead}\n+        {mc \"Mark this commit\" command markhere}\n+        {mc \"Return to mark\" command gotomark}\n+        {mc \"Find descendant of this and mark\" command find_common_desc}\n+        {mc \"Compare with marked commit\" command compare_commits}\n+        {mc \"Diff this -> marked commit\" command {diffvsmark 0}}\n+        {mc \"Diff marked commit -> this\" command {diffvsmark 1}}\n+        {mc \"Revert this commit\" command revert}\n     }\n     $rowctxmenu configure -tearoff 0\n \n     set fakerowmenu .fakerowmenu\n     makemenu $fakerowmenu {\n-\t{mc \"Diff this -> selected\" command {diffvssel 0}}\n-\t{mc \"Diff selected -> this\" command {diffvssel 1}}\n-\t{mc \"Make patch\" command mkpatch}\n-\t{mc \"Diff this -> marked commit\" command {diffvsmark 0}}\n-\t{mc \"Diff marked commit -> this\" command {diffvsmark 1}}\n+        {mc \"Diff this -> selected\" command {diffvssel 0}}\n+        {mc \"Diff selected -> this\" command {diffvssel 1}}\n+        {mc \"Make patch\" command mkpatch}\n+        {mc \"Diff this -> marked commit\" command {diffvsmark 0}}\n+        {mc \"Diff marked commit -> this\" command {diffvsmark 1}}\n     }\n     $fakerowmenu configure -tearoff 0\n \n     set headctxmenu .headctxmenu\n     makemenu $headctxmenu {\n-\t{mc \"Check out this branch\" command cobranch}\n-\t{mc \"Rename this branch\" command mvbranch}\n-\t{mc \"Remove this branch\" command rmbranch}\n-\t{mc \"Copy branch name\" command {clipboard clear; clipboard append $headmenuhead}}\n+        {mc \"Check out this branch\" command cobranch}\n+        {mc \"Rename this branch\" command mvbranch}\n+        {mc \"Remove this branch\" command rmbranch}\n+        {mc \"Copy branch name\" command {clipboard clear; clipboard append $headmenuhead}}\n     }\n     $headctxmenu configure -tearoff 0\n \n     global flist_menu\n     set flist_menu .flistctxmenu\n     makemenu $flist_menu {\n-\t{mc \"Highlight this too\" command {flist_hl 0}}\n-\t{mc \"Highlight this only\" command {flist_hl 1}}\n-\t{mc \"External diff\" command {external_diff}}\n-\t{mc \"Blame parent commit\" command {external_blame 1}}\n-\t{mc \"Copy path\" command {clipboard clear; clipboard append $flist_menu_file}}\n+        {mc \"Highlight this too\" command {flist_hl 0}}\n+        {mc \"Highlight this only\" command {flist_hl 1}}\n+        {mc \"External diff\" command {external_diff}}\n+        {mc \"Blame parent commit\" command {external_blame 1}}\n+        {mc \"Copy path\" command {clipboard clear; clipboard append $flist_menu_file}}\n     }\n     $flist_menu configure -tearoff 0\n \n     global diff_menu\n     set diff_menu .diffctxmenu\n     makemenu $diff_menu {\n-\t{mc \"Show origin of this line\" command show_line_source}\n-\t{mc \"Run git gui blame on this line\" command {external_blame_diff}}\n+        {mc \"Show origin of this line\" command show_line_source}\n+        {mc \"Run git gui blame on this line\" command {external_blame_diff}}\n     }\n     $diff_menu configure -tearoff 0\n }\n@@ -2705,14 +2705,14 @@ proc windows_mousewheel_redirector {W X Y D} {\n     global canv canv2 canv3\n     set w [winfo containing -displayof $W $X $Y]\n     if {$w ne \"\"} {\n-\tset u [expr {$D < 0 ? 5 : -5}]\n-\tif {$w == $canv || $w == $canv2 || $w == $canv3} {\n-\t    allcanvs yview scroll $u units\n-\t} else {\n-\t    catch {\n-\t\t$w yview scroll $u units\n-\t    }\n-\t}\n+        set u [expr {$D < 0 ? 5 : -5}]\n+        if {$w == $canv || $w == $canv2 || $w == $canv3} {\n+            allcanvs yview scroll $u units\n+        } else {\n+            catch {\n+                $w yview scroll $u units\n+            }\n+        }\n     }\n }\n \n@@ -2721,9 +2721,9 @@ proc selectedline_change {n1 n2 op} {\n     global selectedline rownumsel\n \n     if {$selectedline eq {}} {\n-\tset rownumsel {}\n+        set rownumsel {}\n     } else {\n-\tset rownumsel [expr {$selectedline + 1}]\n+        set rownumsel [expr {$selectedline + 1}]\n     }\n }\n \n@@ -2732,11 +2732,11 @@ proc selectedline_change {n1 n2 op} {\n proc canvscan {op w x y} {\n     global canv canv2 canv3\n     foreach c [list $canv $canv2 $canv3] {\n-\tif {$c == $w} {\n-\t    $c scan $op $x $y\n-\t} else {\n-\t    $c scan $op 0 $y\n-\t}\n+        if {$c == $w} {\n+            $c scan $op $x $y\n+        } else {\n+            $c scan $op 0 $y\n+        }\n     }\n }\n \n@@ -2754,10 +2754,10 @@ proc bindkey {ev script} {\n     bind . $ev $script\n     set escript [bind Entry $ev]\n     if {$escript == {}} {\n-\tset escript [bind Entry <Key>]\n+        set escript [bind Entry <Key>]\n     }\n     foreach e $entries {\n-\tbind $e $ev \"$escript; break\"\n+        bind $e $ev \"$escript; break\"\n     }\n }\n \n@@ -2771,7 +2771,7 @@ proc bindmodfunctionkey {mod n script} {\n proc click {w} {\n     global ctext entries\n     foreach e [concat $entries $ctext] {\n-\tif {$w == $e} return\n+        if {$w == $e} return\n     }\n     focus .\n }\n@@ -2783,8 +2783,8 @@ proc adjustprogress {} {\n     global rprogitem rprogcoord use_ttk\n \n     if {$use_ttk} {\n-\t$progresscanv configure -value [expr {int($fprogcoord * 100)}]\n-\treturn\n+        $progresscanv configure -value [expr {int($fprogcoord * 100)}]\n+        return\n     }\n \n     set w [expr {[winfo width $progresscanv] - 4}]\n@@ -2796,11 +2796,11 @@ proc adjustprogress {} {\n     $progresscanv coords $rprogitem 0 0 [expr {$w * $rprogcoord}] $h\n     set now [clock clicks -milliseconds]\n     if {$now >= $lastprogupdate + 100} {\n-\tset progupdatepending 0\n-\tupdate\n+        set progupdatepending 0\n+        update\n     } elseif {!$progupdatepending} {\n-\tset progupdatepending 1\n-\tafter [expr {$lastprogupdate + 100 - $now}] doprogupdate\n+        set progupdatepending 1\n+        after [expr {$lastprogupdate + 100 - $now}] doprogupdate\n     }\n }\n \n@@ -2808,9 +2808,9 @@ proc doprogupdate {} {\n     global lastprogupdate progupdatepending\n \n     if {$progupdatepending} {\n-\tset progupdatepending 0\n-\tset lastprogupdate [clock clicks -milliseconds]\n-\tupdate\n+        set progupdatepending 0\n+        set lastprogupdate [clock clicks -milliseconds]\n+        update\n     }\n }\n \n@@ -2818,14 +2818,14 @@ proc config_check_tmp_exists {tries_left} {\n     global config_file_tmp\n \n     if {[file exists $config_file_tmp]} {\n-\tincr tries_left -1\n-\tif {$tries_left > 0} {\n-\t    after 100 [list config_check_tmp_exists $tries_left]\n-\t} else {\n-\t    error_popup \"There appears to be a stale $config_file_tmp\\\n+        incr tries_left -1\n+        if {$tries_left > 0} {\n+            after 100 [list config_check_tmp_exists $tries_left]\n+        } else {\n+            error_popup \"There appears to be a stale $config_file_tmp\\\n  file, which will prevent gitk from saving its configuration on exit.\\\n  Please remove it if it is not being used by any existing gitk process.\"\n-\t}\n+        }\n     }\n }\n \n@@ -2842,9 +2842,9 @@ proc config_variable_change_cb {name name2 op} {\n \n     upvar #0 $name var\n     if {$op eq \"write\" &&\n-\t(![info exists config_variable_original($name)] ||\n-\t $config_variable_original($name) ne $var)} {\n-\tset config_variable_changed($name) 1\n+        (![info exists config_variable_original($name)] ||\n+         $config_variable_original($name) ne $var)} {\n+        set config_variable_changed($name) 1\n     }\n }\n \n@@ -2866,81 +2866,81 @@ proc savestuff {w} {\n     if {![winfo viewable .]} return\n     set remove_tmp 0\n     if {[catch {\n-\tset try_count 0\n-\twhile {[catch {set f [open $config_file_tmp {WRONLY CREAT EXCL}]}]} {\n-\t    if {[incr try_count] > 50} {\n-\t\terror \"Unable to write config file: $config_file_tmp exists\"\n-\t    }\n-\t    after 100\n-\t}\n-\tset remove_tmp 1\n-\tif {$::tcl_platform(platform) eq {windows}} {\n-\t    file attributes $config_file_tmp -hidden true\n-\t}\n-\tif {[file exists $config_file]} {\n-\t    source $config_file\n-\t}\n-\tforeach var_name $config_variables {\n-\t    upvar #0 $var_name var\n-\t    upvar 0 $var_name old_var\n-\t    if {!$config_variable_changed($var_name) && [info exists old_var]} {\n-\t\tputs $f [list set $var_name $old_var]\n-\t    } else {\n-\t\tputs $f [list set $var_name $var]\n-\t    }\n-\t}\n+        set try_count 0\n+        while {[catch {set f [open $config_file_tmp {WRONLY CREAT EXCL}]}]} {\n+            if {[incr try_count] > 50} {\n+                error \"Unable to write config file: $config_file_tmp exists\"\n+            }\n+            after 100\n+        }\n+        set remove_tmp 1\n+        if {$::tcl_platform(platform) eq {windows}} {\n+            file attributes $config_file_tmp -hidden true\n+        }\n+        if {[file exists $config_file]} {\n+            source $config_file\n+        }\n+        foreach var_name $config_variables {\n+            upvar #0 $var_name var\n+            upvar 0 $var_name old_var\n+            if {!$config_variable_changed($var_name) && [info exists old_var]} {\n+                puts $f [list set $var_name $old_var]\n+            } else {\n+                puts $f [list set $var_name $var]\n+            }\n+        }\n \n-\tputs $f \"set geometry(main) [wm geometry .]\"\n-\tputs $f \"set geometry(state) [wm state .]\"\n-\tputs $f \"set geometry(topwidth) [winfo width .tf]\"\n-\tputs $f \"set geometry(topheight) [winfo height .tf]\"\n-\tif {$current_use_ttk} {\n-\t    puts $f \"set geometry(pwsash0) \\\"[.tf.histframe.pwclist sashpos 0] 1\\\"\"\n-\t    puts $f \"set geometry(pwsash1) \\\"[.tf.histframe.pwclist sashpos 1] 1\\\"\"\n-\t} else {\n-\t    puts $f \"set geometry(pwsash0) \\\"[.tf.histframe.pwclist sash coord 0]\\\"\"\n-\t    puts $f \"set geometry(pwsash1) \\\"[.tf.histframe.pwclist sash coord 1]\\\"\"\n-\t}\n-\tputs $f \"set geometry(botwidth) [winfo width .bleft]\"\n-\tputs $f \"set geometry(botheight) [winfo height .bleft]\"\n+        puts $f \"set geometry(main) [wm geometry .]\"\n+        puts $f \"set geometry(state) [wm state .]\"\n+        puts $f \"set geometry(topwidth) [winfo width .tf]\"\n+        puts $f \"set geometry(topheight) [winfo height .tf]\"\n+        if {$current_use_ttk} {\n+            puts $f \"set geometry(pwsash0) \\\"[.tf.histframe.pwclist sashpos 0] 1\\\"\"\n+            puts $f \"set geometry(pwsash1) \\\"[.tf.histframe.pwclist sashpos 1] 1\\\"\"\n+        } else {\n+            puts $f \"set geometry(pwsash0) \\\"[.tf.histframe.pwclist sash coord 0]\\\"\"\n+            puts $f \"set geometry(pwsash1) \\\"[.tf.histframe.pwclist sash coord 1]\\\"\"\n+        }\n+        puts $f \"set geometry(botwidth) [winfo width .bleft]\"\n+        puts $f \"set geometry(botheight) [winfo height .bleft]\"\n \n-\tarray set view_save {}\n-\tarray set views {}\n-\tif {![info exists permviews]} { set permviews {} }\n-\tforeach view $permviews {\n-\t    set view_save([lindex $view 0]) 1\n-\t    set views([lindex $view 0]) $view\n-\t}\n-\tputs -nonewline $f \"set permviews {\"\n-\tfor {set v 1} {$v < $current_nextviewnum} {incr v} {\n-\t    if {$viewchanged($v)} {\n-\t\tif {$current_viewperm($v)} {\n-\t\t    set views($current_viewname($v)) [list $current_viewname($v) $current_viewfiles($v) $current_viewargs($v) $current_viewargscmd($v)]\n-\t\t} else {\n-\t\t    set view_save($current_viewname($v)) 0\n-\t\t}\n-\t    }\n-\t}\n-\t# write old and updated view to their places and append remaining to the end\n-\tforeach view $permviews {\n-\t    set view_name [lindex $view 0]\n-\t    if {$view_save($view_name)} {\n-\t\tputs $f \"{$views($view_name)}\"\n-\t    }\n-\t    unset views($view_name)\n-\t}\n-\tforeach view_name [array names views] {\n-\t    puts $f \"{$views($view_name)}\"\n-\t}\n-\tputs $f \"}\"\n-\tclose $f\n-\tfile rename -force $config_file_tmp $config_file\n-\tset remove_tmp 0\n+        array set view_save {}\n+        array set views {}\n+        if {![info exists permviews]} { set permviews {} }\n+        foreach view $permviews {\n+            set view_save([lindex $view 0]) 1\n+            set views([lindex $view 0]) $view\n+        }\n+        puts -nonewline $f \"set permviews {\"\n+        for {set v 1} {$v < $current_nextviewnum} {incr v} {\n+            if {$viewchanged($v)} {\n+                if {$current_viewperm($v)} {\n+                    set views($current_viewname($v)) [list $current_viewname($v) $current_viewfiles($v) $current_viewargs($v) $current_viewargscmd($v)]\n+                } else {\n+                    set view_save($current_viewname($v)) 0\n+                }\n+            }\n+        }\n+        # write old and updated view to their places and append remaining to the end\n+        foreach view $permviews {\n+            set view_name [lindex $view 0]\n+            if {$view_save($view_name)} {\n+                puts $f \"{$views($view_name)}\"\n+            }\n+            unset views($view_name)\n+        }\n+        foreach view_name [array names views] {\n+            puts $f \"{$views($view_name)}\"\n+        }\n+        puts $f \"}\"\n+        close $f\n+        file rename -force $config_file_tmp $config_file\n+        set remove_tmp 0\n     } err]} {\n         puts \"Error saving config: $err\"\n     }\n     if {$remove_tmp} {\n-\tfile delete -force $config_file_tmp\n+        file delete -force $config_file_tmp\n     }\n     set stuffsaved 1\n }\n@@ -2948,40 +2948,40 @@ proc savestuff {w} {\n proc resizeclistpanes {win w} {\n     global oldwidth use_ttk\n     if {[info exists oldwidth($win)]} {\n-\tif {$use_ttk} {\n-\t    set s0 [$win sashpos 0]\n-\t    set s1 [$win sashpos 1]\n-\t} else {\n-\t    set s0 [$win sash coord 0]\n-\t    set s1 [$win sash coord 1]\n-\t}\n-\tif {$w < 60} {\n-\t    set sash0 [expr {int($w/2 - 2)}]\n-\t    set sash1 [expr {int($w*5/6 - 2)}]\n-\t} else {\n-\t    set factor [expr {1.0 * $w / $oldwidth($win)}]\n-\t    set sash0 [expr {int($factor * [lindex $s0 0])}]\n-\t    set sash1 [expr {int($factor * [lindex $s1 0])}]\n-\t    if {$sash0 < 30} {\n-\t\tset sash0 30\n-\t    }\n-\t    if {$sash1 < $sash0 + 20} {\n-\t\tset sash1 [expr {$sash0 + 20}]\n-\t    }\n-\t    if {$sash1 > $w - 10} {\n-\t\tset sash1 [expr {$w - 10}]\n-\t\tif {$sash0 > $sash1 - 20} {\n-\t\t    set sash0 [expr {$sash1 - 20}]\n-\t\t}\n-\t    }\n-\t}\n-\tif {$use_ttk} {\n-\t    $win sashpos 0 $sash0\n-\t    $win sashpos 1 $sash1\n-\t} else {\n-\t    $win sash place 0 $sash0 [lindex $s0 1]\n-\t    $win sash place 1 $sash1 [lindex $s1 1]\n-\t}\n+        if {$use_ttk} {\n+            set s0 [$win sashpos 0]\n+            set s1 [$win sashpos 1]\n+        } else {\n+            set s0 [$win sash coord 0]\n+            set s1 [$win sash coord 1]\n+        }\n+        if {$w < 60} {\n+            set sash0 [expr {int($w/2 - 2)}]\n+            set sash1 [expr {int($w*5/6 - 2)}]\n+        } else {\n+            set factor [expr {1.0 * $w / $oldwidth($win)}]\n+            set sash0 [expr {int($factor * [lindex $s0 0])}]\n+            set sash1 [expr {int($factor * [lindex $s1 0])}]\n+            if {$sash0 < 30} {\n+                set sash0 30\n+            }\n+            if {$sash1 < $sash0 + 20} {\n+                set sash1 [expr {$sash0 + 20}]\n+            }\n+            if {$sash1 > $w - 10} {\n+                set sash1 [expr {$w - 10}]\n+                if {$sash0 > $sash1 - 20} {\n+                    set sash0 [expr {$sash1 - 20}]\n+                }\n+            }\n+        }\n+        if {$use_ttk} {\n+            $win sashpos 0 $sash0\n+            $win sashpos 1 $sash1\n+        } else {\n+            $win sash place 0 $sash0 [lindex $s0 1]\n+            $win sash place 1 $sash1 [lindex $s1 1]\n+        }\n     }\n     set oldwidth($win) $w\n }\n@@ -2989,28 +2989,28 @@ proc resizeclistpanes {win w} {\n proc resizecdetpanes {win w} {\n     global oldwidth use_ttk\n     if {[info exists oldwidth($win)]} {\n-\tif {$use_ttk} {\n-\t    set s0 [$win sashpos 0]\n-\t} else {\n-\t    set s0 [$win sash coord 0]\n-\t}\n-\tif {$w < 60} {\n-\t    set sash0 [expr {int($w*3/4 - 2)}]\n-\t} else {\n-\t    set factor [expr {1.0 * $w / $oldwidth($win)}]\n-\t    set sash0 [expr {int($factor * [lindex $s0 0])}]\n-\t    if {$sash0 < 45} {\n-\t\tset sash0 45\n-\t    }\n-\t    if {$sash0 > $w - 15} {\n-\t\tset sash0 [expr {$w - 15}]\n-\t    }\n-\t}\n-\tif {$use_ttk} {\n-\t    $win sashpos 0 $sash0\n-\t} else {\n-\t    $win sash place 0 $sash0 [lindex $s0 1]\n-\t}\n+        if {$use_ttk} {\n+            set s0 [$win sashpos 0]\n+        } else {\n+            set s0 [$win sash coord 0]\n+        }\n+        if {$w < 60} {\n+            set sash0 [expr {int($w*3/4 - 2)}]\n+        } else {\n+            set factor [expr {1.0 * $w / $oldwidth($win)}]\n+            set sash0 [expr {int($factor * [lindex $s0 0])}]\n+            if {$sash0 < 45} {\n+                set sash0 45\n+            }\n+            if {$sash0 > $w - 15} {\n+                set sash0 [expr {$w - 15}]\n+            }\n+        }\n+        if {$use_ttk} {\n+            $win sashpos 0 $sash0\n+        } else {\n+            $win sash place 0 $sash0 [lindex $s0 1]\n+        }\n     }\n     set oldwidth($win) $w\n }\n@@ -3033,8 +3033,8 @@ proc about {} {\n     global bgcolor NS\n     set w .about\n     if {[winfo exists $w]} {\n-\traise $w\n-\treturn\n+        raise $w\n+        return\n     }\n     ttk_toplevel $w\n     wm title $w [mc \"About gitk\"]\n@@ -3045,7 +3045,7 @@ Gitk - a commit viewer for git\n Copyright \\u00a9 2005-2016 Paul Mackerras\n \n Use and redistribute under the terms of the GNU General Public License\"] \\\n-\t    -justify center -aspect 400 -border 2 -bg $bgcolor -relief groove\n+            -justify center -aspect 400 -border 2 -bg $bgcolor -relief groove\n     pack $w.m -side top -fill x -padx 2 -pady 2\n     ${NS}::button $w.ok -text [mc \"Close\"] -command \"destroy $w\" -default active\n     pack $w.ok -side bottom\n@@ -3059,13 +3059,13 @@ proc keys {} {\n     global bgcolor NS\n     set w .keys\n     if {[winfo exists $w]} {\n-\traise $w\n-\treturn\n+        raise $w\n+        return\n     }\n     if {[tk windowingsystem] eq {aqua}} {\n-\tset M1T Cmd\n+        set M1T Cmd\n     } else {\n-\tset M1T Ctrl\n+        set M1T Ctrl\n     }\n     ttk_toplevel $w\n     wm title $w [mc \"Gitk key bindings\"]\n@@ -3112,7 +3112,7 @@ proc keys {} {\n [mc \"<%s-minus>\tDecrease font size\" $M1T]\n [mc \"<F5>\t\tUpdate\"]\n \" \\\n-\t    -justify left -bg $bgcolor -border 2 -relief groove\n+            -justify left -bg $bgcolor -border 2 -relief groove\n     pack $w.m -side top -fill both -padx 2 -pady 2\n     ${NS}::button $w.ok -text [mc \"Close\"] -command \"destroy $w\" -default active\n     bind $w <Key-Escape> [list destroy $w]\n@@ -3139,68 +3139,68 @@ proc treeview {w l openlevs} {\n     set treecontents() {}\n     $w conf -state normal\n     foreach f $l {\n-\twhile {[string range $f 0 $prefixend] ne $prefix} {\n-\t    if {$lev <= $openlevs} {\n-\t\t$w mark set e:$treeindex($prefix) \"end -1c\"\n-\t\t$w mark gravity e:$treeindex($prefix) left\n-\t    }\n-\t    set treeheight($prefix) $ht\n-\t    incr ht [lindex $htstack end]\n-\t    set htstack [lreplace $htstack end end]\n-\t    set prefixend [lindex $prefendstack end]\n-\t    set prefendstack [lreplace $prefendstack end end]\n-\t    set prefix [string range $prefix 0 $prefixend]\n-\t    incr lev -1\n-\t}\n-\tset tail [string range $f [expr {$prefixend+1}] end]\n-\twhile {[set slash [string first \"/\" $tail]] >= 0} {\n-\t    lappend htstack $ht\n-\t    set ht 0\n-\t    lappend prefendstack $prefixend\n-\t    incr prefixend [expr {$slash + 1}]\n-\t    set d [string range $tail 0 $slash]\n-\t    lappend treecontents($prefix) $d\n-\t    set oldprefix $prefix\n-\t    append prefix $d\n-\t    set treecontents($prefix) {}\n-\t    set treeindex($prefix) [incr ix]\n-\t    set treeparent($prefix) $oldprefix\n-\t    set tail [string range $tail [expr {$slash+1}] end]\n-\t    if {$lev <= $openlevs} {\n-\t\tset ht 1\n-\t\tset treediropen($prefix) [expr {$lev < $openlevs}]\n-\t\tset bm [expr {$lev == $openlevs? \"tri-rt\": \"tri-dn\"}]\n-\t\t$w mark set d:$ix \"end -1c\"\n-\t\t$w mark gravity d:$ix left\n-\t\tset str \"\\n\"\n-\t\tfor {set i 0} {$i < $lev} {incr i} {append str \"\\t\"}\n-\t\t$w insert end $str\n-\t\t$w image create end -align center -image $bm -padx 1 \\\n-\t\t    -name a:$ix\n-\t\t$w insert end $d [highlight_tag $prefix]\n-\t\t$w mark set s:$ix \"end -1c\"\n-\t\t$w mark gravity s:$ix left\n-\t    }\n-\t    incr lev\n-\t}\n-\tif {$tail ne {}} {\n-\t    if {$lev <= $openlevs} {\n-\t\tincr ht\n-\t\tset str \"\\n\"\n-\t\tfor {set i 0} {$i < $lev} {incr i} {append str \"\\t\"}\n-\t\t$w insert end $str\n-\t\t$w insert end $tail [highlight_tag $f]\n-\t    }\n-\t    lappend treecontents($prefix) $tail\n-\t}\n+        while {[string range $f 0 $prefixend] ne $prefix} {\n+            if {$lev <= $openlevs} {\n+                $w mark set e:$treeindex($prefix) \"end -1c\"\n+                $w mark gravity e:$treeindex($prefix) left\n+            }\n+            set treeheight($prefix) $ht\n+            incr ht [lindex $htstack end]\n+            set htstack [lreplace $htstack end end]\n+            set prefixend [lindex $prefendstack end]\n+            set prefendstack [lreplace $prefendstack end end]\n+            set prefix [string range $prefix 0 $prefixend]\n+            incr lev -1\n+        }\n+        set tail [string range $f [expr {$prefixend+1}] end]\n+        while {[set slash [string first \"/\" $tail]] >= 0} {\n+            lappend htstack $ht\n+            set ht 0\n+            lappend prefendstack $prefixend\n+            incr prefixend [expr {$slash + 1}]\n+            set d [string range $tail 0 $slash]\n+            lappend treecontents($prefix) $d\n+            set oldprefix $prefix\n+            append prefix $d\n+            set treecontents($prefix) {}\n+            set treeindex($prefix) [incr ix]\n+            set treeparent($prefix) $oldprefix\n+            set tail [string range $tail [expr {$slash+1}] end]\n+            if {$lev <= $openlevs} {\n+                set ht 1\n+                set treediropen($prefix) [expr {$lev < $openlevs}]\n+                set bm [expr {$lev == $openlevs? \"tri-rt\": \"tri-dn\"}]\n+                $w mark set d:$ix \"end -1c\"\n+                $w mark gravity d:$ix left\n+                set str \"\\n\"\n+                for {set i 0} {$i < $lev} {incr i} {append str \"\\t\"}\n+                $w insert end $str\n+                $w image create end -align center -image $bm -padx 1 \\\n+                    -name a:$ix\n+                $w insert end $d [highlight_tag $prefix]\n+                $w mark set s:$ix \"end -1c\"\n+                $w mark gravity s:$ix left\n+            }\n+            incr lev\n+        }\n+        if {$tail ne {}} {\n+            if {$lev <= $openlevs} {\n+                incr ht\n+                set str \"\\n\"\n+                for {set i 0} {$i < $lev} {incr i} {append str \"\\t\"}\n+                $w insert end $str\n+                $w insert end $tail [highlight_tag $f]\n+            }\n+            lappend treecontents($prefix) $tail\n+        }\n     }\n     while {$htstack ne {}} {\n-\tset treeheight($prefix) $ht\n-\tincr ht [lindex $htstack end]\n-\tset htstack [lreplace $htstack end end]\n-\tset prefixend [lindex $prefendstack end]\n-\tset prefendstack [lreplace $prefendstack end end]\n-\tset prefix [string range $prefix 0 $prefixend]\n+        set treeheight($prefix) $ht\n+        incr ht [lindex $htstack end]\n+        set htstack [lreplace $htstack end end]\n+        set prefixend [lindex $prefendstack end]\n+        set prefendstack [lreplace $prefendstack end end]\n+        set prefix [string range $prefix 0 $prefixend]\n     }\n     $w conf -state disabled\n }\n@@ -3211,21 +3211,21 @@ proc linetoelt {l} {\n     set y 2\n     set prefix {}\n     while {1} {\n-\tforeach e $treecontents($prefix) {\n-\t    if {$y == $l} {\n-\t\treturn \"$prefix$e\"\n-\t    }\n-\t    set n 1\n-\t    if {[string index $e end] eq \"/\"} {\n-\t\tset n $treeheight($prefix$e)\n-\t\tif {$y + $n > $l} {\n-\t\t    append prefix $e\n-\t\t    incr y\n-\t\t    break\n-\t\t}\n-\t    }\n-\t    incr y $n\n-\t}\n+        foreach e $treecontents($prefix) {\n+            if {$y == $l} {\n+                return \"$prefix$e\"\n+            }\n+            set n 1\n+            if {[string index $e end] eq \"/\"} {\n+                set n $treeheight($prefix$e)\n+                if {$y + $n > $l} {\n+                    append prefix $e\n+                    incr y\n+                    break\n+                }\n+            }\n+            incr y $n\n+        }\n     }\n }\n \n@@ -3233,14 +3233,14 @@ proc highlight_tree {y prefix} {\n     global treeheight treecontents cflist\n \n     foreach e $treecontents($prefix) {\n-\tset path $prefix$e\n-\tif {[highlight_tag $path] ne {}} {\n-\t    $cflist tag add bold $y.0 \"$y.0 lineend\"\n-\t}\n-\tincr y\n-\tif {[string index $e end] eq \"/\" && $treeheight($path) > 1} {\n-\t    set y [highlight_tree $y $path]\n-\t}\n+        set path $prefix$e\n+        if {[highlight_tag $path] ne {}} {\n+            $cflist tag add bold $y.0 \"$y.0 lineend\"\n+        }\n+        incr y\n+        if {[string index $e end] eq \"/\" && $treeheight($path) > 1} {\n+            set y [highlight_tree $y $path]\n+        }\n     }\n     return $y\n }\n@@ -3256,8 +3256,8 @@ proc treeclosedir {w dir} {\n     $w conf -state disabled\n     set n [expr {1 - $treeheight($dir)}]\n     while {$dir ne {}} {\n-\tincr treeheight($dir) $n\n-\tset dir $treeparent($dir)\n+        incr treeheight($dir) $n\n+        set dir $treeparent($dir)\n     }\n }\n \n@@ -3273,28 +3273,28 @@ proc treeopendir {w dir} {\n     set str \"\\n\"\n     set n [llength $treecontents($dir)]\n     for {set x $dir} {$x ne {}} {set x $treeparent($x)} {\n-\tincr lev\n-\tappend str \"\\t\"\n-\tincr treeheight($x) $n\n+        incr lev\n+        append str \"\\t\"\n+        incr treeheight($x) $n\n     }\n     foreach e $treecontents($dir) {\n-\tset de $dir$e\n-\tif {[string index $e end] eq \"/\"} {\n-\t    set iy $treeindex($de)\n-\t    $w mark set d:$iy e:$ix\n-\t    $w mark gravity d:$iy left\n-\t    $w insert e:$ix $str\n-\t    set treediropen($de) 0\n-\t    $w image create e:$ix -align center -image tri-rt -padx 1 \\\n-\t\t-name a:$iy\n-\t    $w insert e:$ix $e [highlight_tag $de]\n-\t    $w mark set s:$iy e:$ix\n-\t    $w mark gravity s:$iy left\n-\t    set treeheight($de) 1\n-\t} else {\n-\t    $w insert e:$ix $str\n-\t    $w insert e:$ix $e [highlight_tag $de]\n-\t}\n+        set de $dir$e\n+        if {[string index $e end] eq \"/\"} {\n+            set iy $treeindex($de)\n+            $w mark set d:$iy e:$ix\n+            $w mark gravity d:$iy left\n+            $w insert e:$ix $str\n+            set treediropen($de) 0\n+            $w image create e:$ix -align center -image tri-rt -padx 1 \\\n+                -name a:$iy\n+            $w insert e:$ix $e [highlight_tag $de]\n+            $w mark set s:$iy e:$ix\n+            $w mark gravity s:$iy left\n+            set treeheight($de) 1\n+        } else {\n+            $w insert e:$ix $str\n+            $w insert e:$ix $e [highlight_tag $de]\n+        }\n     }\n     $w mark gravity e:$ix right\n     $w conf -state disabled\n@@ -3303,13 +3303,13 @@ proc treeopendir {w dir} {\n     set ht [$w cget -height]\n     set l [lindex [split [$w index s:$ix] .] 0]\n     if {$l < $top} {\n-\t$w yview $l.0\n+        $w yview $l.0\n     } elseif {$l + $n + 1 > $top + $ht} {\n-\tset top [expr {$l + $n + 2 - $ht}]\n-\tif {$l < $top} {\n-\t    set top $l\n-\t}\n-\t$w yview $top.0\n+        set top [expr {$l + $n + 2 - $ht}]\n+        if {$l < $top} {\n+            set top $l\n+        }\n+        $w yview $top.0\n     }\n }\n \n@@ -3323,16 +3323,16 @@ proc treeclick {w x y} {\n     $cflist tag add highlight $l.0 \"$l.0 lineend\"\n     set cflist_top $l\n     if {$l == 1} {\n-\t$ctext yview 1.0\n-\treturn\n+        $ctext yview 1.0\n+        return\n     }\n     set e [linetoelt $l]\n     if {[string index $e end] ne \"/\"} {\n-\tshowfile $e\n+        showfile $e\n     } elseif {$treediropen($e)} {\n-\ttreeclosedir $w $e\n+        treeclosedir $w $e\n     } else {\n-\ttreeopendir $w $e\n+        treeopendir $w $e\n     }\n }\n \n@@ -3341,10 +3341,10 @@ proc setfilelist {id} {\n \n     treeview $cflist $treefilelist($id) 0\n     if {$jump_to_here ne {}} {\n-\tset f [lindex $jump_to_here 0]\n-\tif {[lsearch -exact $treefilelist($id) $f] >= 0} {\n-\t    showfile $f\n-\t}\n+        set f [lindex $jump_to_here 0]\n+        if {[lsearch -exact $treefilelist($id) $f] >= 0} {\n+            showfile $f\n+        }\n     }\n }\n \n@@ -3419,11 +3419,11 @@ proc init_flist {first} {\n     $cflist conf -state normal\n     $cflist delete 0.0 end\n     if {$first ne {}} {\n-\t$cflist insert end $first\n-\tset cflist_top 1\n-\t$cflist tag add highlight 1.0 \"1.0 lineend\"\n+        $cflist insert end $first\n+        set cflist_top 1\n+        $cflist tag add highlight 1.0 \"1.0 lineend\"\n     } else {\n-\tunset -nocomplain cflist_top\n+        unset -nocomplain cflist_top\n     }\n     $cflist conf -state disabled\n     set difffilestart {}\n@@ -3433,9 +3433,9 @@ proc highlight_tag {f} {\n     global highlight_paths\n \n     foreach p $highlight_paths {\n-\tif {[string match $p $f]} {\n-\t    return \"bold\"\n-\t}\n+        if {[string match $p $f]} {\n+            return \"bold\"\n+        }\n     }\n     return {}\n }\n@@ -3445,15 +3445,15 @@ proc highlight_filelist {} {\n \n     $cflist conf -state normal\n     if {$cmitmode ne \"tree\"} {\n-\tset end [lindex [split [$cflist index end] .] 0]\n-\tfor {set l 2} {$l < $end} {incr l} {\n-\t    set line [$cflist get $l.0 \"$l.0 lineend\"]\n-\t    if {[highlight_tag $line] ne {}} {\n-\t\t$cflist tag add bold $l.0 \"$l.0 lineend\"\n-\t    }\n-\t}\n+        set end [lindex [split [$cflist index end] .] 0]\n+        for {set l 2} {$l < $end} {incr l} {\n+            set line [$cflist get $l.0 \"$l.0 lineend\"]\n+            if {[highlight_tag $line] ne {}} {\n+                $cflist tag add bold $l.0 \"$l.0 lineend\"\n+            }\n+        }\n     } else {\n-\thighlight_tree 2 {}\n+        highlight_tree 2 {}\n     }\n     $cflist conf -state disabled\n }\n@@ -3471,8 +3471,8 @@ proc add_flist {fl} {\n \n     $cflist conf -state normal\n     foreach f $fl {\n-\t$cflist insert end \"\\n\"\n-\t$cflist insert end $f [highlight_tag $f]\n+        $cflist insert end \"\\n\"\n+        $cflist insert end $f [highlight_tag $f]\n     }\n     $cflist conf -state disabled\n }\n@@ -3487,9 +3487,9 @@ proc sel_flist {w x y} {\n     $cflist tag add highlight $l.0 \"$l.0 lineend\"\n     set cflist_top $l\n     if {$l == 1} {\n-\t$ctext yview 1.0\n+        $ctext yview 1.0\n     } else {\n-\tcatch {$ctext yview [lindex $difffilestart [expr {$l - 2}]]}\n+        catch {$ctext yview [lindex $difffilestart [expr {$l - 2}]]}\n     }\n     suppress_highlighting_file_for_current_scrollpos\n }\n@@ -3502,15 +3502,15 @@ proc pop_flist_menu {w X Y x y} {\n     set l [lindex [split [$w index \"@$x,$y\"] \".\"] 0]\n     if {$l <= 1} return\n     if {$cmitmode eq \"tree\"} {\n-\tset e [linetoelt $l]\n-\tif {[string index $e end] eq \"/\"} return\n+        set e [linetoelt $l]\n+        if {[string index $e end] eq \"/\"} return\n     } else {\n-\tset e [lindex $treediffs($diffids) [expr {$l-2}]]\n+        set e [lindex $treediffs($diffids) [expr {$l-2}]]\n     }\n     set flist_menu_file $e\n     set xdiffstate \"normal\"\n     if {$cmitmode eq \"tree\"} {\n-\tset xdiffstate \"disabled\"\n+        set xdiffstate \"disabled\"\n     }\n     # Disable \"External diff\" item in tree mode\n     $flist_menu entryconf 2 -state $xdiffstate\n@@ -3539,7 +3539,7 @@ proc pop_diff_menu {w X Y x y} {\n     set diff_menu_line [lindex $diff_menu_txtpos 0]\n     # don't pop up the menu on hunk-separator or file-separator lines\n     if {[lsearch -glob [$ctext tag names $diff_menu_line.0] \"*sep\"] >= 0} {\n-\treturn\n+        return\n     }\n     stopfinding\n     set f [find_ctext_fileinfo $diff_menu_line]\n@@ -3554,9 +3554,9 @@ proc flist_hl {only} {\n \n     set x [shellquote $flist_menu_file]\n     if {$only || $findstring eq {} || $gdttype ne [mc \"touching paths:\"]} {\n-\tset findstring $x\n+        set findstring $x\n     } else {\n-\tappend findstring \" \" $x\n+        append findstring \" \" $x\n     }\n     set gdttype [mc \"touching paths:\"]\n }\n@@ -3565,29 +3565,29 @@ proc gitknewtmpdir {} {\n     global diffnum gitktmpdir gitdir env\n \n     if {![info exists gitktmpdir]} {\n-\tif {[info exists env(GITK_TMPDIR)]} {\n-\t    set tmpdir $env(GITK_TMPDIR)\n-\t} elseif {[info exists env(TMPDIR)]} {\n-\t    set tmpdir $env(TMPDIR)\n-\t} else {\n-\t    set tmpdir $gitdir\n-\t}\n-\tset gitktmpformat [file join $tmpdir \".gitk-tmp.XXXXXX\"]\n-\tif {[catch {set gitktmpdir [exec mktemp -d $gitktmpformat]}]} {\n-\t    set gitktmpdir [file join $gitdir [format \".gitk-tmp.%s\" [pid]]]\n-\t}\n-\tif {[catch {file mkdir $gitktmpdir} err]} {\n-\t    error_popup \"[mc \"Error creating temporary directory %s:\" $gitktmpdir] $err\"\n-\t    unset gitktmpdir\n-\t    return {}\n-\t}\n-\tset diffnum 0\n+        if {[info exists env(GITK_TMPDIR)]} {\n+            set tmpdir $env(GITK_TMPDIR)\n+        } elseif {[info exists env(TMPDIR)]} {\n+            set tmpdir $env(TMPDIR)\n+        } else {\n+            set tmpdir $gitdir\n+        }\n+        set gitktmpformat [file join $tmpdir \".gitk-tmp.XXXXXX\"]\n+        if {[catch {set gitktmpdir [exec mktemp -d $gitktmpformat]}]} {\n+            set gitktmpdir [file join $gitdir [format \".gitk-tmp.%s\" [pid]]]\n+        }\n+        if {[catch {file mkdir $gitktmpdir} err]} {\n+            error_popup \"[mc \"Error creating temporary directory %s:\" $gitktmpdir] $err\"\n+            unset gitktmpdir\n+            return {}\n+        }\n+        set diffnum 0\n     }\n     incr diffnum\n     set diffdir [file join $gitktmpdir $diffnum]\n     if {[catch {file mkdir $diffdir} err]} {\n-\terror_popup \"[mc \"Error creating temporary directory %s:\" $diffdir] $err\"\n-\treturn {}\n+        error_popup \"[mc \"Error creating temporary directory %s:\" $diffdir] $err\"\n+        return {}\n     }\n     return $diffdir\n }\n@@ -3596,11 +3596,11 @@ proc save_file_from_commit {filename output what} {\n     global nullfile\n \n     if {[catch {exec git show $filename -- > $output} err]} {\n-\tif {[string match \"fatal: bad revision *\" $err]} {\n-\t    return $nullfile\n-\t}\n-\terror_popup \"[mc \"Error getting \\\"%s\\\" from %s:\" $filename $what] $err\"\n-\treturn {}\n+        if {[string match \"fatal: bad revision *\" $err]} {\n+            return $nullfile\n+        }\n+        error_popup \"[mc \"Error getting \\\"%s\\\" from %s:\" $filename $what] $err\"\n+        return {}\n     }\n     return $output\n }\n@@ -3611,10 +3611,10 @@ proc external_diff_get_one_file {diffid filename diffdir} {\n \n     if {$diffid == $nullid} {\n         set difffile [file join $worktree $filename]\n-\tif {[file exists $difffile]} {\n-\t    return $difffile\n-\t}\n-\treturn $nullfile\n+        if {[file exists $difffile]} {\n+            return $difffile\n+        }\n+        return $nullfile\n     }\n     if {$diffid == $nullid2} {\n         set difffile [file join $diffdir \"\\[index\\] [file tail $filename]\"]\n@@ -3622,7 +3622,7 @@ proc external_diff_get_one_file {diffid filename diffdir} {\n     }\n     set difffile [file join $diffdir \"\\[$diffid\\] [file tail $filename]\"]\n     return [save_file_from_commit $diffid:$filename $difffile \\\n-\t       \"revision $diffid\"]\n+               \"revision $diffid\"]\n }\n \n proc external_diff {} {\n@@ -3679,18 +3679,18 @@ proc find_hunk_blamespec {base line} {\n \n     set s_line [$ctext get $s_lix \"$s_lix + 1 lines\"]\n     if {![regexp {^@@@*(( -\\d+(,\\d+)?)+) \\+(\\d+)(,\\d+)? @@} $s_line \\\n-\t    s_line old_specs osz osz1 new_line nsz]} {\n-\treturn\n+            s_line old_specs osz osz1 new_line nsz]} {\n+        return\n     }\n \n     # base lines for the parents\n     set base_lines [list $new_line]\n     foreach old_spec [lrange [split $old_specs \" \"] 1 end] {\n-\tif {![regexp -- {-(\\d+)(,\\d+)?} $old_spec \\\n-\t        old_spec old_line osz]} {\n-\t    return\n-\t}\n-\tlappend base_lines $old_line\n+        if {![regexp -- {-(\\d+)(,\\d+)?} $old_spec \\\n+                old_spec old_line osz]} {\n+            return\n+        }\n+        lappend base_lines $old_line\n     }\n \n     # Now scan the lines to determine offset within the hunk\n@@ -3701,38 +3701,38 @@ proc find_hunk_blamespec {base line} {\n     # Determine if the line is removed\n     set chunk [$ctext get $line.0 \"$line.1 + $max_parent chars\"]\n     if {[string match {[-+ ]*} $chunk]} {\n-\tset removed_idx [string first \"-\" $chunk]\n-\t# Choose a parent index\n-\tif {$removed_idx >= 0} {\n-\t    set parent $removed_idx\n-\t} else {\n-\t    set unchanged_idx [string first \" \" $chunk]\n-\t    if {$unchanged_idx >= 0} {\n-\t\tset parent $unchanged_idx\n-\t    } else {\n-\t\t# blame the current commit\n-\t\tset parent -1\n-\t    }\n-\t}\n-\t# then count other lines that belong to it\n-\tfor {set i $line} {[incr i -1] > $s_lno} {} {\n-\t    set chunk [$ctext get $i.0 \"$i.1 + $max_parent chars\"]\n-\t    # Determine if the line is removed\n-\t    set removed_idx [string first \"-\" $chunk]\n-\t    if {$parent >= 0} {\n-\t\tset code [string index $chunk $parent]\n-\t\tif {$code eq \"-\" || ($removed_idx < 0 && $code ne \"+\")} {\n-\t\t    incr dline\n-\t\t}\n-\t    } else {\n-\t\tif {$removed_idx < 0} {\n-\t\t    incr dline\n-\t\t}\n-\t    }\n-\t}\n-\tincr parent\n+        set removed_idx [string first \"-\" $chunk]\n+        # Choose a parent index\n+        if {$removed_idx >= 0} {\n+            set parent $removed_idx\n+        } else {\n+            set unchanged_idx [string first \" \" $chunk]\n+            if {$unchanged_idx >= 0} {\n+                set parent $unchanged_idx\n+            } else {\n+                # blame the current commit\n+                set parent -1\n+            }\n+        }\n+        # then count other lines that belong to it\n+        for {set i $line} {[incr i -1] > $s_lno} {} {\n+            set chunk [$ctext get $i.0 \"$i.1 + $max_parent chars\"]\n+            # Determine if the line is removed\n+            set removed_idx [string first \"-\" $chunk]\n+            if {$parent >= 0} {\n+                set code [string index $chunk $parent]\n+                if {$code eq \"-\" || ($removed_idx < 0 && $code ne \"+\")} {\n+                    incr dline\n+                }\n+            } else {\n+                if {$removed_idx < 0} {\n+                    incr dline\n+                }\n+            }\n+        }\n+        incr parent\n     } else {\n-\tset parent 0\n+        set parent 0\n     }\n \n     incr dline [lindex $base_lines $parent]\n@@ -3745,17 +3745,17 @@ proc external_blame_diff {} {\n     global diff_menu_filebase flist_menu_file\n \n     if {$cmitmode eq \"tree\"} {\n-\tset parent_idx 0\n-\tset line [expr {$diff_menu_line - $diff_menu_filebase}]\n+        set parent_idx 0\n+        set line [expr {$diff_menu_line - $diff_menu_filebase}]\n     } else {\n-\tset hinfo [find_hunk_blamespec $diff_menu_filebase $diff_menu_line]\n-\tif {$hinfo ne {}} {\n-\t    set parent_idx [lindex $hinfo 0]\n-\t    set line [lindex $hinfo 1]\n-\t} else {\n-\t    set parent_idx 0\n-\t    set line 0\n-\t}\n+        set hinfo [find_hunk_blamespec $diff_menu_filebase $diff_menu_line]\n+        if {$hinfo ne {}} {\n+            set parent_idx [lindex $hinfo 0]\n+            set line [lindex $hinfo 1]\n+        } else {\n+            set parent_idx 0\n+            set line 0\n+        }\n     }\n \n     external_blame $parent_idx $line\n@@ -3766,12 +3766,12 @@ proc external_blame_diff {} {\n proc index_sha1 {fname} {\n     set f [open [list | git ls-files -s $fname] r]\n     while {[gets $f line] >= 0} {\n-\tset info [lindex [split $line \"\\t\"] 0]\n-\tset stage [lindex $info 2]\n-\tif {$stage eq \"0\" || $stage eq \"2\"} {\n-\t    close $f\n-\t    return [lindex $info 1]\n-\t}\n+        set info [lindex [split $line \"\\t\"] 0]\n+        set stage [lindex $info 2]\n+        if {$stage eq \"0\" || $stage eq \"2\"} {\n+            close $f\n+            return [lindex $info 1]\n+        }\n     }\n     close $f\n     return {}\n@@ -3780,7 +3780,7 @@ proc index_sha1 {fname} {\n # Turn an absolute path into one relative to the current directory\n proc make_relative {f} {\n     if {[file pathtype $f] eq \"relative\"} {\n-\treturn $f\n+        return $f\n     }\n     set elts [file split $f]\n     set here [file split [pwd]]\n@@ -3788,12 +3788,12 @@ proc make_relative {f} {\n     set hi 0\n     set res {}\n     foreach d $here {\n-\tif {$ei < $hi || $ei >= [llength $elts] || [lindex $elts $ei] ne $d} {\n-\t    lappend res \"..\"\n-\t} else {\n-\t    incr ei\n-\t}\n-\tincr hi\n+        if {$ei < $hi || $ei >= [llength $elts] || [lindex $elts $ei] ne $d} {\n+            lappend res \"..\"\n+        } else {\n+            incr ei\n+        }\n+        incr hi\n     }\n     set elts [concat $res [lrange $elts $ei end]]\n     return [eval file join $elts]\n@@ -3805,19 +3805,19 @@ proc external_blame {parent_idx {line {}}} {\n     global parentlist selectedline currentid\n \n     if {$parent_idx > 0} {\n-\tset base_commit [lindex $parentlist $selectedline [expr {$parent_idx-1}]]\n+        set base_commit [lindex $parentlist $selectedline [expr {$parent_idx-1}]]\n     } else {\n-\tset base_commit $currentid\n+        set base_commit $currentid\n     }\n \n     if {$base_commit eq {} || $base_commit eq $nullid || $base_commit eq $nullid2} {\n-\terror_popup [mc \"No such commit\"]\n-\treturn\n+        error_popup [mc \"No such commit\"]\n+        return\n     }\n \n     set cmdline [list git gui blame]\n     if {$line ne {} && $line > 1} {\n-\tlappend cmdline \"--line=$line\"\n+        lappend cmdline \"--line=$line\"\n     }\n     set f [file join $cdup $flist_menu_file]\n     # Unfortunately it seems git gui blame doesn't like\n@@ -3825,7 +3825,7 @@ proc external_blame {parent_idx {line {}}} {\n     set f [make_relative $f]\n     lappend cmdline $base_commit $f\n     if {[catch {eval exec $cmdline &} err]} {\n-\terror_popup \"[mc \"git gui blame: command failed:\"] $err\"\n+        error_popup \"[mc \"git gui blame: command failed:\"] $err\"\n     }\n }\n \n@@ -3836,61 +3836,61 @@ proc show_line_source {} {\n \n     set from_index {}\n     if {$cmitmode eq \"tree\"} {\n-\tset id $currentid\n-\tset line [expr {$diff_menu_line - $diff_menu_filebase}]\n+        set id $currentid\n+        set line [expr {$diff_menu_line - $diff_menu_filebase}]\n     } else {\n-\tset h [find_hunk_blamespec $diff_menu_filebase $diff_menu_line]\n-\tif {$h eq {}} return\n-\tset pi [lindex $h 0]\n-\tif {$pi == 0} {\n-\t    mark_ctext_line $diff_menu_line\n-\t    return\n-\t}\n-\tincr pi -1\n-\tif {$currentid eq $nullid} {\n-\t    if {$pi > 0} {\n-\t\t# must be a merge in progress...\n-\t\tif {[catch {\n-\t\t    # get the last line from .git/MERGE_HEAD\n-\t\t    set f [open [file join $gitdir MERGE_HEAD] r]\n-\t\t    set id [lindex [split [read $f] \"\\n\"] end-1]\n-\t\t    close $f\n-\t\t} err]} {\n-\t\t    error_popup [mc \"Couldn't read merge head: %s\" $err]\n-\t\t    return\n-\t\t}\n-\t    } elseif {$parents($curview,$currentid) eq $nullid2} {\n-\t\t# need to do the blame from the index\n-\t\tif {[catch {\n-\t\t    set from_index [index_sha1 $flist_menu_file]\n-\t\t} err]} {\n-\t\t    error_popup [mc \"Error reading index: %s\" $err]\n-\t\t    return\n-\t\t}\n-\t    } else {\n-\t\tset id $parents($curview,$currentid)\n-\t    }\n-\t} else {\n-\t    set id [lindex $parents($curview,$currentid) $pi]\n-\t}\n-\tset line [lindex $h 1]\n+        set h [find_hunk_blamespec $diff_menu_filebase $diff_menu_line]\n+        if {$h eq {}} return\n+        set pi [lindex $h 0]\n+        if {$pi == 0} {\n+            mark_ctext_line $diff_menu_line\n+            return\n+        }\n+        incr pi -1\n+        if {$currentid eq $nullid} {\n+            if {$pi > 0} {\n+                # must be a merge in progress...\n+                if {[catch {\n+                    # get the last line from .git/MERGE_HEAD\n+                    set f [open [file join $gitdir MERGE_HEAD] r]\n+                    set id [lindex [split [read $f] \"\\n\"] end-1]\n+                    close $f\n+                } err]} {\n+                    error_popup [mc \"Couldn't read merge head: %s\" $err]\n+                    return\n+                }\n+            } elseif {$parents($curview,$currentid) eq $nullid2} {\n+                # need to do the blame from the index\n+                if {[catch {\n+                    set from_index [index_sha1 $flist_menu_file]\n+                } err]} {\n+                    error_popup [mc \"Error reading index: %s\" $err]\n+                    return\n+                }\n+            } else {\n+                set id $parents($curview,$currentid)\n+            }\n+        } else {\n+            set id [lindex $parents($curview,$currentid) $pi]\n+        }\n+        set line [lindex $h 1]\n     }\n     set blameargs {}\n     if {$from_index ne {}} {\n-\tlappend blameargs | git cat-file blob $from_index\n+        lappend blameargs | git cat-file blob $from_index\n     }\n     lappend blameargs | git blame -p -L$line,+1\n     if {$from_index ne {}} {\n-\tlappend blameargs --contents -\n+        lappend blameargs --contents -\n     } else {\n-\tlappend blameargs $id\n+        lappend blameargs $id\n     }\n     lappend blameargs -- [file join $cdup $flist_menu_file]\n     if {[catch {\n-\tset f [open $blameargs r]\n+        set f [open $blameargs r]\n     } err]} {\n-\terror_popup [mc \"Couldn't start git blame: %s\" $err]\n-\treturn\n+        error_popup [mc \"Couldn't start git blame: %s\" $err]\n+        return\n     }\n     nowbusy blaming [mc \"Searching\"]\n     fconfigure $f -blocking 0\n@@ -3904,9 +3904,9 @@ proc stopblaming {} {\n     global blameinst\n \n     if {[info exists blameinst]} {\n-\tstop_instance $blameinst\n-\tunset blameinst\n-\tnotbusy blaming\n+        stop_instance $blameinst\n+        unset blameinst\n+        notbusy blaming\n     }\n }\n \n@@ -3914,18 +3914,18 @@ proc read_line_source {fd inst} {\n     global blamestuff curview commfd blameinst nullid nullid2\n \n     while {[gets $fd line] >= 0} {\n-\tlappend blamestuff($inst) $line\n+        lappend blamestuff($inst) $line\n     }\n     if {![eof $fd]} {\n-\treturn 1\n+        return 1\n     }\n     unset commfd($inst)\n     unset blameinst\n     notbusy blaming\n     fconfigure $fd -blocking 1\n     if {[catch {close $fd} err]} {\n-\terror_popup [mc \"Error running git blame: %s\" $err]\n-\treturn 0\n+        error_popup [mc \"Error running git blame: %s\" $err]\n+        return 0\n     }\n \n     set fname {}\n@@ -3933,30 +3933,30 @@ proc read_line_source {fd inst} {\n     set id [lindex $line 0]\n     set lnum [lindex $line 1]\n     if {[string length $id] == 40 && [string is xdigit $id] &&\n-\t[string is digit -strict $lnum]} {\n-\t# look for \"filename\" line\n-\tforeach l $blamestuff($inst) {\n-\t    if {[string match \"filename *\" $l]} {\n-\t\tset fname [string range $l 9 end]\n-\t\tbreak\n-\t    }\n-\t}\n+        [string is digit -strict $lnum]} {\n+        # look for \"filename\" line\n+        foreach l $blamestuff($inst) {\n+            if {[string match \"filename *\" $l]} {\n+                set fname [string range $l 9 end]\n+                break\n+            }\n+        }\n     }\n     if {$fname ne {}} {\n-\t# all looks good, select it\n-\tif {$id eq $nullid} {\n-\t    # blame uses all-zeroes to mean not committed,\n-\t    # which would mean a change in the index\n-\t    set id $nullid2\n-\t}\n-\tif {[commitinview $id $curview]} {\n-\t    selectline [rowofcommit $id] 1 [list $fname $lnum] 1\n-\t} else {\n-\t    error_popup [mc \"That line comes from commit %s, \\\n-\t\t\t     which is not in this view\" [shortids $id]]\n-\t}\n+        # all looks good, select it\n+        if {$id eq $nullid} {\n+            # blame uses all-zeroes to mean not committed,\n+            # which would mean a change in the index\n+            set id $nullid2\n+        }\n+        if {[commitinview $id $curview]} {\n+            selectline [rowofcommit $id] 1 [list $fname $lnum] 1\n+        } else {\n+            error_popup [mc \"That line comes from commit %s, \\\n+                             which is not in this view\" [shortids $id]]\n+        }\n     } else {\n-\tputs \"oops couldn't parse git blame output\"\n+        puts \"oops couldn't parse git blame output\"\n     }\n     return 0\n }\n@@ -3965,11 +3965,11 @@ proc read_line_source {fd inst} {\n proc delete_at_eof {f dir} {\n     while {[gets $f line] >= 0} {}\n     if {[eof $f]} {\n-\tif {[catch {close $f} err]} {\n-\t    error_popup \"[mc \"External diff viewer failed:\"] $err\"\n-\t}\n-\tfile delete -force $dir\n-\treturn 0\n+        if {[catch {close $f} err]} {\n+            error_popup \"[mc \"External diff viewer failed:\"] $err\"\n+        }\n+        file delete -force $dir\n+        return 0\n     }\n     return 1\n }\n@@ -3978,13 +3978,13 @@ proc delete_at_eof {f dir} {\n \n proc shellquote {str} {\n     if {![string match \"*\\['\\\"\\\\ \\t]*\" $str]} {\n-\treturn $str\n+        return $str\n     }\n     if {![string match \"*\\['\\\"\\\\]*\" $str]} {\n-\treturn \"\\\"$str\\\"\"\n+        return \"\\\"$str\\\"\"\n     }\n     if {![string match \"*'*\" $str]} {\n-\treturn \"'$str'\"\n+        return \"'$str'\"\n     }\n     return \"\\\"[string map {\\\" \\\\\\\" \\\\ \\\\\\\\} $str]\\\"\"\n }\n@@ -3992,10 +3992,10 @@ proc shellquote {str} {\n proc shellarglist {l} {\n     set str {}\n     foreach a $l {\n-\tif {$str ne {}} {\n-\t    append str \" \"\n-\t}\n-\tappend str [shellquote $a]\n+        if {$str ne {}} {\n+            append str \" \"\n+        }\n+        append str [shellquote $a]\n     }\n     return $str\n }\n@@ -4004,52 +4004,52 @@ proc shelldequote {str} {\n     set ret {}\n     set used -1\n     while {1} {\n-\tincr used\n-\tif {![regexp -start $used -indices \"\\['\\\"\\\\\\\\ \\t]\" $str first]} {\n-\t    append ret [string range $str $used end]\n-\t    set used [string length $str]\n-\t    break\n-\t}\n-\tset first [lindex $first 0]\n-\tset ch [string index $str $first]\n-\tif {$first > $used} {\n-\t    append ret [string range $str $used [expr {$first - 1}]]\n-\t    set used $first\n-\t}\n-\tif {$ch eq \" \" || $ch eq \"\\t\"} break\n-\tincr used\n-\tif {$ch eq \"'\"} {\n-\t    set first [string first \"'\" $str $used]\n-\t    if {$first < 0} {\n-\t\terror \"unmatched single-quote\"\n-\t    }\n-\t    append ret [string range $str $used [expr {$first - 1}]]\n-\t    set used $first\n-\t    continue\n-\t}\n-\tif {$ch eq \"\\\\\"} {\n-\t    if {$used >= [string length $str]} {\n-\t\terror \"trailing backslash\"\n-\t    }\n-\t    append ret [string index $str $used]\n-\t    continue\n-\t}\n-\t# here ch == \"\\\"\"\n-\twhile {1} {\n-\t    if {![regexp -start $used -indices \"\\[\\\"\\\\\\\\]\" $str first]} {\n-\t\terror \"unmatched double-quote\"\n-\t    }\n-\t    set first [lindex $first 0]\n-\t    set ch [string index $str $first]\n-\t    if {$first > $used} {\n-\t\tappend ret [string range $str $used [expr {$first - 1}]]\n-\t\tset used $first\n-\t    }\n-\t    if {$ch eq \"\\\"\"} break\n-\t    incr used\n-\t    append ret [string index $str $used]\n-\t    incr used\n-\t}\n+        incr used\n+        if {![regexp -start $used -indices \"\\['\\\"\\\\\\\\ \\t]\" $str first]} {\n+            append ret [string range $str $used end]\n+            set used [string length $str]\n+            break\n+        }\n+        set first [lindex $first 0]\n+        set ch [string index $str $first]\n+        if {$first > $used} {\n+            append ret [string range $str $used [expr {$first - 1}]]\n+            set used $first\n+        }\n+        if {$ch eq \" \" || $ch eq \"\\t\"} break\n+        incr used\n+        if {$ch eq \"'\"} {\n+            set first [string first \"'\" $str $used]\n+            if {$first < 0} {\n+                error \"unmatched single-quote\"\n+            }\n+            append ret [string range $str $used [expr {$first - 1}]]\n+            set used $first\n+            continue\n+        }\n+        if {$ch eq \"\\\\\"} {\n+            if {$used >= [string length $str]} {\n+                error \"trailing backslash\"\n+            }\n+            append ret [string index $str $used]\n+            continue\n+        }\n+        # here ch == \"\\\"\"\n+        while {1} {\n+            if {![regexp -start $used -indices \"\\[\\\"\\\\\\\\]\" $str first]} {\n+                error \"unmatched double-quote\"\n+            }\n+            set first [lindex $first 0]\n+            set ch [string index $str $first]\n+            if {$first > $used} {\n+                append ret [string range $str $used [expr {$first - 1}]]\n+                set used $first\n+            }\n+            if {$ch eq \"\\\"\"} break\n+            incr used\n+            append ret [string index $str $used]\n+            incr used\n+        }\n     }\n     return [list $used $ret]\n }\n@@ -4057,13 +4057,13 @@ proc shelldequote {str} {\n proc shellsplit {str} {\n     set l {}\n     while {1} {\n-\tset str [string trimleft $str]\n-\tif {$str eq {}} break\n-\tset dq [shelldequote $str]\n-\tset n [lindex $dq 0]\n-\tset word [lindex $dq 1]\n-\tset str [string range $str $n end]\n-\tlappend l $word\n+        set str [string trimleft $str]\n+        if {$str eq {}} break\n+        set dq [shelldequote $str]\n+        set n [lindex $dq 0]\n+        set word [lindex $dq 1]\n+        set str [string range $str $n end]\n+        lappend l $word\n     }\n     return $l\n }\n@@ -4072,11 +4072,11 @@ proc set_window_title {} {\n     global appname curview viewname vrevs\n     set rev [mc \"All files\"]\n     if {$curview ne 0} {\n-\tif {$viewname($curview) eq [mc \"Command line\"]} {\n-\t    set rev [string map {\"--gitk-symmetric-diff-marker\" \"--merge\"} $vrevs($curview)]\n-\t} else {\n-\t    set rev $viewname($curview)\n-\t}\n+        if {$viewname($curview) eq [mc \"Command line\"]} {\n+            set rev [string map {\"--gitk-symmetric-diff-marker\" \"--merge\"} $vrevs($curview)]\n+        } else {\n+            set rev $viewname($curview)\n+        }\n     }\n     wm title . \"[reponame]: $rev - $appname\"\n }\n@@ -4090,8 +4090,8 @@ proc newview {ishighlight} {\n     set newishighlight $ishighlight\n     set top .gitkview\n     if {[winfo exists $top]} {\n-\traise $top\n-\treturn\n+        raise $top\n+        return\n     }\n     decode_view_opts $nextviewnum $revtreeargs\n     set newviewname($nextviewnum) \"[mc \"View\"] $nextviewnum\"\n@@ -4140,29 +4140,29 @@ proc encode_view_opts {n} {\n \n     set rargs [list]\n     foreach opt $known_view_options {\n-\tset patterns [lindex $opt 3]\n-\tif {$patterns eq {}} continue\n-\tset pattern [lindex $patterns 0]\n+        set patterns [lindex $opt 3]\n+        if {$patterns eq {}} continue\n+        set pattern [lindex $patterns 0]\n \n-\tif {[lindex $opt 1] eq \"b\"} {\n-\t    set val $newviewopts($n,[lindex $opt 0])\n-\t    if {$val} {\n-\t\tlappend rargs $pattern\n-\t    }\n-\t} elseif {[regexp {^r(\\d+)$} [lindex $opt 1] type value]} {\n-\t    regexp {^(.*_)} [lindex $opt 0] uselessvar button_id\n-\t    set val $newviewopts($n,$button_id)\n-\t    if {$val eq $value} {\n-\t\tlappend rargs $pattern\n-\t    }\n-\t} else {\n-\t    set val $newviewopts($n,[lindex $opt 0])\n-\t    set val [string trim $val]\n-\t    if {$val ne {}} {\n-\t\tset pfix [string range $pattern 0 end-1]\n-\t\tlappend rargs $pfix$val\n-\t    }\n-\t}\n+        if {[lindex $opt 1] eq \"b\"} {\n+            set val $newviewopts($n,[lindex $opt 0])\n+            if {$val} {\n+                lappend rargs $pattern\n+            }\n+        } elseif {[regexp {^r(\\d+)$} [lindex $opt 1] type value]} {\n+            regexp {^(.*_)} [lindex $opt 0] uselessvar button_id\n+            set val $newviewopts($n,$button_id)\n+            if {$val eq $value} {\n+                lappend rargs $pattern\n+            }\n+        } else {\n+            set val $newviewopts($n,[lindex $opt 0])\n+            set val [string trim $val]\n+            if {$val ne {}} {\n+                set pfix [string range $pattern 0 end-1]\n+                lappend rargs $pfix$val\n+            }\n+        }\n     }\n     set rargs [concat $rargs [shellsplit $newviewopts($n,refs)]]\n     return [concat $rargs [shellsplit $newviewopts($n,args)]]\n@@ -4173,59 +4173,59 @@ proc decode_view_opts {n view_args} {\n     global known_view_options newviewopts\n \n     foreach opt $known_view_options {\n-\tset id [lindex $opt 0]\n-\tif {[lindex $opt 1] eq \"b\"} {\n-\t    # Checkboxes\n-\t    set val 0\n+        set id [lindex $opt 0]\n+        if {[lindex $opt 1] eq \"b\"} {\n+            # Checkboxes\n+            set val 0\n         } elseif {[regexp {^r(\\d+)$} [lindex $opt 1]]} {\n-\t    # Radiobuttons\n-\t    regexp {^(.*_)} $id uselessvar id\n-\t    set val 0\n-\t} else {\n-\t    # Text fields\n-\t    set val {}\n-\t}\n-\tset newviewopts($n,$id) $val\n+            # Radiobuttons\n+            regexp {^(.*_)} $id uselessvar id\n+            set val 0\n+        } else {\n+            # Text fields\n+            set val {}\n+        }\n+        set newviewopts($n,$id) $val\n     }\n     set oargs [list]\n     set refargs [list]\n     foreach arg $view_args {\n-\tif {[regexp -- {^-([0-9]+)$} $arg arg cnt]\n-\t    && ![info exists found(limit)]} {\n-\t    set newviewopts($n,limit) $cnt\n-\t    set found(limit) 1\n-\t    continue\n-\t}\n-\tcatch { unset val }\n-\tforeach opt $known_view_options {\n-\t    set id [lindex $opt 0]\n-\t    if {[info exists found($id)]} continue\n-\t    foreach pattern [lindex $opt 3] {\n-\t\tif {![string match $pattern $arg]} continue\n-\t\tif {[lindex $opt 1] eq \"b\"} {\n-\t\t    # Check buttons\n-\t\t    set val 1\n-\t\t} elseif {[regexp {^r(\\d+)$} [lindex $opt 1] match num]} {\n-\t\t    # Radio buttons\n-\t\t    regexp {^(.*_)} $id uselessvar id\n-\t\t    set val $num\n-\t\t} else {\n-\t\t    # Text input fields\n-\t\t    set size [string length $pattern]\n-\t\t    set val [string range $arg [expr {$size-1}] end]\n-\t\t}\n-\t\tset newviewopts($n,$id) $val\n-\t\tset found($id) 1\n-\t\tbreak\n-\t    }\n-\t    if {[info exists val]} break\n-\t}\n-\tif {[info exists val]} continue\n-\tif {[regexp {^-} $arg]} {\n-\t    lappend oargs $arg\n-\t} else {\n-\t    lappend refargs $arg\n-\t}\n+        if {[regexp -- {^-([0-9]+)$} $arg arg cnt]\n+            && ![info exists found(limit)]} {\n+            set newviewopts($n,limit) $cnt\n+            set found(limit) 1\n+            continue\n+        }\n+        catch { unset val }\n+        foreach opt $known_view_options {\n+            set id [lindex $opt 0]\n+            if {[info exists found($id)]} continue\n+            foreach pattern [lindex $opt 3] {\n+                if {![string match $pattern $arg]} continue\n+                if {[lindex $opt 1] eq \"b\"} {\n+                    # Check buttons\n+                    set val 1\n+                } elseif {[regexp {^r(\\d+)$} [lindex $opt 1] match num]} {\n+                    # Radio buttons\n+                    regexp {^(.*_)} $id uselessvar id\n+                    set val $num\n+                } else {\n+                    # Text input fields\n+                    set size [string length $pattern]\n+                    set val [string range $arg [expr {$size-1}] end]\n+                }\n+                set newviewopts($n,$id) $val\n+                set found($id) 1\n+                break\n+            }\n+            if {[info exists val]} break\n+        }\n+        if {[info exists val]} continue\n+        if {[regexp {^-} $arg]} {\n+            lappend oargs $arg\n+        } else {\n+            lappend refargs $arg\n+        }\n     }\n     set newviewopts($n,refs) [shellarglist $refargs]\n     set newviewopts($n,args) [shellarglist $oargs]\n@@ -4235,9 +4235,9 @@ proc edit_or_newview {} {\n     global curview\n \n     if {$curview > 0} {\n-\teditview\n+        editview\n     } else {\n-\tnewview 0\n+        newview 0\n     }\n }\n \n@@ -4248,8 +4248,8 @@ proc editview {} {\n \n     set top .gitkvedit-$curview\n     if {[winfo exists $top]} {\n-\traise $top\n-\treturn\n+        raise $top\n+        return\n     }\n     decode_view_opts $curview $viewargs($curview)\n     set newviewname($curview)      $viewname($curview)\n@@ -4279,66 +4279,66 @@ proc vieweditor {top n title} {\n     set cexpand 0\n     set cnt 0\n     foreach opt $known_view_options {\n-\tset id [lindex $opt 0]\n-\tset type [lindex $opt 1]\n-\tset flags [lindex $opt 2]\n-\tset title [eval [lindex $opt 4]]\n-\tset lxpad 0\n+        set id [lindex $opt 0]\n+        set type [lindex $opt 1]\n+        set flags [lindex $opt 2]\n+        set title [eval [lindex $opt 4]]\n+        set lxpad 0\n \n-\tif {$flags eq \"+\" || $flags eq \"*\"} {\n-\t    set cframe $top.fr$cnt\n-\t    incr cnt\n-\t    ${NS}::frame $cframe\n-\t    pack $cframe -in $top -fill x -pady 3 -padx 3\n-\t    set cexpand [expr {$flags eq \"*\"}]\n+        if {$flags eq \"+\" || $flags eq \"*\"} {\n+            set cframe $top.fr$cnt\n+            incr cnt\n+            ${NS}::frame $cframe\n+            pack $cframe -in $top -fill x -pady 3 -padx 3\n+            set cexpand [expr {$flags eq \"*\"}]\n         } elseif {$flags eq \"..\" || $flags eq \"*.\"} {\n-\t    set cframe $top.fr$cnt\n-\t    incr cnt\n-\t    ${NS}::frame $cframe\n-\t    pack $cframe -in $top -fill x -pady 3 -padx [list 15 3]\n-\t    set cexpand [expr {$flags eq \"*.\"}]\n-\t} else {\n-\t    set lxpad 5\n-\t}\n+            set cframe $top.fr$cnt\n+            incr cnt\n+            ${NS}::frame $cframe\n+            pack $cframe -in $top -fill x -pady 3 -padx [list 15 3]\n+            set cexpand [expr {$flags eq \"*.\"}]\n+        } else {\n+            set lxpad 5\n+        }\n \n-\tif {$type eq \"l\"} {\n+        if {$type eq \"l\"} {\n             ${NS}::label $cframe.l_$id -text $title\n             pack $cframe.l_$id -in $cframe -side left -pady [list 3 0] -anchor w\n-\t} elseif {$type eq \"b\"} {\n-\t    ${NS}::checkbutton $cframe.c_$id -text $title -variable newviewopts($n,$id)\n-\t    pack $cframe.c_$id -in $cframe -side left \\\n-\t\t-padx [list $lxpad 0] -expand $cexpand -anchor w\n-\t} elseif {[regexp {^r(\\d+)$} $type type sz]} {\n-\t    regexp {^(.*_)} $id uselessvar button_id\n-\t    ${NS}::radiobutton $cframe.c_$id -text $title -variable newviewopts($n,$button_id) -value $sz\n-\t    pack $cframe.c_$id -in $cframe -side left \\\n-\t\t-padx [list $lxpad 0] -expand $cexpand -anchor w\n-\t} elseif {[regexp {^t(\\d+)$} $type type sz]} {\n-\t    ${NS}::label $cframe.l_$id -text $title\n-\t    ${NS}::entry $cframe.e_$id -width $sz -background $bgcolor \\\n-\t\t-textvariable newviewopts($n,$id)\n-\t    pack $cframe.l_$id -in $cframe -side left -padx [list $lxpad 0]\n-\t    pack $cframe.e_$id -in $cframe -side left -expand 1 -fill x\n-\t} elseif {[regexp {^t(\\d+)=$} $type type sz]} {\n-\t    ${NS}::label $cframe.l_$id -text $title\n-\t    ${NS}::entry $cframe.e_$id -width $sz -background $bgcolor \\\n-\t\t-textvariable newviewopts($n,$id)\n-\t    pack $cframe.l_$id -in $cframe -side top -pady [list 3 0] -anchor w\n-\t    pack $cframe.e_$id -in $cframe -side top -fill x\n-\t} elseif {$type eq \"path\"} {\n-\t    ${NS}::label $top.l -text $title\n-\t    pack $top.l -in $top -side top -pady [list 3 0] -anchor w -padx 3\n-\t    text $top.t -width 40 -height 5 -background $bgcolor\n-\t    if {[info exists viewfiles($n)]} {\n-\t\tforeach f $viewfiles($n) {\n-\t\t    $top.t insert end $f\n-\t\t    $top.t insert end \"\\n\"\n-\t\t}\n-\t\t$top.t delete {end - 1c} end\n-\t\t$top.t mark set insert 0.0\n-\t    }\n-\t    pack $top.t -in $top -side top -pady [list 0 5] -fill both -expand 1 -padx 3\n-\t}\n+        } elseif {$type eq \"b\"} {\n+            ${NS}::checkbutton $cframe.c_$id -text $title -variable newviewopts($n,$id)\n+            pack $cframe.c_$id -in $cframe -side left \\\n+                -padx [list $lxpad 0] -expand $cexpand -anchor w\n+        } elseif {[regexp {^r(\\d+)$} $type type sz]} {\n+            regexp {^(.*_)} $id uselessvar button_id\n+            ${NS}::radiobutton $cframe.c_$id -text $title -variable newviewopts($n,$button_id) -value $sz\n+            pack $cframe.c_$id -in $cframe -side left \\\n+                -padx [list $lxpad 0] -expand $cexpand -anchor w\n+        } elseif {[regexp {^t(\\d+)$} $type type sz]} {\n+            ${NS}::label $cframe.l_$id -text $title\n+            ${NS}::entry $cframe.e_$id -width $sz -background $bgcolor \\\n+                -textvariable newviewopts($n,$id)\n+            pack $cframe.l_$id -in $cframe -side left -padx [list $lxpad 0]\n+            pack $cframe.e_$id -in $cframe -side left -expand 1 -fill x\n+        } elseif {[regexp {^t(\\d+)=$} $type type sz]} {\n+            ${NS}::label $cframe.l_$id -text $title\n+            ${NS}::entry $cframe.e_$id -width $sz -background $bgcolor \\\n+                -textvariable newviewopts($n,$id)\n+            pack $cframe.l_$id -in $cframe -side top -pady [list 3 0] -anchor w\n+            pack $cframe.e_$id -in $cframe -side top -fill x\n+        } elseif {$type eq \"path\"} {\n+            ${NS}::label $top.l -text $title\n+            pack $top.l -in $top -side top -pady [list 3 0] -anchor w -padx 3\n+            text $top.t -width 40 -height 5 -background $bgcolor\n+            if {[info exists viewfiles($n)]} {\n+                foreach f $viewfiles($n) {\n+                    $top.t insert end $f\n+                    $top.t insert end \"\\n\"\n+                }\n+                $top.t delete {end - 1c} end\n+                $top.t mark set insert 0.0\n+            }\n+            pack $top.t -in $top -side top -pady [list 0 5] -fill both -expand 1 -padx 3\n+        }\n     }\n \n     ${NS}::frame $top.buts\n@@ -4359,10 +4359,10 @@ proc vieweditor {top n title} {\n proc doviewmenu {m first cmd op argv} {\n     set nmenu [$m index end]\n     for {set i $first} {$i <= $nmenu} {incr i} {\n-\tif {[$m entrycget $i -command] eq $cmd} {\n-\t    eval $m $op $i $argv\n-\t    break\n-\t}\n+        if {[$m entrycget $i -command] eq $cmd} {\n+            eval $m $op $i $argv\n+            break\n+        }\n     }\n }\n \n@@ -4379,53 +4379,53 @@ proc newviewok {top n {apply 0}} {\n     global viewargs viewargscmd newviewopts viewhlmenu\n \n     if {[catch {\n-\tset newargs [encode_view_opts $n]\n+        set newargs [encode_view_opts $n]\n     } err]} {\n-\terror_popup \"[mc \"Error in commit selection arguments:\"] $err\" $top\n-\treturn\n+        error_popup \"[mc \"Error in commit selection arguments:\"] $err\" $top\n+        return\n     }\n     set files {}\n     foreach f [split [$top.t get 0.0 end] \"\\n\"] {\n-\tset ft [string trim $f]\n-\tif {$ft ne {}} {\n-\t    lappend files $ft\n-\t}\n+        set ft [string trim $f]\n+        if {$ft ne {}} {\n+            lappend files $ft\n+        }\n     }\n     if {![info exists viewfiles($n)]} {\n-\t# creating a new view\n-\tincr nextviewnum\n-\tset viewname($n) $newviewname($n)\n-\tset viewperm($n) $newviewopts($n,perm)\n-\tset viewchanged($n) 1\n-\tset viewfiles($n) $files\n-\tset viewargs($n) $newargs\n-\tset viewargscmd($n) $newviewopts($n,cmd)\n-\taddviewmenu $n\n-\tif {!$newishighlight} {\n-\t    run showview $n\n-\t} else {\n-\t    run addvhighlight $n\n-\t}\n+        # creating a new view\n+        incr nextviewnum\n+        set viewname($n) $newviewname($n)\n+        set viewperm($n) $newviewopts($n,perm)\n+        set viewchanged($n) 1\n+        set viewfiles($n) $files\n+        set viewargs($n) $newargs\n+        set viewargscmd($n) $newviewopts($n,cmd)\n+        addviewmenu $n\n+        if {!$newishighlight} {\n+            run showview $n\n+        } else {\n+            run addvhighlight $n\n+        }\n     } else {\n-\t# editing an existing view\n-\tset viewperm($n) $newviewopts($n,perm)\n-\tset viewchanged($n) 1\n-\tif {$newviewname($n) ne $viewname($n)} {\n-\t    set viewname($n) $newviewname($n)\n-\t    doviewmenu .bar.view 5 [list showview $n] \\\n-\t\tentryconf [list -label $viewname($n)]\n-\t    # doviewmenu $viewhlmenu 1 [list addvhighlight $n] \\\n-\t\t# entryconf [list -label $viewname($n) -value $viewname($n)]\n-\t}\n-\tif {$files ne $viewfiles($n) || $newargs ne $viewargs($n) || \\\n-\t\t$newviewopts($n,cmd) ne $viewargscmd($n)} {\n-\t    set viewfiles($n) $files\n-\t    set viewargs($n) $newargs\n-\t    set viewargscmd($n) $newviewopts($n,cmd)\n-\t    if {$curview == $n} {\n-\t\trun reloadcommits\n-\t    }\n-\t}\n+        # editing an existing view\n+        set viewperm($n) $newviewopts($n,perm)\n+        set viewchanged($n) 1\n+        if {$newviewname($n) ne $viewname($n)} {\n+            set viewname($n) $newviewname($n)\n+            doviewmenu .bar.view 5 [list showview $n] \\\n+                entryconf [list -label $viewname($n)]\n+            # doviewmenu $viewhlmenu 1 [list addvhighlight $n] \\\n+                # entryconf [list -label $viewname($n) -value $viewname($n)]\n+        }\n+        if {$files ne $viewfiles($n) || $newargs ne $viewargs($n) || \\\n+                $newviewopts($n,cmd) ne $viewargscmd($n)} {\n+            set viewfiles($n) $files\n+            set viewargs($n) $newargs\n+            set viewargscmd($n) $newviewopts($n,cmd)\n+            if {$curview == $n} {\n+                run reloadcommits\n+            }\n+        }\n     }\n     if {$apply} return\n     catch {destroy $top}\n@@ -4436,8 +4436,8 @@ proc delview {} {\n \n     if {$curview == 0} return\n     if {[info exists hlview] && $hlview == $curview} {\n-\tset selectedhlview [mc \"None\"]\n-\tunset hlview\n+        set selectedhlview [mc \"None\"]\n+        unset hlview\n     }\n     allviewmenus $curview delete\n     set viewperm($curview) 0\n@@ -4449,7 +4449,7 @@ proc addviewmenu {n} {\n     global viewname viewhlmenu\n \n     .bar.view add radiobutton -label $viewname($n) \\\n-\t-command [list showview $n] -variable selectedview -value $n\n+        -command [list showview $n] -variable selectedview -value $n\n     #$viewhlmenu add radiobutton -label $viewname($n) \\\n     #\t-command [list addvhighlight $n] -variable selectedhlview\n }\n@@ -4474,22 +4474,22 @@ proc showview {n} {\n     set ybot [expr {[lindex $span 1] * $ymax}]\n     set yscreen [expr {($ybot - $ytop) / 2}]\n     if {$selectedline ne {}} {\n-\tset selid $currentid\n-\tset y [yc $selectedline]\n-\tif {$ytop < $y && $y < $ybot} {\n-\t    set yscreen [expr {$y - $ytop}]\n-\t}\n+        set selid $currentid\n+        set y [yc $selectedline]\n+        if {$ytop < $y && $y < $ybot} {\n+            set yscreen [expr {$y - $ytop}]\n+        }\n     } elseif {[info exists pending_select]} {\n-\tset selid $pending_select\n-\tunset pending_select\n+        set selid $pending_select\n+        unset pending_select\n     }\n     unselectline\n     normalline\n     unset -nocomplain treediffs\n     clear_display\n     if {[info exists hlview] && $hlview == $n} {\n-\tunset hlview\n-\tset selectedhlview [mc \"None\"]\n+        unset hlview\n+        set selectedhlview [mc \"None\"]\n     }\n     unset -nocomplain commitinterest\n     unset -nocomplain cached_commitrow\n@@ -4502,8 +4502,8 @@ proc showview {n} {\n \n     run refill_reflist\n     if {![info exists viewcomplete($n)]} {\n-\tgetcommits $selid\n-\treturn\n+        getcommits $selid\n+        return\n     }\n \n     set displayorder {}\n@@ -4523,39 +4523,39 @@ proc showview {n} {\n     set yf 0\n     set row {}\n     if {$selid ne {} && [commitinview $selid $n]} {\n-\tset row [rowofcommit $selid]\n-\t# try to get the selected row in the same position on the screen\n-\tset ymax [lindex [$canv cget -scrollregion] 3]\n-\tset ytop [expr {[yc $row] - $yscreen}]\n-\tif {$ytop < 0} {\n-\t    set ytop 0\n-\t}\n-\tset yf [expr {$ytop * 1.0 / $ymax}]\n+        set row [rowofcommit $selid]\n+        # try to get the selected row in the same position on the screen\n+        set ymax [lindex [$canv cget -scrollregion] 3]\n+        set ytop [expr {[yc $row] - $yscreen}]\n+        if {$ytop < 0} {\n+            set ytop 0\n+        }\n+        set yf [expr {$ytop * 1.0 / $ymax}]\n     }\n     allcanvs yview moveto $yf\n     drawvisible\n     if {$row ne {}} {\n-\tselectline $row 0\n+        selectline $row 0\n     } elseif {!$viewcomplete($n)} {\n-\treset_pending_select $selid\n+        reset_pending_select $selid\n     } else {\n-\treset_pending_select {}\n+        reset_pending_select {}\n \n-\tif {[commitinview $pending_select $curview]} {\n-\t    selectline [rowofcommit $pending_select] 1\n-\t} else {\n-\t    set row [first_real_row]\n-\t    if {$row < $numcommits} {\n-\t\tselectline $row 0\n-\t    }\n-\t}\n+        if {[commitinview $pending_select $curview]} {\n+            selectline [rowofcommit $pending_select] 1\n+        } else {\n+            set row [first_real_row]\n+            if {$row < $numcommits} {\n+                selectline $row 0\n+            }\n+        }\n     }\n     if {!$viewcomplete($n)} {\n-\tif {$numcommits == 0} {\n-\t    show_status [mc \"Reading commits...\"]\n-\t}\n+        if {$numcommits == 0} {\n+            show_status [mc \"Reading commits...\"]\n+        }\n     } elseif {$numcommits == 0} {\n-\tshow_status [mc \"No commits selected\"]\n+        show_status [mc \"No commits selected\"]\n     }\n     set_window_title\n }\n@@ -4566,16 +4566,16 @@ proc ishighlighted {id} {\n     global vhighlights fhighlights nhighlights rhighlights\n \n     if {[info exists nhighlights($id)] && $nhighlights($id) > 0} {\n-\treturn $nhighlights($id)\n+        return $nhighlights($id)\n     }\n     if {[info exists vhighlights($id)] && $vhighlights($id) > 0} {\n-\treturn $vhighlights($id)\n+        return $vhighlights($id)\n     }\n     if {[info exists fhighlights($id)] && $fhighlights($id) > 0} {\n-\treturn $fhighlights($id)\n+        return $fhighlights($id)\n     }\n     if {[info exists rhighlights($id)] && $rhighlights($id) > 0} {\n-\treturn $rhighlights($id)\n+        return $rhighlights($id)\n     }\n     return 0\n }\n@@ -4588,14 +4588,14 @@ proc bolden {id font} {\n     lappend boldids $id\n     $canv itemconf $linehtag($id) -font $font\n     if {[info exists currentid] && $id eq $currentid} {\n-\t$canv delete secsel\n-\tset t [eval $canv create rect [$canv bbox $linehtag($id)] \\\n-\t\t   -outline {{}} -tags secsel \\\n-\t\t   -fill [$canv cget -selectbackground]]\n-\t$canv lower $t\n+        $canv delete secsel\n+        set t [eval $canv create rect [$canv bbox $linehtag($id)] \\\n+                   -outline {{}} -tags secsel \\\n+                   -fill [$canv cget -selectbackground]]\n+        $canv lower $t\n     }\n     if {[info exists markedid] && $id eq $markedid} {\n-\tmake_idmark $id\n+        make_idmark $id\n     }\n }\n \n@@ -4606,11 +4606,11 @@ proc bolden_name {id font} {\n     lappend boldnameids $id\n     $canv2 itemconf $linentag($id) -font $font\n     if {[info exists currentid] && $id eq $currentid} {\n-\t$canv2 delete secsel\n-\tset t [eval $canv2 create rect [$canv2 bbox $linentag($id)] \\\n-\t\t   -outline {{}} -tags secsel \\\n-\t\t   -fill [$canv2 cget -selectbackground]]\n-\t$canv2 lower $t\n+        $canv2 delete secsel\n+        set t [eval $canv2 create rect [$canv2 bbox $linentag($id)] \\\n+                   -outline {{}} -tags secsel \\\n+                   -fill [$canv2 cget -selectbackground]]\n+        $canv2 lower $t\n     }\n }\n \n@@ -4619,11 +4619,11 @@ proc unbolden {} {\n \n     set stillbold {}\n     foreach id $boldids {\n-\tif {![ishighlighted $id]} {\n-\t    bolden $id mainfont\n-\t} else {\n-\t    lappend stillbold $id\n-\t}\n+        if {![ishighlighted $id]} {\n+            bolden $id mainfont\n+        } else {\n+            lappend stillbold $id\n+        }\n     }\n     set boldids $stillbold\n }\n@@ -4632,15 +4632,15 @@ proc addvhighlight {n} {\n     global hlview viewcomplete curview vhl_done commitidx\n \n     if {[info exists hlview]} {\n-\tdelvhighlight\n+        delvhighlight\n     }\n     set hlview $n\n     if {$n != $curview && ![info exists viewcomplete($n)]} {\n-\tstart_rev_list $n\n+        start_rev_list $n\n     }\n     set vhl_done $commitidx($hlview)\n     if {$vhl_done > 0} {\n-\tdrawvisible\n+        drawvisible\n     }\n }\n \n@@ -4661,16 +4661,16 @@ proc vhighlightmore {} {\n     set r0 [lindex $vr 0]\n     set r1 [lindex $vr 1]\n     for {set i $vhl_done} {$i < $max} {incr i} {\n-\tset id [commitonrow $i $hlview]\n-\tif {[commitinview $id $curview]} {\n-\t    set row [rowofcommit $id]\n-\t    if {$r0 <= $row && $row <= $r1} {\n-\t\tif {![highlighted $row]} {\n-\t\t    bolden $id mainfontbold\n-\t\t}\n-\t\tset vhighlights($id) 1\n-\t    }\n-\t}\n+        set id [commitonrow $i $hlview]\n+        if {[commitinview $id $curview]} {\n+            set row [rowofcommit $id]\n+            if {$r0 <= $row && $row <= $r1} {\n+                if {![highlighted $row]} {\n+                    bolden $id mainfontbold\n+                }\n+                set vhighlights($id) 1\n+            }\n+        }\n     }\n     set vhl_done $max\n     return 0\n@@ -4680,12 +4680,12 @@ proc askvhighlight {row id} {\n     global hlview vhighlights iddrawn\n \n     if {[commitinview $id $hlview]} {\n-\tif {[info exists iddrawn($id)] && ![ishighlighted $id]} {\n-\t    bolden $id mainfontbold\n-\t}\n-\tset vhighlights($id) 1\n+        if {[info exists iddrawn($id)] && ![ishighlighted $id]} {\n+            bolden $id mainfontbold\n+        }\n+        set vhighlights($id) 1\n     } else {\n-\tset vhighlights($id) 0\n+        set vhighlights($id) 0\n     }\n }\n \n@@ -4694,18 +4694,18 @@ proc hfiles_change {} {\n     global highlight_paths\n \n     if {[info exists filehighlight]} {\n-\t# delete previous highlights\n-\tcatch {close $filehighlight}\n-\tunset filehighlight\n-\tunset -nocomplain fhighlights\n-\tunbolden\n-\tunhighlight_filelist\n+        # delete previous highlights\n+        catch {close $filehighlight}\n+        unset filehighlight\n+        unset -nocomplain fhighlights\n+        unbolden\n+        unhighlight_filelist\n     }\n     set highlight_paths {}\n     after cancel do_file_hl $fh_serial\n     incr fh_serial\n     if {$highlight_files ne {}} {\n-\tafter 300 do_file_hl $fh_serial\n+        after 300 do_file_hl $fh_serial\n     }\n }\n \n@@ -4714,21 +4714,21 @@ proc gdttype_change {name ix op} {\n \n     stopfinding\n     if {$findstring ne {}} {\n-\tif {$gdttype eq [mc \"containing:\"]} {\n-\t    if {$highlight_files ne {}} {\n-\t\tset highlight_files {}\n-\t\thfiles_change\n-\t    }\n-\t    findcom_change\n-\t} else {\n-\t    if {$findpattern ne {}} {\n-\t\tset findpattern {}\n-\t\tfindcom_change\n-\t    }\n-\t    set highlight_files $findstring\n-\t    hfiles_change\n-\t}\n-\tdrawvisible\n+        if {$gdttype eq [mc \"containing:\"]} {\n+            if {$highlight_files ne {}} {\n+                set highlight_files {}\n+                hfiles_change\n+            }\n+            findcom_change\n+        } else {\n+            if {$findpattern ne {}} {\n+                set findpattern {}\n+                findcom_change\n+            }\n+            set highlight_files $findstring\n+            hfiles_change\n+        }\n+        drawvisible\n     }\n     # enable/disable findtype/findloc menus too\n }\n@@ -4738,12 +4738,12 @@ proc find_change {name ix op} {\n \n     stopfinding\n     if {$gdttype eq [mc \"containing:\"]} {\n-\tfindcom_change\n+        findcom_change\n     } else {\n-\tif {$highlight_files ne $findstring} {\n-\t    set highlight_files $findstring\n-\t    hfiles_change\n-\t}\n+        if {$highlight_files ne $findstring} {\n+            set highlight_files $findstring\n+            hfiles_change\n+        }\n     }\n     drawvisible\n }\n@@ -4755,33 +4755,33 @@ proc findcom_change args {\n     stopfinding\n     # delete previous highlights, if any\n     foreach id $boldnameids {\n-\tbolden_name $id mainfont\n+        bolden_name $id mainfont\n     }\n     set boldnameids {}\n     unset -nocomplain nhighlights\n     unbolden\n     unmarkmatches\n     if {$gdttype ne [mc \"containing:\"] || $findstring eq {}} {\n-\tset findpattern {}\n+        set findpattern {}\n     } elseif {$findtype eq [mc \"Regexp\"]} {\n-\tset findpattern $findstring\n+        set findpattern $findstring\n     } else {\n-\tset e [string map {\"*\" \"\\\\*\" \"?\" \"\\\\?\" \"\\[\" \"\\\\\\[\" \"\\\\\" \"\\\\\\\\\"} \\\n-\t\t   $findstring]\n-\tset findpattern \"*$e*\"\n+        set e [string map {\"*\" \"\\\\*\" \"?\" \"\\\\?\" \"\\[\" \"\\\\\\[\" \"\\\\\" \"\\\\\\\\\"} \\\n+                   $findstring]\n+        set findpattern \"*$e*\"\n     }\n }\n \n proc makepatterns {l} {\n     set ret {}\n     foreach e $l {\n-\tset ee [string map {\"*\" \"\\\\*\" \"?\" \"\\\\?\" \"\\[\" \"\\\\\\[\" \"\\\\\" \"\\\\\\\\\"} $e]\n-\tif {[string index $ee end] eq \"/\"} {\n-\t    lappend ret \"$ee*\"\n-\t} else {\n-\t    lappend ret $ee\n-\t    lappend ret \"$ee/*\"\n-\t}\n+        set ee [string map {\"*\" \"\\\\*\" \"?\" \"\\\\?\" \"\\[\" \"\\\\\\[\" \"\\\\\" \"\\\\\\\\\"} $e]\n+        if {[string index $ee end] eq \"/\"} {\n+            lappend ret \"$ee*\"\n+        } else {\n+            lappend ret $ee\n+            lappend ret \"$ee/*\"\n+        }\n     }\n     return $ret\n }\n@@ -4791,26 +4791,26 @@ proc do_file_hl {serial} {\n     global cdup findtype\n \n     if {$gdttype eq [mc \"touching paths:\"]} {\n-\t# If \"exact\" match then convert backslashes to forward slashes.\n-\t# Most useful to support Windows-flavoured file paths.\n-\tif {$findtype eq [mc \"Exact\"]} {\n-\t    set highlight_files [string map {\"\\\\\" \"/\"} $highlight_files]\n-\t}\n-\tif {[catch {set paths [shellsplit $highlight_files]}]} return\n-\tset highlight_paths [makepatterns $paths]\n-\thighlight_filelist\n-\tset relative_paths {}\n-\tforeach path $paths {\n-\t    lappend relative_paths [file join $cdup $path]\n-\t}\n-\tset gdtargs [concat -- $relative_paths]\n+        # If \"exact\" match then convert backslashes to forward slashes.\n+        # Most useful to support Windows-flavoured file paths.\n+        if {$findtype eq [mc \"Exact\"]} {\n+            set highlight_files [string map {\"\\\\\" \"/\"} $highlight_files]\n+        }\n+        if {[catch {set paths [shellsplit $highlight_files]}]} return\n+        set highlight_paths [makepatterns $paths]\n+        highlight_filelist\n+        set relative_paths {}\n+        foreach path $paths {\n+            lappend relative_paths [file join $cdup $path]\n+        }\n+        set gdtargs [concat -- $relative_paths]\n     } elseif {$gdttype eq [mc \"adding/removing string:\"]} {\n-\tset gdtargs [list \"-S$highlight_files\"]\n+        set gdtargs [list \"-S$highlight_files\"]\n     } elseif {$gdttype eq [mc \"changing lines matching:\"]} {\n-\tset gdtargs [list \"-G$highlight_files\"]\n+        set gdtargs [list \"-G$highlight_files\"]\n     } else {\n-\t# must be \"containing:\", i.e. we're searching commit info\n-\treturn\n+        # must be \"containing:\", i.e. we're searching commit info\n+        return\n     }\n     set cmd [concat | git diff-tree -r -s --stdin $gdtargs]\n     set filehighlight [open $cmd r+]\n@@ -4825,9 +4825,9 @@ proc flushhighlights {} {\n     global filehighlight fhl_list\n \n     if {[info exists filehighlight]} {\n-\tlappend fhl_list {}\n-\tputs $filehighlight \"\"\n-\tflush $filehighlight\n+        lappend fhl_list {}\n+        puts $filehighlight \"\"\n+        flush $filehighlight\n     }\n }\n \n@@ -4844,34 +4844,34 @@ proc readfhighlight {} {\n     global fhl_list find_dirn\n \n     if {![info exists filehighlight]} {\n-\treturn 0\n+        return 0\n     }\n     set nr 0\n     while {[incr nr] <= 100 && [gets $filehighlight line] >= 0} {\n-\tset line [string trim $line]\n-\tset i [lsearch -exact $fhl_list $line]\n-\tif {$i < 0} continue\n-\tfor {set j 0} {$j < $i} {incr j} {\n-\t    set id [lindex $fhl_list $j]\n-\t    set fhighlights($id) 0\n-\t}\n-\tset fhl_list [lrange $fhl_list [expr {$i+1}] end]\n-\tif {$line eq {}} continue\n-\tif {![commitinview $line $curview]} continue\n-\tif {[info exists iddrawn($line)] && ![ishighlighted $line]} {\n-\t    bolden $line mainfontbold\n-\t}\n-\tset fhighlights($line) 1\n+        set line [string trim $line]\n+        set i [lsearch -exact $fhl_list $line]\n+        if {$i < 0} continue\n+        for {set j 0} {$j < $i} {incr j} {\n+            set id [lindex $fhl_list $j]\n+            set fhighlights($id) 0\n+        }\n+        set fhl_list [lrange $fhl_list [expr {$i+1}] end]\n+        if {$line eq {}} continue\n+        if {![commitinview $line $curview]} continue\n+        if {[info exists iddrawn($line)] && ![ishighlighted $line]} {\n+            bolden $line mainfontbold\n+        }\n+        set fhighlights($line) 1\n     }\n     if {[eof $filehighlight]} {\n-\t# strange...\n-\tputs \"oops, git diff-tree died\"\n-\tcatch {close $filehighlight}\n-\tunset filehighlight\n-\treturn 0\n+        # strange...\n+        puts \"oops, git diff-tree died\"\n+        catch {close $filehighlight}\n+        unset filehighlight\n+        return 0\n     }\n     if {[info exists find_dirn]} {\n-\trun findmore\n+        run findmore\n     }\n     return 1\n }\n@@ -4880,11 +4880,11 @@ proc doesmatch {f} {\n     global findtype findpattern\n \n     if {$findtype eq [mc \"Regexp\"]} {\n-\treturn [regexp $findpattern $f]\n+        return [regexp $findpattern $f]\n     } elseif {$findtype eq [mc \"IgnCase\"]} {\n-\treturn [string match -nocase $findpattern $f]\n+        return [string match -nocase $findpattern $f]\n     } else {\n-\treturn [string match $findpattern $f]\n+        return [string match $findpattern $f]\n     }\n }\n \n@@ -4894,32 +4894,32 @@ proc askfindhighlight {row id} {\n     global markingmatches\n \n     if {![info exists commitinfo($id)]} {\n-\tgetcommit $id\n+        getcommit $id\n     }\n     set info $commitinfo($id)\n     set isbold 0\n     set fldtypes [list [mc Headline] [mc Author] \"\" [mc Committer] \"\" [mc Comments]]\n     foreach f $info ty $fldtypes {\n-\tif {$ty eq \"\"} continue\n-\tif {($findloc eq [mc \"All fields\"] || $findloc eq $ty) &&\n-\t    [doesmatch $f]} {\n-\t    if {$ty eq [mc \"Author\"]} {\n-\t\tset isbold 2\n-\t\tbreak\n-\t    }\n-\t    set isbold 1\n-\t}\n+        if {$ty eq \"\"} continue\n+        if {($findloc eq [mc \"All fields\"] || $findloc eq $ty) &&\n+            [doesmatch $f]} {\n+            if {$ty eq [mc \"Author\"]} {\n+                set isbold 2\n+                break\n+            }\n+            set isbold 1\n+        }\n     }\n     if {$isbold && [info exists iddrawn($id)]} {\n-\tif {![ishighlighted $id]} {\n-\t    bolden $id mainfontbold\n-\t    if {$isbold > 1} {\n-\t\tbolden_name $id mainfontbold\n-\t    }\n-\t}\n-\tif {$markingmatches} {\n-\t    markrowmatches $row $id\n-\t}\n+        if {![ishighlighted $id]} {\n+            bolden $id mainfontbold\n+            if {$isbold > 1} {\n+                bolden_name $id mainfontbold\n+            }\n+        }\n+        if {$markingmatches} {\n+            markrowmatches $row $id\n+        }\n     }\n     set nhighlights($id) $isbold\n }\n@@ -4932,18 +4932,18 @@ proc markrowmatches {row id} {\n     $canv delete match$row\n     $canv2 delete match$row\n     if {$findloc eq [mc \"All fields\"] || $findloc eq [mc \"Headline\"]} {\n-\tset m [findmatches $headline]\n-\tif {$m ne {}} {\n-\t    markmatches $canv $row $headline $linehtag($id) $m \\\n-\t\t[$canv itemcget $linehtag($id) -font] $row\n-\t}\n+        set m [findmatches $headline]\n+        if {$m ne {}} {\n+            markmatches $canv $row $headline $linehtag($id) $m \\\n+                [$canv itemcget $linehtag($id) -font] $row\n+        }\n     }\n     if {$findloc eq [mc \"All fields\"] || $findloc eq [mc \"Author\"]} {\n-\tset m [findmatches $author]\n-\tif {$m ne {}} {\n-\t    markmatches $canv2 $row $author $linentag($id) $m \\\n-\t\t[$canv2 itemcget $linentag($id) -font] $row\n-\t}\n+        set m [findmatches $author]\n+        if {$m ne {}} {\n+            markmatches $canv2 $row $author $linentag($id) $m \\\n+                [$canv2 itemcget $linentag($id) -font] $row\n+        }\n     }\n }\n \n@@ -4952,7 +4952,7 @@ proc vrel_change {name ix op} {\n \n     rhighlight_none\n     if {$highlight_related ne [mc \"None\"]} {\n-\trun drawvisible\n+        run drawvisible\n     }\n }\n \n@@ -4966,8 +4966,8 @@ proc rhighlight_sel {a} {\n     unset -nocomplain ancestor\n     set anc_todo [list $a]\n     if {$highlight_related ne [mc \"None\"]} {\n-\trhighlight_none\n-\trun drawvisible\n+        rhighlight_none\n+        run drawvisible\n     }\n }\n \n@@ -4987,24 +4987,24 @@ proc is_descendent {a} {\n     set leftover {}\n     set done 0\n     for {set i 0} {$i < [llength $todo]} {incr i} {\n-\tset do [lindex $todo $i]\n-\tif {[rowofcommit $do] < $la} {\n-\t    lappend leftover $do\n-\t    continue\n-\t}\n-\tforeach nk $children($v,$do) {\n-\t    if {![info exists descendent($nk)]} {\n-\t\tset descendent($nk) 1\n-\t\tlappend todo $nk\n-\t\tif {$nk eq $a} {\n-\t\t    set done 1\n-\t\t}\n-\t    }\n-\t}\n-\tif {$done} {\n-\t    set desc_todo [concat $leftover [lrange $todo [expr {$i+1}] end]]\n-\t    return\n-\t}\n+        set do [lindex $todo $i]\n+        if {[rowofcommit $do] < $la} {\n+            lappend leftover $do\n+            continue\n+        }\n+        foreach nk $children($v,$do) {\n+            if {![info exists descendent($nk)]} {\n+                set descendent($nk) 1\n+                lappend todo $nk\n+                if {$nk eq $a} {\n+                    set done 1\n+                }\n+            }\n+        }\n+        if {$done} {\n+            set desc_todo [concat $leftover [lrange $todo [expr {$i+1}] end]]\n+            return\n+        }\n     }\n     set descendent($a) 0\n     set desc_todo $leftover\n@@ -5019,24 +5019,24 @@ proc is_ancestor {a} {\n     set leftover {}\n     set done 0\n     for {set i 0} {$i < [llength $todo]} {incr i} {\n-\tset do [lindex $todo $i]\n-\tif {![commitinview $do $v] || [rowofcommit $do] > $la} {\n-\t    lappend leftover $do\n-\t    continue\n-\t}\n-\tforeach np $parents($v,$do) {\n-\t    if {![info exists ancestor($np)]} {\n-\t\tset ancestor($np) 1\n-\t\tlappend todo $np\n-\t\tif {$np eq $a} {\n-\t\t    set done 1\n-\t\t}\n-\t    }\n-\t}\n-\tif {$done} {\n-\t    set anc_todo [concat $leftover [lrange $todo [expr {$i+1}] end]]\n-\t    return\n-\t}\n+        set do [lindex $todo $i]\n+        if {![commitinview $do $v] || [rowofcommit $do] > $la} {\n+            lappend leftover $do\n+            continue\n+        }\n+        foreach np $parents($v,$do) {\n+            if {![info exists ancestor($np)]} {\n+                set ancestor($np) 1\n+                lappend todo $np\n+                if {$np eq $a} {\n+                    set done 1\n+                }\n+            }\n+        }\n+        if {$done} {\n+            set anc_todo [concat $leftover [lrange $todo [expr {$i+1}] end]]\n+            return\n+        }\n     }\n     set ancestor($a) 0\n     set anc_todo $leftover\n@@ -5049,26 +5049,26 @@ proc askrelhighlight {row id} {\n     if {$selectedline eq {}} return\n     set isbold 0\n     if {$highlight_related eq [mc \"Descendant\"] ||\n-\t$highlight_related eq [mc \"Not descendant\"]} {\n-\tif {![info exists descendent($id)]} {\n-\t    is_descendent $id\n-\t}\n-\tif {$descendent($id) == ($highlight_related eq [mc \"Descendant\"])} {\n-\t    set isbold 1\n-\t}\n+        $highlight_related eq [mc \"Not descendant\"]} {\n+        if {![info exists descendent($id)]} {\n+            is_descendent $id\n+        }\n+        if {$descendent($id) == ($highlight_related eq [mc \"Descendant\"])} {\n+            set isbold 1\n+        }\n     } elseif {$highlight_related eq [mc \"Ancestor\"] ||\n-\t      $highlight_related eq [mc \"Not ancestor\"]} {\n-\tif {![info exists ancestor($id)]} {\n-\t    is_ancestor $id\n-\t}\n-\tif {$ancestor($id) == ($highlight_related eq [mc \"Ancestor\"])} {\n-\t    set isbold 1\n-\t}\n+              $highlight_related eq [mc \"Not ancestor\"]} {\n+        if {![info exists ancestor($id)]} {\n+            is_ancestor $id\n+        }\n+        if {$ancestor($id) == ($highlight_related eq [mc \"Ancestor\"])} {\n+            set isbold 1\n+        }\n     }\n     if {[info exists iddrawn($id)]} {\n-\tif {$isbold && ![ishighlighted $id]} {\n-\t    bolden $id mainfontbold\n-\t}\n+        if {$isbold && ![ishighlighted $id]} {\n+            bolden $id mainfontbold\n+        }\n     }\n     set rhighlights($id) $isbold\n }\n@@ -5078,13 +5078,13 @@ proc askrelhighlight {row id} {\n proc shortids {ids} {\n     set res {}\n     foreach id $ids {\n-\tif {[llength $id] > 1} {\n-\t    lappend res [shortids $id]\n-\t} elseif {[regexp {^[0-9a-f]{40}$} $id]} {\n-\t    lappend res [string range $id 0 7]\n-\t} else {\n-\t    lappend res $id\n-\t}\n+        if {[llength $id] > 1} {\n+            lappend res [shortids $id]\n+        } elseif {[regexp {^[0-9a-f]{40}$} $id]} {\n+            lappend res [string range $id 0 7]\n+        } else {\n+            lappend res $id\n+        }\n     }\n     return $res\n }\n@@ -5093,10 +5093,10 @@ proc ntimes {n o} {\n     set ret {}\n     set o [list $o]\n     for {set mask 1} {$mask <= $n} {incr mask $mask} {\n-\tif {($n & $mask) != 0} {\n-\t    set ret [concat $ret $o]\n-\t}\n-\tset o [concat $o $o]\n+        if {($n & $mask) != 0} {\n+            set ret [concat $ret $o]\n+        }\n+        set o [concat $o $o]\n     }\n     return $ret\n }\n@@ -5106,41 +5106,41 @@ proc ordertoken {id} {\n     global nullid nullid2\n \n     if {[info exists ordertok($id)]} {\n-\treturn $ordertok($id)\n+        return $ordertok($id)\n     }\n     set origid $id\n     set todo {}\n     while {1} {\n-\tif {[info exists varcid($curview,$id)]} {\n-\t    set a $varcid($curview,$id)\n-\t    set p [lindex $varcstart($curview) $a]\n-\t} else {\n-\t    set p [lindex $children($curview,$id) 0]\n-\t}\n-\tif {[info exists ordertok($p)]} {\n-\t    set tok $ordertok($p)\n-\t    break\n-\t}\n-\tset id [first_real_child $curview,$p]\n-\tif {$id eq {}} {\n-\t    # it's a root\n-\t    set tok [lindex $varctok($curview) $varcid($curview,$p)]\n-\t    break\n-\t}\n-\tif {[llength $parents($curview,$id)] == 1} {\n-\t    lappend todo [list $p {}]\n-\t} else {\n-\t    set j [lsearch -exact $parents($curview,$id) $p]\n-\t    if {$j < 0} {\n-\t\tputs \"oops didn't find [shortids $p] in parents of [shortids $id]\"\n-\t    }\n-\t    lappend todo [list $p [strrep $j]]\n-\t}\n+        if {[info exists varcid($curview,$id)]} {\n+            set a $varcid($curview,$id)\n+            set p [lindex $varcstart($curview) $a]\n+        } else {\n+            set p [lindex $children($curview,$id) 0]\n+        }\n+        if {[info exists ordertok($p)]} {\n+            set tok $ordertok($p)\n+            break\n+        }\n+        set id [first_real_child $curview,$p]\n+        if {$id eq {}} {\n+            # it's a root\n+            set tok [lindex $varctok($curview) $varcid($curview,$p)]\n+            break\n+        }\n+        if {[llength $parents($curview,$id)] == 1} {\n+            lappend todo [list $p {}]\n+        } else {\n+            set j [lsearch -exact $parents($curview,$id) $p]\n+            if {$j < 0} {\n+                puts \"oops didn't find [shortids $p] in parents of [shortids $id]\"\n+            }\n+            lappend todo [list $p [strrep $j]]\n+        }\n     }\n     for {set i [llength $todo]} {[incr i -1] >= 0} {} {\n-\tset p [lindex $todo $i 0]\n-\tappend tok [lindex $todo $i 1]\n-\tset ordertok($p) $tok\n+        set p [lindex $todo $i 0]\n+        append tok [lindex $todo $i 1]\n+        set ordertok($p) $tok\n     }\n     set ordertok($origid) $tok\n     return $tok\n@@ -5151,19 +5151,19 @@ proc ordertoken {id} {\n proc idcol {idlist id {i 0}} {\n     set t [ordertoken $id]\n     if {$i < 0} {\n-\tset i 0\n+        set i 0\n     }\n     if {$i >= [llength $idlist] || $t < [ordertoken [lindex $idlist $i]]} {\n-\tif {$i > [llength $idlist]} {\n-\t    set i [llength $idlist]\n-\t}\n-\twhile {[incr i -1] >= 0 && $t < [ordertoken [lindex $idlist $i]]} {}\n-\tincr i\n+        if {$i > [llength $idlist]} {\n+            set i [llength $idlist]\n+        }\n+        while {[incr i -1] >= 0 && $t < [ordertoken [lindex $idlist $i]]} {}\n+        incr i\n     } else {\n-\tif {$t > [ordertoken [lindex $idlist $i]]} {\n-\t    while {[incr i] < [llength $idlist] &&\n-\t\t   $t >= [ordertoken [lindex $idlist $i]]} {}\n-\t}\n+        if {$t > [ordertoken [lindex $idlist $i]]} {\n+            while {[incr i] < [llength $idlist] &&\n+                   $t >= [ordertoken [lindex $idlist $i]]} {}\n+        }\n     }\n     return $i\n }\n@@ -5208,12 +5208,12 @@ proc visiblerows {} {\n     set y0 [expr {int([lindex $f 0] * $ymax)}]\n     set r0 [expr {int(($y0 - 3) / $linespc) - 1}]\n     if {$r0 < 0} {\n-\tset r0 0\n+        set r0 0\n     }\n     set y1 [expr {int([lindex $f 1] * $ymax)}]\n     set r1 [expr {int(($y1 - 3) / $linespc) + 1}]\n     if {$r1 >= $numcommits} {\n-\tset r1 [expr {$numcommits - 1}]\n+        set r1 [expr {$numcommits - 1}]\n     }\n     return [list $r0 $r1]\n }\n@@ -5224,13 +"},{"id":"406859","messageId":"20201003091419.GB3089868@thinks.paulus.ozlabs.org","threadId":"54220","inReplyTo":"ecdede5cf50bdb966f53bcf5171c80b5f8959d4b.1599798976.git.liu.denton@gmail.com","subject":"Re: [PATCH v2 1/2] gitk: replace tabs with spaces","fromName":"Paul Mackerras","fromEmail":"paulus@ozlabs.org","sentAt":"2020-10-03T09:14:19Z","receivedAt":"2020-10-03T09:14:29Z","isPatch":true,"sender":{"key":"paulus@ozlabs.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"On Thu, Sep 10, 2020 at 09:36:33PM -0700, Denton Liu wrote:\n> The source code is a mix of tabs and spaces. The indentation style\n> currently is four spaces per indent level but uses tabs every other\n> level (at eight spaces). Fix this inconsistent spacing and tabbing by\n> just using a space-indent for everything.\n> \n> This was done mechanically by running:\n> \n> \t$ expand -i gitk >gitk.new\n> \t$ mv gitk.new gitk\n> \n> This patch should be empty with `--ignore-all-space`.\n> \n> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n\nThanks, applied, though in fact I regenerated the patch since I had\nsome local commits that I had not yet pushed out.\n\nPaul.\n"}]}