* How to make gitk not overwrite my selection? @ 2008-03-04 15:39 Jean-Luc Herren 2008-03-04 23:03 ` Jeff King 0 siblings, 1 reply; 6+ messages in thread From: Jean-Luc Herren @ 2008-03-04 15:39 UTC (permalink / raw) To: git Hi list! In gitk, whenever I select a commit in the tree, the SHA1 field gets automatically selected, putting its hash into the current selection for easy pasting into other applications. I wonder if I can disable this, because I find it rather annoying; if I do happen to want to paste the hash somewhere, I can easily double click the SHA1 field. This is specially annoying when I select a hash in xterm and then start gitk to paste it in the SHA1 field. But immediately after gitk opens, it preselects the current HEAD, overwriting my previous selection from xterm. Generally I think an application should not replace the selection unless the user explicitely marks something. Although I can understand that it can be useful sometimes with gitk. Therefore it should maybe be optional. Thanks, jlh ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to make gitk not overwrite my selection? 2008-03-04 15:39 How to make gitk not overwrite my selection? Jean-Luc Herren @ 2008-03-04 23:03 ` Jeff King 2008-03-05 22:44 ` Jean-Luc Herren 2008-03-06 10:34 ` Paul Mackerras 0 siblings, 2 replies; 6+ messages in thread From: Jeff King @ 2008-03-04 23:03 UTC (permalink / raw) To: Jean-Luc Herren; +Cc: Paul Mackerras, git On Tue, Mar 04, 2008 at 04:39:08PM +0100, Jean-Luc Herren wrote: > In gitk, whenever I select a commit in the tree, the SHA1 field > gets automatically selected, putting its hash into the current > selection for easy pasting into other applications. I wonder if I > can disable this, because I find it rather annoying; if I do > happen to want to paste the hash somewhere, I can easily double > click the SHA1 field. > > This is specially annoying when I select a hash in xterm and then > start gitk to paste it in the SHA1 field. But immediately after > gitk opens, it preselects the current HEAD, overwriting my > previous selection from xterm. > > Generally I think an application should not replace the selection > unless the user explicitely marks something. Although I can > understand that it can be useful sometimes with gitk. Therefore > it should maybe be optional. The patch below seems to work for me (see the "auto-select sha1" option under preferences). However, I don't actually know tcl, so I cargo-culted all of the option processing magic. Paul, if you want to take this patch, please read it carefully. ;) -- >8 -- gitk: make autoselect optional Some users find it annoying to have the selection automatically changed without any user intervention, since it can overwrite something they actually wanted to keep in the selection buffer. --- gitk-git/gitk | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gitk-git/gitk b/gitk-git/gitk index f1f21e9..915dfb8 100644 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -1163,6 +1163,7 @@ proc savestuff {w} { global viewname viewfiles viewargs viewperm nextviewnum global cmitmode wrapcomment datetimeformat limitdiffs global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor + global autoselect if {$stuffsaved} return if {![winfo viewable .]} return @@ -1177,6 +1178,7 @@ proc savestuff {w} { puts $f [list set maxwidth $maxwidth] puts $f [list set cmitmode $cmitmode] puts $f [list set wrapcomment $wrapcomment] + puts $f [list set autoselect $autoselect] puts $f [list set showneartags $showneartags] puts $f [list set showlocalchanges $showlocalchanges] puts $f [list set datetimeformat $datetimeformat] @@ -4650,6 +4652,7 @@ proc selectline {l isnew} { global commentend idtags linknum global mergemax numcommits pending_select global cmitmode showneartags allcommits + global autoselect catch {unset pending_select} $canv delete hover @@ -4705,8 +4708,10 @@ proc selectline {l isnew} { set currentid $id $sha1entry delete 0 end $sha1entry insert 0 $id - $sha1entry selection from 0 - $sha1entry selection to end + if {$autoselect} { + $sha1entry selection from 0 + $sha1entry selection to end + } rhighlight_sel $id $ctext conf -state normal @@ -7943,7 +7948,7 @@ proc doprefs {} { global maxwidth maxgraphpct global oldprefs prefstop showneartags showlocalchanges global bgcolor fgcolor ctext diffcolors selectbgcolor - global tabstop limitdiffs + global tabstop limitdiffs autoselect set top .gitkprefs set prefstop $top @@ -7973,6 +7978,11 @@ proc doprefs {} { checkbutton $top.showlocal.b -variable showlocalchanges pack $top.showlocal.b $top.showlocal.l -side left grid x $top.showlocal -sticky w + frame $top.autoselect + label $top.autoselect.l -text [mc "Auto-select sha1"] -font optionfont + checkbutton $top.autoselect.b -variable autoselect + pack $top.autoselect.b $top.autoselect.l -side left + grid x $top.autoselect -sticky w label $top.ddisp -text [mc "Diff display options"] grid $top.ddisp - -sticky w -pady 10 @@ -8463,6 +8473,7 @@ set maxlinelen 200 set showlocalchanges 1 set limitdiffs 1 set datetimeformat "%Y-%m-%d %H:%M:%S" +set autoselect 1 set colors {green red blue magenta darkgrey brown orange} set bgcolor white -- 1.5.4.3.530.gbda49 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: How to make gitk not overwrite my selection? 2008-03-04 23:03 ` Jeff King @ 2008-03-05 22:44 ` Jean-Luc Herren 2008-03-05 23:00 ` Martin Langhoff 2008-03-06 10:34 ` Paul Mackerras 1 sibling, 1 reply; 6+ messages in thread From: Jean-Luc Herren @ 2008-03-05 22:44 UTC (permalink / raw) To: Jeff King; +Cc: Paul Mackerras, git Jeff King wrote: > On Tue, Mar 04, 2008 at 04:39:08PM +0100, Jean-Luc Herren wrote: >> In gitk, whenever I select a commit in the tree, the SHA1 field >> gets automatically selected, putting its hash into the current >> selection for easy pasting into other applications. > The patch below seems to work for me (see the "auto-select sha1" option > under preferences). However, I don't actually know tcl, so I > cargo-culted all of the option processing magic. Paul, if you want to > take this patch, please read it carefully. ;) Thanks, I don't know tcl either, but the patch seems to work great here. jlh ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to make gitk not overwrite my selection? 2008-03-05 22:44 ` Jean-Luc Herren @ 2008-03-05 23:00 ` Martin Langhoff 0 siblings, 0 replies; 6+ messages in thread From: Martin Langhoff @ 2008-03-05 23:00 UTC (permalink / raw) To: Jean-Luc Herren; +Cc: Jeff King, Paul Mackerras, git On Thu, Mar 6, 2008 at 11:44 AM, Jean-Luc Herren <jlh@gmx.ch> wrote: > Thanks, I don't know tcl either, but the patch seems to work great > here. Taking it too here. Welcome option. m ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to make gitk not overwrite my selection? 2008-03-04 23:03 ` Jeff King 2008-03-05 22:44 ` Jean-Luc Herren @ 2008-03-06 10:34 ` Paul Mackerras 2008-03-06 11:49 ` [PATCH] gitk: make autoselect optional Jeff King 1 sibling, 1 reply; 6+ messages in thread From: Paul Mackerras @ 2008-03-06 10:34 UTC (permalink / raw) To: Jeff King; +Cc: Jean-Luc Herren, git Jeff King writes: > The patch below seems to work for me (see the "auto-select sha1" option > under preferences). However, I don't actually know tcl, so I > cargo-culted all of the option processing magic. Paul, if you want to > take this patch, please read it carefully. ;) Looks OK to me. Care to re-send it with a Signed-off-by? Oh, and put "sha1" in capitals, i.e. "SHA1". (Tcl is actually a very simple language, and there are man pages for it; try "man Tcl" for a start. :) Paul. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] gitk: make autoselect optional 2008-03-06 10:34 ` Paul Mackerras @ 2008-03-06 11:49 ` Jeff King 0 siblings, 0 replies; 6+ messages in thread From: Jeff King @ 2008-03-06 11:49 UTC (permalink / raw) To: Paul Mackerras; +Cc: Jean-Luc Herren, git Whenever a commit is selected in the graph pane, its SHA1 is automatically put into the selection buffer for cut and paste. However, some users may find this behavior annoying since it can overwrite something they actually wanted to keep in the buffer. This patch makes the behavior optional under the name "Auto-select SHA1", but continues to default to "on". Signed-off-by: Jeff King <peff@peff.net> --- On Thu, Mar 06, 2008 at 09:34:30PM +1100, Paul Mackerras wrote: > Looks OK to me. Care to re-send it with a Signed-off-by? Oh, and > put "sha1" in capitals, i.e. "SHA1". Here it is, with both requested items and a slightly more coherent commit message. > (Tcl is actually a very simple language, and there are man pages for > it; try "man Tcl" for a start. :) Heh. My biggest concern was "did I get everywhere that options must be mentioned" (which isn't a Tcl thing at all, of course). I tested that the option works, and that it correctly saves the value in the .gitk file and respects it on the next run. gitk-git/gitk | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gitk-git/gitk b/gitk-git/gitk index f1f21e9..36fdecd 100644 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -1163,6 +1163,7 @@ proc savestuff {w} { global viewname viewfiles viewargs viewperm nextviewnum global cmitmode wrapcomment datetimeformat limitdiffs global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor + global autoselect if {$stuffsaved} return if {![winfo viewable .]} return @@ -1177,6 +1178,7 @@ proc savestuff {w} { puts $f [list set maxwidth $maxwidth] puts $f [list set cmitmode $cmitmode] puts $f [list set wrapcomment $wrapcomment] + puts $f [list set autoselect $autoselect] puts $f [list set showneartags $showneartags] puts $f [list set showlocalchanges $showlocalchanges] puts $f [list set datetimeformat $datetimeformat] @@ -4650,6 +4652,7 @@ proc selectline {l isnew} { global commentend idtags linknum global mergemax numcommits pending_select global cmitmode showneartags allcommits + global autoselect catch {unset pending_select} $canv delete hover @@ -4705,8 +4708,10 @@ proc selectline {l isnew} { set currentid $id $sha1entry delete 0 end $sha1entry insert 0 $id - $sha1entry selection from 0 - $sha1entry selection to end + if {$autoselect} { + $sha1entry selection from 0 + $sha1entry selection to end + } rhighlight_sel $id $ctext conf -state normal @@ -7943,7 +7948,7 @@ proc doprefs {} { global maxwidth maxgraphpct global oldprefs prefstop showneartags showlocalchanges global bgcolor fgcolor ctext diffcolors selectbgcolor - global tabstop limitdiffs + global tabstop limitdiffs autoselect set top .gitkprefs set prefstop $top @@ -7973,6 +7978,11 @@ proc doprefs {} { checkbutton $top.showlocal.b -variable showlocalchanges pack $top.showlocal.b $top.showlocal.l -side left grid x $top.showlocal -sticky w + frame $top.autoselect + label $top.autoselect.l -text [mc "Auto-select SHA1"] -font optionfont + checkbutton $top.autoselect.b -variable autoselect + pack $top.autoselect.b $top.autoselect.l -side left + grid x $top.autoselect -sticky w label $top.ddisp -text [mc "Diff display options"] grid $top.ddisp - -sticky w -pady 10 @@ -8463,6 +8473,7 @@ set maxlinelen 200 set showlocalchanges 1 set limitdiffs 1 set datetimeformat "%Y-%m-%d %H:%M:%S" +set autoselect 1 set colors {green red blue magenta darkgrey brown orange} set bgcolor white -- 1.5.4.3.532.gf15a6 ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-03-06 11:50 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-03-04 15:39 How to make gitk not overwrite my selection? Jean-Luc Herren 2008-03-04 23:03 ` Jeff King 2008-03-05 22:44 ` Jean-Luc Herren 2008-03-05 23:00 ` Martin Langhoff 2008-03-06 10:34 ` Paul Mackerras 2008-03-06 11:49 ` [PATCH] gitk: make autoselect optional Jeff King
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).