aboutsummaryrefslogtreecommitdiff
path: root/lib/commit.tcl
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-07-21 04:57:57 -0400
committerShawn O. Pearce <spearce@spearce.org>2007-07-21 04:57:57 -0400
commit4578c5cb690df98d0d5fbea043114b4b7dec8f57 (patch)
treef87d9bacb1e85469d1becbbe641fb6c6f794d1ff /lib/commit.tcl
parent5dc2cae6f4c5d7218c4323ceafb96ab8469be52e (diff)
downloadgit-4578c5cb690df98d0d5fbea043114b4b7dec8f57.tar.gz
git-4578c5cb690df98d0d5fbea043114b4b7dec8f57.tar.xz
git-gui: Automatically backup the user's commit buffer
A few users have been seeing crashes in Tk when using the undo key binding to undo the last few keystroke events in the commit buffer. Unfortunately that means the user loses their commit message and must start over from scratch when the user restarts the process. git-gui now saves the user's commit message buffer every couple of seconds to a temporary file under .git (specifically .git/GITGUI_BCK). At exit time we rename this file to .git/GITGUI_MSG if there is a message, the file exists, and it is currently synchronized with the Tk buffer. Otherwise we do our usual routine of saving the Tk buffer to .git/GITGUI_MSG and delete .git/GITGUI_BCK, if it exists. During startup we favor .git/GITGUI_BCK over .git/GITGUI_MSG. This way a crash doesn't take out the user's message buffer but instead will cause the user to lose only a few keystrokes. Most people do not type more than 200 WPM, and with 30 possible saves per minute we are unlikely to lose more than 7 words. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'lib/commit.tcl')
-rw-r--r--lib/commit.tcl4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/commit.tcl b/lib/commit.tcl
index 75b13a0d9..6b86f9808 100644
--- a/lib/commit.tcl
+++ b/lib/commit.tcl
@@ -379,6 +379,10 @@ A rescan will be automatically started now.
$ui_comm delete 0.0 end
$ui_comm edit reset
$ui_comm edit modified false
+ if {$::GITGUI_BCK_exists} {
+ catch {file delete [gitdir GITGUI_BCK]}
+ set $::GITGUI_BCK_exists 0
+ }
if {[is_enabled singlecommit]} do_quit