diff --git a/src/help.c b/src/help.c index 0cc4cdb..f443486 100644 --- a/src/help.c +++ b/src/help.c @@ -49,7 +49,7 @@ char *tempfilename = NULL; /* Writes the hard wrapped help text in the temp file and displays it. */ void display_the_help_text(bool redisplaying) { - int line_size, sum = 0; + int line_size, sum; const char *ptr = start_of_text; FILE *fp = fopen(tempfilename, "w+b"); @@ -87,12 +87,9 @@ void display_the_help_text(bool redisplaying) display_buffer(); /* Move to the position in the file where we were before. */ - while (TRUE) { - sum += strlen(openfile->current->data); - if (sum > location) - break; + for (sum = strlen(openfile->current->data); sum <= location; + sum += strlen(openfile->current->data)) openfile->current = openfile->current->next; - } openfile->edittop = openfile->current; }