diff options
author | Joursoir <chat@joursoir.net> | 2021-11-29 01:14:12 +0300 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2021-11-29 01:14:12 +0300 |
commit | 539b874b7617f0b5acc0eea5399609dabba15e2b (patch) | |
tree | 1cdc12f297a41d82fd0010d2f89393c18b4d28ed /Library | |
parent | 52c12bddc0143e13ebba055e1d0b398b318e648f (diff) | |
download | ufm-539b874b7617f0b5acc0eea5399609dabba15e2b.tar.gz ufm-539b874b7617f0b5acc0eea5399609dabba15e2b.tar.bz2 ufm-539b874b7617f0b5acc0eea5399609dabba15e2b.zip |
panel: add support for highlighting
Diffstat (limited to 'Library')
-rw-r--r-- | Library/UefiShellUfmCommandLib/panel.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Library/UefiShellUfmCommandLib/panel.c b/Library/UefiShellUfmCommandLib/panel.c index 39439fc..d242df6 100644 --- a/Library/UefiShellUfmCommandLib/panel.c +++ b/Library/UefiShellUfmCommandLib/panel.c @@ -14,6 +14,28 @@ #define SIZE_COLS 7 #define MODIFYTIME_COLS 12 +STATIC VOID highlight_line(struct panel_ctx *p, UINTN line, INT32 fg, INT32 bg) +{ + CHAR16 *str; + INT32 attr; + UINTN ui_line; + + ui_line = (line-1) % p->list_lines; + attr = p->wlist->attr[ui_line][0]; + if(fg < 0x0) + fg = attr & 0x0F; + if(bg < 0x0) + bg = ((attr & 0xF0) >> 4); + attr = EFI_TEXT_ATTR(fg, bg); + + wattrset(p->wlist, attr); + str = p->wlist->text[ui_line]; + mvwprintf(p->wlist, 0, ui_line, str); + wattroff(p->wlist); + + wrefresh(p->wlist); +} + STATIC VOID set_cwd(struct panel_ctx *p, CONST CHAR16 *path) { if(p->cwd) { |