nano

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

commit e6f26464d7fb0d6948a883a3b816d7cab1bd0a1d
parent a0aeeba075e6aacd3959a4c7e6405c5442b61a45
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri, 28 Feb 2020 19:15:23 +0100

tweaks: add calls of die() for five theoretical programming mistakes

Diffstat:
Msrc/global.c | 3++-
Msrc/text.c | 9+++++----
2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/global.c b/src/global.c @@ -1484,7 +1484,8 @@ const char *flagtostr(int flag) case LINE_NUMBERS: return N_("Line numbering"); default: - return "Bad toggle -- please report a bug"; + die("Bad toggle -- please report a bug\n"); + return ""; } } #endif /* !NANO_TINY */ diff --git a/src/text.c b/src/text.c @@ -282,7 +282,7 @@ void handle_indent_action(undostruct *u, bool undoing, bool add_indent) linestruct *line = line_from_number(group->top_line); if (group->next != NULL) - statusline(ALERT, "Multiple groups -- please report a bug"); + die("Multiple groups -- please report a bug\n"); /* When redoing, reposition the cursor and let the indenter adjust it. */ if (!undoing) @@ -1220,8 +1220,9 @@ void add_undo(undo_type action, const char *message) case COMMENT: case UNCOMMENT: #endif - default: break; + default: + die("Bad undo type -- please report a bug\n"); } openfile->last_action = action; @@ -1271,7 +1272,7 @@ void update_undo(undo_type action) int charlen; if (u->type != action) - statusline(ALERT, "Mismatching undo type -- please report a bug"); + die("Mismatching undo type -- please report a bug\n"); u->newsize = openfile->totsize; @@ -1360,7 +1361,7 @@ void update_undo(undo_type action) u->head_x = openfile->current_x; break; default: - break; + die("Bad undo type -- please report a bug\n"); } } #endif /* !NANO_TINY */