From 727390c04c56c60fbe4369d76565f5607d468e11 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Tue, 30 Nov 2021 17:45:29 +0300 Subject: panel: make panel_move_cursor() --- Library/UefiShellUfmCommandLib/panel.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'Library/UefiShellUfmCommandLib/panel.c') diff --git a/Library/UefiShellUfmCommandLib/panel.c b/Library/UefiShellUfmCommandLib/panel.c index cc33aee..c8d3565 100644 --- a/Library/UefiShellUfmCommandLib/panel.c +++ b/Library/UefiShellUfmCommandLib/panel.c @@ -278,3 +278,30 @@ VOID panel_release(struct panel_ctx *p) FreePool(p); } +BOOLEAN panel_move_cursor(struct panel_ctx *p, UINTN line) +{ + UINTN oldline = p->curline; + UINTN maxlen = (p->cwd) ? p->dirs->len : p->fsa->len; + + if(line < 1 || line > maxlen) + return FALSE; + + if(line < p->start_entry || line >= (p->start_entry + p->list_lines) || + p->start_entry == 0) + { + p->start_entry = line - ((line-1) % p->list_lines); + + if(!p->cwd) + display_fs(p, p->start_entry); + else + display_files(p, p->start_entry); + } + else + UNHIGHLIGHT_LINE_AS_CURRENT(p, oldline); + + p->curline = line; + update_file_info(p); + HIGHLIGHT_LINE_AS_CURRENT(p, p->curline); + return TRUE; +} + -- cgit v1.2.3-18-g5258