nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 8036d4beaa19816ea93caab3b8e63727444102c8
parent 14f17c36010ec9428aeca8f6f5b1ad3e285655d1
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Mon,  9 Jun 2025 12:27:21 +0200

build: fix compilation when configured with --disable-histories

In a tiny nano, there are no anchors, so none need saving/restoring.

Diffstat:
Msrc/definitions.h | 2+-
Msrc/history.c | 5++++-
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/definitions.h b/src/definitions.h @@ -484,7 +484,7 @@ typedef struct linestruct { short *multidata; /* Array of which multi-line regexes apply to this line. */ #endif -#ifdef ENABLE_HISTORIES +#ifndef NANO_TINY bool has_anchor; /* Whether the user has placed an anchor at this line. */ #endif diff --git a/src/history.c b/src/history.c @@ -353,6 +353,7 @@ void save_history(void) char *stringify_anchors(void) { char *string = copy_of(""); +#ifndef NANO_TINY char number[24]; for (linestruct *line = openfile->filetop; line != NULL; line = line->next) @@ -361,13 +362,14 @@ char *stringify_anchors(void) string = nrealloc(string, strlen(string) + strlen(number) + 1); strcat(string, number); } - +#endif return string; } /* Set an anchor for each line number in the given string. */ void restore_anchors(char *string) { +#ifndef NANO_TINY linestruct *line = openfile->filetop; ssize_t number; char *space; @@ -385,6 +387,7 @@ void restore_anchors(char *string) line->has_anchor = TRUE; } +#endif } /* Load the recorded cursor positions for files that were edited. */