summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorportix <none@none>2012-06-13 12:35:47 +0200
committerportix <none@none>2012-06-13 12:35:47 +0200
commita0835c12ddf1a13f695da7782b100c32f196c44f (patch)
tree9e4a9d558b13780ee121d7f216371322d604b134 /src
parentd3c161a23aefc4631a7ccb4edb9871cdf961ada8 (diff)
downloaddwb-a0835c12ddf1a13f695da7782b100c32f196c44f.zip
Also strip history in dwb_sync_files
Diffstat (limited to 'src')
-rw-r--r--src/dwb.c3
-rw-r--r--src/util.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/dwb.c b/src/dwb.c
index eee064f7..88f6b0ff 100644
--- a/src/dwb.c
+++ b/src/dwb.c
@@ -1018,7 +1018,8 @@ dwb_remove_quickmark(const char *line) {
static gboolean
dwb_sync_files(gpointer data) {
GString *buffer = g_string_new(NULL);
- for (GList *gl = dwb.fc.history; gl; gl=gl->next) {
+ int i=0;
+ for (GList *gl = dwb.fc.history; gl && (dwb.misc.history_length < 0 || i < dwb.misc.history_length); gl=gl->next, i++) {
Navigation *n = gl->data;
g_string_append_printf(buffer, "%s %s\n", n->first, n->second);
}
diff --git a/src/util.c b/src/util.c
index 5949cc6e..16ab1e2d 100644
--- a/src/util.c
+++ b/src/util.c
@@ -647,7 +647,7 @@ util_file_add(const char *filename, const char *text, int append, int max) {
gboolean ret = false;
if ( (file = fopen(filename, "r"))) {
- for (int i=0; fgets(buffer, sizeof buffer, file) && (max < 0 || i < max-1); i++ ) {
+ for (int i=0; fgets(buffer, sizeof buffer, file) && (max < 0 || i < max); i++) {
tmp = buffer;
while (g_ascii_isspace(*tmp) && *tmp != '\n')
tmp++;