diff options
Diffstat (limited to 'git-gui/lib/blame.tcl')
-rw-r--r-- | git-gui/lib/blame.tcl | 59 |
1 files changed, 53 insertions, 6 deletions
diff --git a/git-gui/lib/blame.tcl b/git-gui/lib/blame.tcl index 786b50b8c2..691941e959 100644 --- a/git-gui/lib/blame.tcl +++ b/git-gui/lib/blame.tcl @@ -22,6 +22,7 @@ field w_asim ; # text column: annotations (simple computation) field w_file ; # text column: actual file data field w_cviewer ; # pane showing commit message field finder ; # find mini-dialog frame +field gotoline ; # line goto mini-dialog frame field status ; # status mega-widget instance field old_height ; # last known height of $w.file_pane @@ -231,6 +232,11 @@ constructor new {i_commit i_path i_jump} { -column [expr {[llength $w_columns] - 1}] \ ] + set gotoline [::linebar::new \ + $w.file_pane.out.lf $w_file \ + -column [expr {[llength $w_columns] - 1}] \ + ] + set w_cviewer $w.file_pane.cm.t text $w_cviewer \ -background white \ @@ -274,7 +280,11 @@ constructor new {i_commit i_path i_jump} { $w.ctxm add command \ -label [mc "Find Text..."] \ -accelerator F7 \ - -command [list searchbar::show $finder] + -command [cb _show_finder] + $w.ctxm add command \ + -label [mc "Goto Line..."] \ + -accelerator "Ctrl-G" \ + -command [cb _show_linebar] menu $w.ctxm.enc build_encoding_menu $w.ctxm.enc [cb _setencoding] $w.ctxm add cascade \ @@ -341,10 +351,13 @@ constructor new {i_commit i_path i_jump} { bind $w_cviewer <Tab> "[list focus $w_file];break" bind $w_cviewer <Button-1> [list focus $w_cviewer] bind $w_file <Visibility> [cb _focus_search $w_file] - bind $top <F7> [list searchbar::show $finder] + bind $top <F7> [cb _show_finder] + bind $top <Key-slash> [cb _show_finder] + bind $top <Control-Key-s> [cb _show_finder] bind $top <Escape> [list searchbar::hide $finder] bind $top <F3> [list searchbar::find_next $finder] bind $top <Shift-F3> [list searchbar::find_prev $finder] + bind $top <Control-Key-g> [cb _show_linebar] catch { bind $top <Shift-Key-XF86_Switch_VT_3> [list searchbar::find_prev $finder] } grid configure $w.header -sticky ew @@ -449,11 +462,35 @@ method _load {jump} { $status show [mc "Reading %s..." "$commit:[escape_path $path]"] $w_path conf -text [escape_path $path] + + set do_textconv 0 + if {![is_config_false gui.textconv] && [git-version >= 1.7.2]} { + set filter [gitattr $path diff set] + set textconv [get_config [join [list diff $filter textconv] .]] + if {$filter ne {set} && $textconv ne {}} { + set do_textconv 1 + } + } if {$commit eq {}} { - set fd [open $path r] + if {$do_textconv ne 0} { + # Run textconv with sh -c "..." to allow it to + # contain command + arguments. On windows, just + # call the filter command. + if {![file executable [shellpath]]} { + set fd [open |[linsert $textconv end $path] r] + } else { + set fd [open |[list [shellpath] -c "$textconv \"\$0\"" $path] r] + } + } else { + set fd [open $path r] + } fconfigure $fd -eofchar {} } else { - set fd [git_read cat-file blob "$commit:$path"] + if {$do_textconv ne 0} { + set fd [git_read cat-file --textconv "$commit:$path"] + } else { + set fd [git_read cat-file blob "$commit:$path"] + } } fconfigure $fd \ -blocking 0 \ @@ -1274,9 +1311,9 @@ method _position_tooltip {} { set pos_y [expr {[winfo pointery .] + 10}] set g "${req_w}x${req_h}" - if {$pos_x >= 0} {append g +} + if {[tk windowingsystem] eq "win32" || $pos_x >= 0} {append g +} append g $pos_x - if {$pos_y >= 0} {append g +} + if {[tk windowingsystem] eq "win32" || $pos_y >= 0} {append g +} append g $pos_y wm geometry $tooltip_wm $g @@ -1312,4 +1349,14 @@ method _resize {new_height} { set old_height $new_height } +method _show_finder {} { + linebar::hide $gotoline + searchbar::show $finder +} + +method _show_linebar {} { + searchbar::hide $finder + linebar::show $gotoline +} + } |