From ecd18c1694e229c050e9d0be99b28b627a5977b6 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg <bensberg@justemail.net> Date: Sun, 18 Dec 2016 19:57:33 +0100 Subject: [PATCH] history: search for the two position numbers from EOL instead of BOL A filename might contain spaces, so we can't look for the numbers (the second and third elements) starting from the head of the line -- we have to start at the tail and work backward. This fixes https://savannah.gnu.org/bugs/?49879. --- src/files.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/files.c b/src/files.c index 8eed4a49..5e00dd3f 100644 --- a/src/files.c +++ b/src/files.c @@ -3190,8 +3190,13 @@ void load_poshistory(void) /* Decode nulls as newlines. */ unsunder(line, read); - lineptr = parse_next_word(line); - xptr = parse_next_word(lineptr); + /* Find where x index and line number are in the line. */ + xptr = revstrstr(line, " ", line + read); + lineptr = revstrstr(line, " ", xptr - 1); + + /* Now separate the three elements of the line. */ + *(xptr++) = '\0'; + *(lineptr++) = '\0'; /* Create a new position record. */ newrecord = (poshiststruct *)nmalloc(sizeof(poshiststruct)); -- GitLab