diff options
Diffstat (limited to 'desktop/gmrun/patches/50-empty-history.patch')
-rw-r--r-- | desktop/gmrun/patches/50-empty-history.patch | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/desktop/gmrun/patches/50-empty-history.patch b/desktop/gmrun/patches/50-empty-history.patch new file mode 100644 index 0000000000..7f9477f7b6 --- /dev/null +++ b/desktop/gmrun/patches/50-empty-history.patch @@ -0,0 +1,36 @@ +# Description: Don't create an empty history file when History=0 +# Author: <bdefreese@bddebian3.bddebian.com> + +Index: gmrun-0.9.2/src/history.cc +=================================================================== +--- gmrun-0.9.2.orig/src/history.cc 2010-02-03 12:33:29.575767540 +0800 ++++ gmrun-0.9.2/src/history.cc 2010-02-03 12:34:47.349422238 +0800 +@@ -65,17 +65,19 @@ + if (!configuration.get_int("History", HIST_MAX_SIZE)) + HIST_MAX_SIZE = 20; + +- ofstream f(filename, ios::out); ++ if (HIST_MAX_SIZE) { ++ ofstream f(filename, ios::out); + +- int start = 0; +- if (history.size() > (size_t)HIST_MAX_SIZE) +- start = history.size() - HIST_MAX_SIZE; ++ int start = 0; ++ if (history.size() > (size_t)HIST_MAX_SIZE) ++ start = history.size() - HIST_MAX_SIZE; ++ ++ for (size_t i = start; i < history.size(); i++) ++ if (history[i].length() != 0) ++ f << history[i] << endl; + +- for (size_t i = start; i < history.size(); i++) +- if (history[i].length() != 0) +- f << history[i] << endl; +- +- f.flush(); ++ f.flush(); ++ } + } + + void |