2 # Copyright (C) 2006, 2007 Shawn Pearce
6 image create
photo ::blame::img_back_arrow -data {R0lGODlhGAAYAIUAAPwCBEzKXFTSZIz
+nGzmhGzqfGTidIT
+nEzGXHTqhGzmfGzifFzadETCVES
+VARWDFzWbHzyjAReDGTadFTOZDSyRDyyTCymPARaFGTedFzSbDy2TCyqRCyqPARaDAyCHES6VDy6VCyiPAR6HCSeNByWLARyFARiDARqFGTifARiFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAAYABgAAAajQIBwSCwaj8ikcsk0BppJwRPqHEypQwHBis0WDAdEFyBIKBaMAKLBdjQeSkFBYTBAIvgEoS6JmhUTEwIUDQ4VFhcMGEhyCgoZExoUaxsWHB0THkgfAXUGAhoBDSAVFR0XBnCbDRmgog0hpSIiDJpJIyEQhBUcJCIlwA22SSYVogknEg8eD82qSigdDSknY0IqJQXPYxIl1dZCGNvWw
+Dm510GQQAh
/mhDcmVhdGVkIGJ5IEJNUFRvR0lGIFBybyB2ZXJzaW9uIDIuNQ0KqSBEZXZlbENvciAxOTk3LDE5OTguIEFsbCByaWdodHMgcmVzZXJ2ZWQuDQpodHRwOi8vd3d3LmRldmVsY29yLmNvbQA7
}
8 # Persistant data (survives loads)
10 field
history {}; # viewer history: {commit path}
11 field header
; # array commit,key -> header field
15 field w
; # top window in this viewer
16 field w_back
; # our back button
17 field w_path
; # label showing the current file path
18 field w_columns
; # list of all column widgets in the viewer
19 field w_line
; # text column: all line numbers
20 field w_amov
; # text column: annotations + move tracking
21 field w_asim
; # text column: annotations (simple computation)
22 field w_file
; # text column: actual file data
23 field w_cviewer
; # pane showing commit message
24 field status
; # text variable bound to status bar
25 field old_height
; # last known height of $w.file_pane
29 field active_color
#c0edc5
36 # Current blame data; cleared/reset on each load
38 field commit
; # input commit to blame
39 field path
; # input filename to view in $commit
41 field current_fd
{} ; # background process running
42 field highlight_line
-1 ; # current line selected
43 field highlight_column
{} ; # current commit column selected
44 field highlight_commit
{} ; # sha1 of commit selected
45 field old_bgcolor
{} ; # background of current selection
47 field total_lines
0 ; # total length of file
48 field blame_lines
0 ; # number of lines computed
49 field have_commit
; # array commit -> 1
50 field amov_data
; # list of {commit origfile origline}
51 field asim_data
; # list of {commit origfile origline}
53 field r_commit
; # commit currently being parsed
54 field r_orig_line
; # original line number
55 field r_final_line
; # final line number
56 field r_line_count
; # lines in this region
58 field tooltip_wm
{} ; # Current tooltip toplevel, if open
59 field tooltip_t
{} ; # Text widget in $tooltip_wm
60 field tooltip_timer
{} ; # Current timer event for our tooltip
61 field tooltip_commit
{} ; # Commit(s) in tooltip
63 constructor new
{i_commit i_path
} {
70 wm title
$top "[appname] ([reponame]): File Viewer"
72 frame $w.header
-background orange
73 label $w.header.commit_l
\
78 set w_back
$w.header.commit_b
80 -image ::blame::img_back_arrow \
85 -activebackground orange
86 bind $w_back <Button-1
> "
87 if {\[$w_back cget -state\] eq {normal}} {
91 label $w.header.commit
\
92 -textvariable @commit
\
96 label $w.header.path_l
\
101 set w_path
$w.header.path
106 pack $w.header.commit_l
-side left
107 pack $w_back -side left
108 pack $w.header.commit
-side left
109 pack $w_path -fill x
-side right
110 pack $w.header.path_l
-side right
112 panedwindow $w.file_pane
-orient vertical
113 frame $w.file_pane.out
114 frame $w.file_pane.cm
115 $w.file_pane add
$w.file_pane.out
\
120 $w.file_pane add
$w.file_pane.cm
\
126 set w_line
$w.file_pane.out.linenumber_t
129 -highlightthickness 0 \
131 -background white
-borderwidth 0 \
137 $w_line tag conf linenumber
-justify right
-rmargin 5
139 set w_amov
$w.file_pane.out.amove_t
142 -highlightthickness 0 \
144 -background white
-borderwidth 0 \
150 $w_amov tag conf author_abbr
-justify right
-rmargin 5
151 $w_amov tag conf curr_commit
152 $w_amov tag conf prior_commit
-foreground blue
-underline 1
153 $w_amov tag
bind prior_commit
\
155 "[cb _load_commit $w_amov @amov_data @%x,%y];break"
157 set w_asim
$w.file_pane.out.asimple_t
160 -highlightthickness 0 \
162 -background white
-borderwidth 0 \
168 $w_asim tag conf author_abbr
-justify right
169 $w_asim tag conf curr_commit
170 $w_asim tag conf prior_commit
-foreground blue
-underline 1
171 $w_asim tag
bind prior_commit
\
173 "[cb _load_commit $w_asim @asim_data @%x,%y];break"
175 set w_file
$w.file_pane.out.file_t
178 -highlightthickness 0 \
180 -background white
-borderwidth 0 \
185 -xscrollcommand [list $w.file_pane.out.sbx
set] \
188 set w_columns
[list $w_amov $w_asim $w_line $w_file]
190 scrollbar $w.file_pane.out.sbx
\
192 -command [list $w_file xview
]
193 scrollbar $w.file_pane.out.sby
\
195 -command [list scrollbar2many
$w_columns yview
]
196 eval grid $w_columns $w.file_pane.out.sby
-sticky nsew
198 $w.file_pane.out.sbx
\
199 -column [expr {[llength $w_columns] - 1}] \
201 grid columnconfigure
\
203 [expr {[llength $w_columns] - 1}] \
205 grid rowconfigure
$w.file_pane.out
0 -weight 1
207 set w_cviewer
$w.file_pane.cm.t
209 -background white
-borderwidth 0 \
214 -xscrollcommand [list $w.file_pane.cm.sbx
set] \
215 -yscrollcommand [list $w.file_pane.cm.sby
set] \
217 $w_cviewer tag conf still_loading
\
218 -font font_uiitalic
\
220 $w_cviewer tag conf header_key
\
222 -background $active_color \
224 $w_cviewer tag conf header_val
\
225 -background $active_color \
227 $w_cviewer tag
raise sel
228 scrollbar $w.file_pane.cm.sbx
\
230 -command [list $w_cviewer xview
]
231 scrollbar $w.file_pane.cm.sby
\
233 -command [list $w_cviewer yview
]
234 pack $w.file_pane.cm.sby
-side right
-fill y
235 pack $w.file_pane.cm.sbx
-side bottom
-fill x
236 pack $w_cviewer -expand 1 -fill both
242 -textvariable @status
\
245 pack $w.status.l
-side left
247 menu $w.ctxm
-tearoff 0
248 $w.ctxm add command
\
249 -label "Copy Commit" \
250 -command [cb _copycommit
]
252 foreach i
$w_columns {
253 $i conf
-cursor $cursor_ptr
254 $i conf
-yscrollcommand [list many2scrollbar
\
255 $w_columns yview
$w.file_pane.out.sby
]
258 [cb _click $i @%x,%y]
261 bind $i <Any-Motion
> [cb _show_tooltip
$i @%x
,%y
]
262 bind $i <Any-Enter
> [cb _hide_tooltip
]
263 bind $i <Any-Leave
> [cb _hide_tooltip
]
269 tk_popup $w.ctxm %X %Y
273 foreach i
[concat $w_columns $w_cviewer] {
274 bind $i <Key-Up
> {catch {%W yview scroll
-1 units
};break}
275 bind $i <Key-Down
> {catch {%W yview scroll
1 units
};break}
276 bind $i <Key-Left
> {catch {%W xview scroll
-1 units
};break}
277 bind $i <Key-Right
> {catch {%W xview scroll
1 units
};break}
278 bind $i <Key-k
> {catch {%W yview scroll
-1 units
};break}
279 bind $i <Key-j
> {catch {%W yview scroll
1 units
};break}
280 bind $i <Key-h
> {catch {%W xview scroll
-1 units
};break}
281 bind $i <Key-l
> {catch {%W xview scroll
1 units
};break}
282 bind $i <Control-Key-b
> {catch {%W yview scroll
-1 pages
};break}
283 bind $i <Control-Key-f
> {catch {%W yview scroll
1 pages
};break}
286 bind $w_cviewer <Button-1
> [list focus $w_cviewer]
287 bind $top <Visibility
> [list focus $top]
288 bind $w_file <Destroy
> [list delete_this
$this]
290 grid configure
$w.header
-sticky ew
291 grid configure
$w.file_pane
-sticky nsew
292 grid configure
$w.status
-sticky ew
293 grid columnconfigure
$top 0 -weight 1
294 grid rowconfigure
$top 0 -weight 0
295 grid rowconfigure
$top 1 -weight 1
296 grid rowconfigure
$top 2 -weight 0
298 set req_w
[winfo reqwidth
$top]
299 set req_h
[winfo reqheight
$top]
300 if {$req_w < 600} {set req_w
600}
301 if {$req_h < 400} {set req_h
400}
302 set g
"${req_w}x${req_h}"
306 set old_height
[winfo height
$w.file_pane
]
307 $w.file_pane sash
place 0 \
308 [lindex [$w.file_pane sash coord
0] 0] \
309 [expr {int
($old_height * 0.70)}]
310 bind $w.file_pane
<Configure
> \
311 "if {{$w.file_pane} eq {%W}} {[cb _resize %h]}"
319 if {$total_lines != 0 ||
$current_fd ne
{}} {
320 if {$current_fd ne
{}} {
321 catch {close $current_fd}
325 foreach i
$w_columns {
326 $i conf
-state normal
328 foreach cmit
[array names have_commit
] {
331 $i conf
-state disabled
334 set highlight_line
-1
335 set highlight_column
{}
336 set highlight_commit
{}
338 array unset have_commit
341 if {[winfo exists
$w.status.c
]} {
342 $w.status.c coords bar
0 0 0 20
346 -height [expr {int
([winfo reqheight
$w.status.l
] * 0.6)}] \
350 $w.status.c create rectangle
0 0 0 20 -tags bar
-fill navy
351 pack $w.status.c
-side right
354 if {$history eq
{}} {
355 $w_back conf
-state disabled
357 $w_back conf
-state normal
359 lappend history [list $commit $path]
361 # Index 0 is always empty. There is never line 0 as
362 # we use only 1 based lines, as that matches both with
363 # git-blame output and with Tk's text widget.
365 set amov_data
[list [list]]
366 set asim_data
[list [list]]
368 set status
"Loading $commit:[escape_path $path]..."
369 $w_path conf
-text [escape_path
$path]
371 set fd
[open $path r
]
373 set cmd
[list git cat-file blob
"$commit:$path"]
374 set fd
[open "| $cmd" r
]
376 fconfigure $fd -blocking 0 -translation lf
-encoding binary
377 fileevent $fd readable
[cb _read_file
$fd]
381 method _history_menu
{} {
383 if {[winfo exists
$m]} {
389 for {set i
[expr {[llength $history] - 2}]
390 } {$i >= 0} {incr i
-1} {
391 set e
[lindex $history $i]
395 if {[regexp {^
[0-9a-f
]{40}$} $c]} {
396 set t
[string range
$c 0 8]...
397 } elseif
{$c eq
{}} {
398 set t
{Working Directory
}
402 if {![catch {set summary
$header($c,summary
)}]} {
404 if {[string length
$t] > 70} {
405 set t
[string range
$t 0 66]...
409 $m add command
-label $t -command [cb _goback
$i $c $f]
411 set X
[winfo rootx
$w_back]
412 set Y
[expr {[winfo rooty
$w_back] + [winfo height
$w_back]}]
416 method _goback
{i c f
} {
417 set history [lrange $history 0 [expr {$i - 1}]]
423 method _read_file
{fd
} {
424 if {$fd ne
$current_fd} {
429 foreach i
$w_columns {$i conf
-state normal
}
430 while {[gets $fd line
] >= 0} {
431 regsub "\r\$" $line {} line
436 if {$total_lines > 1} {
437 foreach i
$w_columns {$i insert end
"\n"}
440 $w_line insert end
"$total_lines" linenumber
441 $w_file insert end
"$line"
444 set ln_wc
[expr {[string length
$total_lines] + 2}]
445 if {[$w_line cget
-width] < $ln_wc} {
446 $w_line conf
-width $ln_wc
449 foreach i
$w_columns {$i conf
-state disabled
}
453 _exec_blame
$this $w_asim @asim_data
[list] {}
455 } ifdeleted
{ catch {close $fd} }
457 method _exec_blame
{cur_w cur_d
options cur_s
} {
458 set cmd
[list nice git blame
]
459 set cmd
[concat $cmd $options]
460 lappend cmd
--incremental
462 lappend cmd
--contents $path
467 set fd
[open "| $cmd" r
]
468 fconfigure $fd -blocking 0 -translation lf
-encoding binary
469 fileevent $fd readable
[cb _read_blame
$fd $cur_w $cur_d $cur_s]
475 method _read_blame
{fd cur_w cur_d cur_s
} {
476 upvar #0 $cur_d line_data
478 if {$fd ne
$current_fd} {
483 $cur_w conf
-state normal
484 while {[gets $fd line
] >= 0} {
485 if {[regexp {^
([a-z0-9
]{40}) (\d
+) (\d
+) (\d
+)$} $line line
\
486 cmit original_line final_line line_count
]} {
488 set r_orig_line
$original_line
489 set r_final_line
$final_line
490 set r_line_count
$line_count
492 if {[catch {set g
$have_commit($cmit)}]} {
493 set bg
[lindex $group_colors 0]
494 set group_colors
[lrange $group_colors 1 end
]
495 lappend group_colors
$bg
496 foreach i
$w_columns {
497 $i tag conf g
$cmit -background $bg
499 set have_commit
($cmit) 1
501 } elseif
{[string match
{filename *} $line]} {
502 set file [string range
$line 9 end
]
504 set lno
$r_final_line
507 if {[regexp {^
0{40}$} $cmit]} {
509 set commit_type curr_commit
510 } elseif
{$cmit eq
$commit} {
512 set commit_type curr_commit
514 set commit_type prior_commit
515 set commit_abbr
[string range
$cmit 0 3]
520 catch {set a_name
$header($cmit,author
)}
521 while {$a_name ne
{}} {
522 if {![regexp {^
([[:upper
:]])} $a_name _a
]} break
523 append author_abbr
$_a
526 {^
[[:upper
:]][^
\s
]*\s
+} \
527 $a_name {} a_name
]} break
529 if {$author_abbr eq
{}} {
532 set author_abbr
[string range
$author_abbr 0 3]
539 && $cmit eq
[lindex $line_data [expr {$first_lno - 1}] 0]
540 && $file eq
[lindex $line_data [expr {$first_lno - 1}] 1]
546 set lno_e
"$lno.0 lineend + 1c"
547 if {[lindex $line_data $lno] ne
{}} {
548 set g
[lindex $line_data $lno 0]
549 foreach i
$w_columns {
550 $i tag remove g
$g $lno.0 $lno_e
553 lset line_data
$lno [list $cmit $file]
555 $cur_w delete
$lno.0 "$lno.0 lineend"
556 if {$lno == $first_lno} {
557 $cur_w insert
$lno.0 $commit_abbr $commit_type
558 } elseif
{$lno == [expr {$first_lno + 1}]} {
559 $cur_w insert
$lno.0 $author_abbr author_abbr
561 $cur_w insert
$lno.0 { |
}
564 foreach i
$w_columns {
565 $i tag add g
$cmit $lno.0 $lno_e
568 if {$highlight_column eq
$cur_w} {
569 if {$highlight_line == -1
570 && [lindex [$w_file yview
] 0] == 0} {
572 set highlight_line
$lno
574 if {$highlight_line == $lno} {
575 _showcommit
$this $cur_w $lno
585 $cmit eq
[lindex $line_data $lno 0]
586 && $file eq
[lindex $line_data $lno 1]
588 $cur_w delete
$lno.0 "$lno.0 lineend"
590 if {$lno == $first_lno} {
591 $cur_w insert
$lno.0 $commit_abbr $commit_type
592 } elseif
{$lno == [expr {$first_lno + 1}]} {
593 $cur_w insert
$lno.0 $author_abbr author_abbr
595 $cur_w insert
$lno.0 { |
}
600 } elseif
{[regexp {^
([a-z-
]+) (.
*)$} $line line key data
]} {
601 set header
($r_commit,$key) $data
604 $cur_w conf
-state disabled
608 if {$cur_w eq
$w_asim} {
609 _exec_blame
$this $w_amov @amov_data
\
611 { move
/copy tracking
}
614 set status
{Annotation complete.
}
620 } ifdeleted
{ catch {close $fd} }
622 method _status
{cur_s
} {
623 set have
$blame_lines
624 set total
$total_lines
626 if {$total} {set pdone
[expr {100 * $have / $total}]}
629 "Loading%s annotations... %i of %i lines annotated (%2i%%)" \
630 $cur_s $have $total $pdone]
631 $w.status.c coords bar
0 0 $pdone 20
634 method _click
{cur_w pos
} {
635 set lno
[lindex [split [$cur_w index
$pos] .
] 0]
636 _showcommit
$this $cur_w $lno
639 method _load_commit
{cur_w cur_d pos
} {
640 upvar #0 $cur_d line_data
641 set lno
[lindex [split [$cur_w index
$pos] .
] 0]
642 set dat
[lindex $line_data $lno]
644 set commit
[lindex $dat 0]
645 set path
[lindex $dat 1]
650 method _showcommit
{cur_w lno
} {
653 if {$highlight_commit ne
{}} {
654 foreach i
$w_columns {
655 $i tag conf g
$highlight_commit -background $old_bgcolor
656 $i tag
lower g
$highlight_commit
660 if {$cur_w eq
$w_amov} {
661 set dat
[lindex $amov_data $lno]
662 set highlight_column
$w_amov
664 set dat
[lindex $asim_data $lno]
665 set highlight_column
$w_asim
668 $w_cviewer conf
-state normal
669 $w_cviewer delete
0.0 end
673 $w_cviewer insert end
"Loading annotation..." still_loading
675 set cmit
[lindex $dat 0]
676 set file [lindex $dat 1]
678 set old_bgcolor
[$w_file tag cget g
$cmit -background]
679 foreach i
$w_columns {
680 $i tag conf g
$cmit -background $active_color
687 catch {set author_name
$header($cmit,author
)}
688 catch {set author_email
$header($cmit,author-mail
)}
689 catch {set author_time
[clock format \
690 $header($cmit,author-time
) \
691 -format {%Y-
%m-
%d
%H
:%M
:%S
}
694 set committer_name
{}
695 set committer_email
{}
696 set committer_time
{}
697 catch {set committer_name
$header($cmit,committer
)}
698 catch {set committer_email
$header($cmit,committer-mail
)}
699 catch {set committer_time
[clock format \
700 $header($cmit,committer-time
) \
701 -format {%Y-
%m-
%d
%H
:%M
:%S
}
704 if {[catch {set msg
$header($cmit,message)}]} {
707 set fd
[open "| git cat-file commit $cmit" r
]
708 fconfigure $fd -encoding binary -translation lf
709 if {[catch {set enc
$repo_config(i18n.commitencoding
)}]} {
712 while {[gets $fd line
] > 0} {
713 if {[string match
{encoding *} $line]} {
714 set enc
[string tolower
[string range
$line 9 end
]]
717 set msg
[encoding convertfrom
$enc [read $fd]]
718 set msg
[string trim
$msg]
721 set author_name
[encoding convertfrom
$enc $author_name]
722 set committer_name
[encoding convertfrom
$enc $committer_name]
724 set header
($cmit,author
) $author_name
725 set header
($cmit,committer
) $committer_name
727 set header
($cmit,message) $msg
730 $w_cviewer insert end
"commit $cmit\n" header_key
731 $w_cviewer insert end
"Author:\t" header_key
732 $w_cviewer insert end
"$author_name $author_email" header_val
733 $w_cviewer insert end
" $author_time\n" header_val
735 $w_cviewer insert end
"Committer:\t" header_key
736 $w_cviewer insert end
"$committer_name $committer_email" header_val
737 $w_cviewer insert end
" $committer_time\n" header_val
739 if {$file ne
$path} {
740 $w_cviewer insert end
"Original File:\t" header_key
741 $w_cviewer insert end
"[escape_path $file]\n" header_val
744 $w_cviewer insert end
"\n$msg"
746 $w_cviewer conf
-state disabled
748 set highlight_line
$lno
749 set highlight_commit
$cmit
751 if {[lsearch -exact $tooltip_commit $highlight_commit] != -1} {
756 method _copycommit
{} {
757 set pos
@$::cursorX,$::cursorY
758 set lno
[lindex [split [$::cursorW index
$pos] .
] 0]
759 set dat
[lindex $amov_data $lno]
769 method _show_tooltip
{cur_w pos
} {
770 if {$tooltip_wm ne
{}} {
771 _open_tooltip
$this $cur_w
772 } elseif
{$tooltip_timer eq
{}} {
773 set tooltip_timer
[after 1000 [cb _open_tooltip
$cur_w]]
777 method _open_tooltip
{cur_w
} {
779 set pos_x
[winfo pointerx
$cur_w]
780 set pos_y
[winfo pointery
$cur_w]
781 if {[winfo containing
$pos_x $pos_y] ne
$cur_w} {
786 if {$tooltip_wm ne
"$cur_w.tooltip"} {
789 set tooltip_wm
[toplevel $cur_w.tooltip
-borderwidth 1]
790 wm overrideredirect
$tooltip_wm 1
791 wm transient
$tooltip_wm [winfo toplevel $cur_w]
792 set tooltip_t
$tooltip_wm.
label
795 -highlightthickness 0 \
799 -background lightyellow
\
801 $tooltip_t tag conf section_header
-font font_uibold
804 $tooltip_t conf
-state normal
805 $tooltip_t delete
0.0 end
808 set pos
@[join [list \
809 [expr {$pos_x - [winfo rootx
$cur_w]}] \
810 [expr {$pos_y - [winfo rooty
$cur_w]}]] ,]
811 set lno
[lindex [split [$cur_w index
$pos] .
] 0]
812 if {$cur_w eq
$w_amov} {
813 set dat
[lindex $amov_data $lno]
816 set dat
[lindex $asim_data $lno]
817 set org
[lindex $amov_data $lno]
820 set cmit
[lindex $dat 0]
821 set tooltip_commit
[list $cmit]
826 catch {set author_name
$header($cmit,author
)}
827 catch {set summary
$header($cmit,summary
)}
828 catch {set author_time
[clock format \
829 $header($cmit,author-time
) \
830 -format {%Y-
%m-
%d
%H
:%M
:%S
}
833 $tooltip_t insert end
"commit $cmit\n"
834 $tooltip_t insert end
"$author_name $author_time\n"
835 $tooltip_t insert end
"$summary"
837 if {$org ne
{} && [lindex $org 0] ne
$cmit} {
838 $tooltip_t insert
0.0 "Moved Here By:\n" section_header
839 set cmit
[lindex $org 0]
840 set file [lindex $org 1]
841 lappend tooltip_commit
$cmit
846 catch {set author_name
$header($cmit,author
)}
847 catch {set summary
$header($cmit,summary
)}
848 catch {set author_time
[clock format \
849 $header($cmit,author-time
) \
850 -format {%Y-
%m-
%d
%H
:%M
:%S
}
853 $tooltip_t insert end
"\n\n"
854 $tooltip_t insert end
"Originally By:\n" section_header
855 $tooltip_t insert end
"commit $cmit\n"
856 $tooltip_t insert end
"$author_name $author_time\n"
857 $tooltip_t insert end
"$summary"
859 if {$file ne
$path} {
860 $tooltip_t insert end
"\n"
861 $tooltip_t insert end
"File: " section_header
862 $tooltip_t insert end
$file
866 $tooltip_t conf
-state disabled
867 _position_tooltip
$this
870 method _position_tooltip
{} {
871 set max_h
[lindex [split [$tooltip_t index end
] .
] 0]
873 for {set i
1} {$i <= $max_h} {incr i
} {
874 set c
[lindex [split [$tooltip_t index
"$i.0 lineend"] .
] 1]
875 if {$c > $max_w} {set max_w
$c}
877 $tooltip_t conf
-width $max_w -height $max_h
879 set req_w
[winfo reqwidth
$tooltip_t]
880 set req_h
[winfo reqheight
$tooltip_t]
881 set pos_x
[expr {[winfo pointerx .
] + 5}]
882 set pos_y
[expr {[winfo pointery .
] + 10}]
884 set g
"${req_w}x${req_h}"
885 if {$pos_x >= 0} {append g
+}
887 if {$pos_y >= 0} {append g
+}
890 wm geometry
$tooltip_wm $g
894 method _hide_tooltip
{} {
895 if {$tooltip_wm ne
{}} {
898 set tooltip_commit
{}
900 if {$tooltip_timer ne
{}} {
901 after cancel
$tooltip_timer
906 method _resize
{new_height
} {
907 set diff
[expr {$new_height - $old_height}]
908 if {$diff == 0} return
910 set my
[expr {[winfo height
$w.file_pane
] - 25}]
911 set o
[$w.file_pane sash coord
0]
913 set oy
[expr {[lindex $o 1] + $diff}]
914 if {$oy < 0} {set oy
0}
915 if {$oy > $my} {set oy
$my}
916 $w.file_pane sash
place 0 $ox $oy
918 set old_height
$new_height