From c039aaad9d83cb9e1849ed3d3dbe5a8725a3ecec Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 14 Apr 2019 19:28:15 +0200 Subject: [PATCH] tweaks: remove several unneeded bad-state checks and their messages No one ever reported seeing any of them, and each of these checks has been there for at least a year. --- src/help.c | 3 --- src/text.c | 12 ------------ src/utils.c | 12 +++--------- src/winio.c | 22 +++------------------- 4 files changed, 6 insertions(+), 43 deletions(-) diff --git a/src/help.c b/src/help.c index 3b4969d6..2d68064a 100644 --- a/src/help.c +++ b/src/help.c @@ -556,9 +556,6 @@ void help_init(void) } } #endif /* !NANO_TINY */ - - if (strlen(help_text) > allocsize) - statusline(ALERT, "Help text spilled over -- please report a bug"); } /* Return the function that is bound to the given key, accepting certain diff --git a/src/text.c b/src/text.c index cfef0ab1..aa39ebe1 100644 --- a/src/text.c +++ b/src/text.c @@ -551,10 +551,6 @@ void do_undo(void) goto_line_posx(u->lineno, u->begin); break; case ENTER: - if (f->next == NULL) { - statusline(ALERT, "Missing break line -- please report a bug"); - break; - } undidmsg = _("line break"); from_x = (u->begin == 0) ? 0 : u->mark_begin_x; to_x = (u->begin == 0) ? u->mark_begin_x : u->begin; @@ -672,7 +668,6 @@ void do_undo(void) break; #endif default: - statusline(ALERT, "Wrong undo type -- please report a bug"); break; } @@ -752,10 +747,6 @@ void do_redo(void) goto_line_posx(u->lineno, u->begin); break; case JOIN: - if (f->next == NULL) { - statusline(ALERT, "Missing join line -- please report a bug"); - break; - } redidmsg = _("line join"); /* When the join was done by a Backspace at the tail of the file, * and the nonewlines flag isn't set, do not join anything, as @@ -838,7 +829,6 @@ void do_redo(void) break; #endif default: - statusline(ALERT, "Wrong redo type -- please report a bug"); break; } @@ -1264,7 +1254,6 @@ void add_undo(undo_type action) break; #endif default: - statusline(ALERT, "Wrong undo adding type -- please report a bug"); break; } @@ -1417,7 +1406,6 @@ void update_undo(undo_type action) u->begin = openfile->current_x; break; default: - statusline(ALERT, "Wrong undo update type -- please report a bug"); break; } } diff --git a/src/utils.c b/src/utils.c index fd335385..a4b06360 100644 --- a/src/utils.c +++ b/src/utils.c @@ -329,10 +329,6 @@ char *mallocstrncpy(char *dest, const char *src, size_t n) if (src == NULL) src = ""; -#ifndef NANO_TINY - if (src == dest) - fprintf(stderr, "\r*** Copying a string to itself -- please report a bug ***"); -#endif dest = charealloc(dest, n); strncpy(dest, src, n); @@ -512,12 +508,10 @@ linestruct *fsfromline(ssize_t lineno) while (f->lineno != lineno && f->next != NULL) f = f->next; - if (f->lineno != lineno) { - statusline(ALERT, "Gone undo line -- please report a bug"); + if (f->lineno == lineno) + return f; + else return NULL; - } - - return f; } #endif /* !NANO_TINY */ diff --git a/src/winio.c b/src/winio.c index ce825ad1..9a9d973b 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2793,15 +2793,6 @@ int update_line(linestruct *fileptr, size_t index) row = fileptr->lineno - openfile->edittop->lineno; - /* If the line is offscreen, don't even try to display it. */ - if (row < 0 || row >= editwinrows) { -#ifndef NANO_TINY - statusline(ALERT, "Badness: tried to display a line on row %i" - " -- please report a bug", row); -#endif - return 0; - } - /* First, blank out the row. */ blank_row(edit, row, 0, COLS); @@ -3017,20 +3008,13 @@ void edit_scroll(bool direction) { linestruct *line; size_t leftedge; - int remainder = 0, nrows = 1; + int nrows = 1; /* Move the top line of the edit window one row up or down. */ if (direction == BACKWARD) - remainder = go_back_chunks(1, &openfile->edittop, &openfile->firstcolumn); + go_back_chunks(1, &openfile->edittop, &openfile->firstcolumn); else - remainder = go_forward_chunks(1, &openfile->edittop, &openfile->firstcolumn); - - if (remainder > 0) { -#ifndef NANO_TINY - statusline(ALERT, "Could not scroll -- please report a bug"); -#endif - return; - } + go_forward_chunks(1, &openfile->edittop, &openfile->firstcolumn); /* Actually scroll the text of the edit window one row up or down. */ scrollok(edit, TRUE);