commit d0796bde4f0179b65a2c4b07057be5d7f2e95ee9
parent a6e7d5c99bedb3500c2b983aba0152dffeed7d08
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 17 May 2025 09:17:04 +0200
history: always save the last cursor position, also for line=1,column=1
This may seem a little wasteful, as line=1,column=1 is the default
cursor position, but this change enables the next commit: always
saving any anchors. In the bargain, the position-history file now
contains a list of all files that were recently opened with nano.
Diffstat:
1 file changed, 0 insertions(+), 17 deletions(-)
diff --git a/src/history.c b/src/history.c
@@ -551,23 +551,6 @@ void update_poshistory(void)
previous = item;
}
- /* Don't record files that have the default cursor position. */
- if (openfile->current->lineno == 1 && openfile->current_x == 0 &&
- !openfile->filetop->has_anchor) {
- if (item != NULL) {
- if (previous == NULL)
- position_history = item->next;
- else
- previous->next = item->next;
- free(item->filename);
- free(item->anchors);
- free(item);
- save_poshistory();
- }
- free(fullpath);
- return;
- }
-
/* If no match was found, make a new node; otherwise, unlink the match. */
if (item == NULL) {
item = nmalloc(sizeof(poshiststruct));