|
C-Menu 0.2.9
A User Interface Toolkit
|
Manage the View Display. More...
Functions | |
| void | resize_page (Init *init) |
| Resize Viewing Page. | |
| int | pad_refresh (View *view) |
| Refresh Pad and Line Number Window. | |
| void | view_display_page (View *view) |
| Display Current Page. | |
| void | display_line (View *view) |
| Display Line on Padparam View *view data structure. | |
| int | fmt_line (View *view) |
| Format Line for Display. | |
| void | parse_ansi_str (char *ansi_str, attr_t *attr, int *cpx) |
| Parse ANSI SGR Escape Sequence. | |
| int | display_prompt (View *view, char *s) |
| Display Command Line Prompt. | |
| void | view_display_help (Init *init) |
| Display View Help File. | |
Manage the View Display.
| void display_line | ( | View * | view | ) |
Display Line on Padparam View *view data structure.
This function displays a single line of text on the ncurses pad.
Because get_next_char calls increment_ln upon encountering a line feed and increment_ln advances view->ln after updating the line table, the line number displayed is one greater than the index to the line table. That means the line counter begins with 1, while the table origin is 0.
Definition at line 1624 of file view_engine.c.
References View::cmplx_buf, View::cury, View::f_ln, View::ln, View::ln_win, View::pad, View::scroll_lines, and ssnprintf().
Referenced by scroll_down_n_lines(), scroll_up_n_lines(), search(), and view_display_page().
| int display_prompt | ( | View * | view, |
| char * | s ) |
Display Command Line Prompt.
| view | is the current view data structure |
| s | is the prompt string |
Definition at line 1899 of file view_engine.c.
References View::cmd_line, View::curx, strnz__cpy(), and View::win.
Referenced by lp(), and view_cmd_processor().
| int fmt_line | ( | View * | view | ) |
Format Line for Display.
| view | pointer to View structure containing line input and output buffers |
This function processes the input line from view->line_in_s, handling ANSI escape sequences for text attributes and colors, as well as multi-byte characters. It converts the input line into a formatted line suitable for display in the terminal, storing the result in view->cmplx_buf and view->stripped_line_out. The function returns the length of the formatted line in characters, which may be used for tracking the maximum column width of the displayed content.
Definition at line 1655 of file view_engine.c.
References View::cmplx_buf, cp_win, View::line_in_s, View::line_out_s, View::maxcol, parse_ansi_str(), rtrim(), View::stripped_line_out, and View::tab_stop.
Referenced by scroll_down_n_lines(), scroll_up_n_lines(), search(), and view_display_page().
| int pad_refresh | ( | View * | view | ) |
Refresh Pad and Line Number Window.
| view | data structure |
Definition at line 1179 of file view_engine.c.
References View::f_ln, View::ln_win, View::pad, Perror(), View::pmincol, View::pminrow, View::smaxcol, View::smaxrow, View::smincol, View::sminrow, and View::win.
Referenced by get_cmd_char(), and view_cmd_processor().
| void parse_ansi_str | ( | char * | ansi_str, |
| attr_t * | attr, | ||
| int * | cpx ) |
Parse ANSI SGR Escape Sequence.
| ansi_str | is the ANSI escape sequence string to parse |
| attr | is a pointer to an attr_t variable where the parsed attributes will be stored |
| cpx | is a pointer to an int variable where the parsed color pair index will be stored |
This function parses an ANSI SGR (Select Graphic Rendition) escape sequence and updates the provided attr_t and color pair index based on the attributes specified in the ANSI string.
This function converts the following SGR specification types to the
appropriate curses color pair index for use in the terminal display.
RGB:
foreground \033[38;2;r;g;bm
background \033[48;2;r;g;bm
Where r, g, b are the red, green, and blue color components
(0-255)
XTERM 256-color:
foreground \033[38;5;xm
background \033[48;5;xm
Where x is the 256-color index (0-255)
uses xterm256_idx_to_rgb() to convert the 256-color index to
RGB
8-color:
foreground \033[3cm
background \033[4cm
Where c is the color code (0 for black, 1 for red, 2 for green, 3
for yellow, 4 for blue, 5 for magenta, 6 for cyan, 7 for white).
Attributes:
\033[am
Where a is the attribute code (1 for bold, 2 for dim, 3 for italic,
4 for underline, 5 for blink, 7 for reverse, 8 for invis). The function
also supports resetting attributes and colors to default using \033[0m.
@sa xterm256_idx_to_rgb(), rgb_to_curses_clr(), extended_pair_content(),
get_clr_pair()
Definition at line 1786 of file view_engine.c.
References a_toi(), RGB::b, CLR_BG, CLR_FG, clr_pair_idx, RGB::g, get_clr_pair(), RGB::r, rgb_to_curses_clr(), and xterm256_idx_to_rgb().
Referenced by fmt_line().
| void resize_page | ( | Init * | init | ) |
Resize Viewing Page.
| init | data structure |
Definition at line 1145 of file view_engine.c.
References View::begx, View::begy, View::cmd_line, View::cols, View::f_full_screen, View::f_redisplay_page, View::lines, View::pad, restore_wins(), View::scroll_lines, View::smaxcol, View::smaxrow, View::title, Init::view, view, and win_resize().
Referenced by view_cmd_processor().
| void view_display_help | ( | Init * | init | ) |
Display View Help File.
| init | is the current initialization data structure. |
Definition at line 1952 of file view_engine.c.
References Init::begx, Init::begy, Init::cols, destroy_argv(), View::f_help_spec, View::f_redisplay_page, View::help_spec, Init::lines, Init::mapp_help, popup_view(), strnz__cat(), strnz__cpy(), Init::title, Init::view, and view.
Referenced by view_cmd_processor().
| void view_display_page | ( | View * | view | ) |
Display Current Page.
| view | data structure |
Definition at line 1239 of file view_engine.c.
References View::cury, display_line(), View::f_eod, View::file_pos, fmt_line(), get_next_line(), View::ln, View::ln_tbl, View::ln_win, View::pad, View::page_bot_ln, View::page_bot_pos, View::page_top_ln, View::page_top_pos, and View::scroll_lines.
Referenced by next_page(), and view_cmd_processor().