Simplelist remove simplelist_set_line_count(n)

replace with simplelist_reset_lines(void)
there was one user saving one short string
remove the feature to simplify list code

fix scrolling in dircache debug item

Change-Id: I71f933f224c2de5f7a68feab904a2fe0b81e1362
This commit is contained in:
William Wilgus 2024-11-21 12:08:53 -05:00
parent d6e3514c0d
commit 00906647b4
4 changed files with 28 additions and 57 deletions

View file

@ -804,37 +804,12 @@ static int simplelist_line_pos;
/* buffer shared with bitmap/list code */
char simplelist_buffer[SIMPLELIST_MAX_LINES * SIMPLELIST_MAX_LINELENGTH];
static const char *simplelist_text[SIMPLELIST_MAX_LINES];
/* set the amount of lines shown in the list */
void simplelist_set_line_count(int lines)
/* reset the amount of lines shown in the list to 0 */
void simplelist_reset_lines(void)
{
if (lines <= 0) {
simplelist_line_pos = 0;
simplelist_line_remaining = sizeof(simplelist_buffer);
simplelist_line_count = 0;
}
else if (lines < simplelist_line_count) {
const char *end = simplelist_buffer;
int last_line = 0;
const char * const bufend = simplelist_buffer + sizeof(simplelist_buffer);
/* find the last item in the buffer we are still showing */
for (int line = 0; line <= lines; line++)
{
const char *first = simplelist_text[line];
if (first >= simplelist_buffer && first < bufend)
{
last_line = line;
end = first;
}
line++;
}
if (last_line < lines)
end += strlen(end) + 1; /* prior to the current line, save contents */
simplelist_line_pos = end - simplelist_buffer;
simplelist_line_remaining = sizeof(simplelist_buffer) - simplelist_line_pos;
simplelist_line_count = lines;
}
simplelist_line_pos = 0;
simplelist_line_remaining = sizeof(simplelist_buffer);
simplelist_line_count = 0;
}
/* get the current amount of lines shown */
int simplelist_get_line_count(void)