mirror of
https://github.com/git/git.git
synced 2026-06-30 19:58:12 +00:00
Merge git://repo.or.cz/git-gui
* git://repo.or.cz/git-gui: git-gui: incremental goto line in blame view git-gui: clear the goto line input when hiding git-gui: only accept numbers in the goto-line input git-gui: search and linenumber input are mutual exclusive in the blame view git-gui: deal with unknown files when pressing the "Stage Changed" button git-gui: drop the 'n' and 'Shift-n' bindings from the last patch. git-gui: Add keyboard shortcuts for search and goto commands in blame view. git-gui: Enable jumping to a specific line number in blame view. Fix tooltip display with multiple monitors on windows. Fix typo: existant->existent git-gui: updated translator README for current procedures. git-gui: warn when trying to commit on a detached head git-gui: Corrected a typo in the Swedish translation of 'Continue'
This commit is contained in:
@@ -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
|
||||
@@ -1298,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
|
||||
@@ -1336,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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -610,9 +610,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
|
||||
|
||||
@@ -260,8 +260,23 @@ proc commit_prehook_wait {fd_ph curHEAD msg_p} {
|
||||
}
|
||||
|
||||
proc commit_commitmsg {curHEAD msg_p} {
|
||||
global is_detached repo_config
|
||||
global pch_error
|
||||
|
||||
if {$is_detached && $repo_config(gui.warndetachedcommit)} {
|
||||
set msg [mc "You are about to commit on a detached head.\
|
||||
This is a potentially dangerous thing to do because if you switch\
|
||||
to another branch you will loose your changes and it can be difficult\
|
||||
to retrieve them later from the reflog. You should probably cancel this\
|
||||
commit and create a new branch to continue.\n\
|
||||
\n\
|
||||
Do you really want to proceed with your Commit?"]
|
||||
if {[ask_popup $msg] ne yes} {
|
||||
unlock_index
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
# -- Run the commit-msg hook.
|
||||
#
|
||||
set fd_ph [githook_read commit-msg $msg_p]
|
||||
|
||||
@@ -356,12 +356,21 @@ proc do_add_all {} {
|
||||
global file_states
|
||||
|
||||
set paths [list]
|
||||
set unknown_paths [list]
|
||||
foreach path [array names file_states] {
|
||||
switch -glob -- [lindex $file_states($path) 0] {
|
||||
U? {continue}
|
||||
?M -
|
||||
?T -
|
||||
?D {lappend paths $path}
|
||||
?O {lappend unknown_paths $path}
|
||||
}
|
||||
}
|
||||
if {[llength $unknown_paths]} {
|
||||
set reply [ask_popup [mc "There are unknown files do you also want
|
||||
to stage those?"]]
|
||||
if {$reply} {
|
||||
set paths [concat $paths $unknown_paths]
|
||||
}
|
||||
}
|
||||
add_helper {Adding all changed files} $paths
|
||||
|
||||
81
git-gui/lib/line.tcl
Normal file
81
git-gui/lib/line.tcl
Normal file
@@ -0,0 +1,81 @@
|
||||
# goto line number
|
||||
# based on code from gitk, Copyright (C) Paul Mackerras
|
||||
|
||||
class linebar {
|
||||
|
||||
field w
|
||||
field ctext
|
||||
|
||||
field linenum {}
|
||||
|
||||
constructor new {i_w i_text args} {
|
||||
global use_ttk NS
|
||||
set w $i_w
|
||||
set ctext $i_text
|
||||
|
||||
${NS}::frame $w
|
||||
${NS}::label $w.l -text [mc "Goto Line:"]
|
||||
entry $w.ent \
|
||||
-textvariable ${__this}::linenum \
|
||||
-background lightgreen \
|
||||
-validate key \
|
||||
-validatecommand [cb _validate %P]
|
||||
${NS}::button $w.bn -text [mc Go] -command [cb _goto]
|
||||
|
||||
pack $w.l -side left
|
||||
pack $w.bn -side right
|
||||
pack $w.ent -side left -expand 1 -fill x
|
||||
|
||||
eval grid conf $w -sticky we $args
|
||||
grid remove $w
|
||||
|
||||
trace add variable linenum write [cb _goto_cb]
|
||||
bind $w.ent <Return> [cb _goto]
|
||||
bind $w.ent <Escape> [cb hide]
|
||||
|
||||
bind $w <Destroy> [list delete_this $this]
|
||||
return $this
|
||||
}
|
||||
|
||||
method show {} {
|
||||
if {![visible $this]} {
|
||||
grid $w
|
||||
}
|
||||
focus -force $w.ent
|
||||
}
|
||||
|
||||
method hide {} {
|
||||
if {[visible $this]} {
|
||||
$w.ent delete 0 end
|
||||
focus $ctext
|
||||
grid remove $w
|
||||
}
|
||||
}
|
||||
|
||||
method visible {} {
|
||||
return [winfo ismapped $w]
|
||||
}
|
||||
|
||||
method editor {} {
|
||||
return $w.ent
|
||||
}
|
||||
|
||||
method _validate {P} {
|
||||
# only accept numbers as input
|
||||
string is integer $P
|
||||
}
|
||||
|
||||
method _goto_cb {name ix op} {
|
||||
after idle [cb _goto 1]
|
||||
}
|
||||
|
||||
method _goto {{nohide {0}}} {
|
||||
if {$linenum ne {}} {
|
||||
$ctext see $linenum.0
|
||||
if {!$nohide} {
|
||||
hide $this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,6 +35,8 @@ constructor new {i_w i_text args} {
|
||||
grid remove $w
|
||||
|
||||
trace add variable searchstring write [cb _incrsearch_cb]
|
||||
bind $w.ent <Return> [cb find_next]
|
||||
bind $w.ent <Shift-Return> [cb find_prev]
|
||||
|
||||
bind $w <Destroy> [list delete_this $this]
|
||||
return $this
|
||||
@@ -196,4 +198,4 @@ method scrolled {} {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user