Commit 7da7bcb4 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Do not display recent files if there aren't any

Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent 5d490f68
......@@ -2,11 +2,25 @@
#
# See LICENSE file for license and copyright information
import os.path
import glob
import time
dirname = os.path.dirname(__file__)
files = glob.glob(os.path.join(dirname, '*.rst'))
files.extend(glob.glob(os.path.join(dirname, '*.txt')))
maxdate = 0
for path in files:
s = os.stat(path)
maxdate = max(maxdate, s.st_mtime)
# -- General configuration ------------------------------------------------
source_suffix = '.rst'
master_doc = 'zathura.1'
templates_path = ['_templates']
today = time.strftime('%Y-%m-%d', time.gmtime(maxdate))
# -- Project configuration ------------------------------------------------
......
......@@ -196,13 +196,18 @@ list_files_for_cc(zathura_t* zathura, const char* input, bool check_file_ext, in
goto error_free;
}
const size_t path_len = strlen(path);
GIRARA_LIST_FOREACH(recent_files, const char*, iter, file)
if (strncmp(path, file, path_len) == 0) {
girara_completion_group_add_element(history_group, file, NULL);
}
GIRARA_LIST_FOREACH_END(recent_files, const char*, iter, file);
girara_list_free(recent_files);
if (girara_list_size(recent_files) != 0) {
const size_t path_len = strlen(path);
GIRARA_LIST_FOREACH(recent_files, const char*, iter, file)
if (strncmp(path, file, path_len) == 0) {
girara_completion_group_add_element(history_group, file, NULL);
}
GIRARA_LIST_FOREACH_END(recent_files, const char*, iter, file);
girara_list_free(recent_files);
} else {
girara_completion_group_free(history_group);
history_group = NULL;
}
}
g_free(path);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment