diff --git a/src/files.c b/src/files.c
index 8eed4a4990cbff3a851c006bb3128e1fffb15d22..5e00dd3f069b9f50d430002dd5df4852fab94c6c 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));