|
C-Menu 0.2.9
A User Interface Toolkit
|
File mapping, user input, command processing, and display logic. More...
Macros | |
| #define | get_next_char() |
| read the next characater from the virtual file | |
| #define | get_prev_char() |
| read the previous characater from the virtual fileThere is no need to track line numbers when moving backwards as they are stored in the line table and accessed as needed. When reading in reverse, the Beginning of Data (BOD) flag is set when the file position is zero, and cleared when the position or reading direction changes. Carriage-returns are ignored as they should be. | |
Functions | |
| void | build_prompt (View *view) |
| Build Prompt String. | |
| void | cat_file (View *view) |
| Concatenate File to Standard Output. | |
| bool | enter_file_spec (Init *init, char *file_spec) |
| use form to enter a file specification | |
| int | get_cmd_arg (View *view, char *prompt) |
| Get Command Argument from User Input. | |
| int | get_cmd_char (View *view, off_t *n) |
| Get Command Character from User Input. | |
| void | lp (View *view, char *PrintFile) |
| Send File to Print Queue. | |
| int | view_cmd_processor (Init *init) |
| Main Command Processing Loop for View. | |
| int | view_file (Init *init) |
| Start view. | |
| int | write_view_buffer (Init *init, bool f_strip_ansi) |
| Write buffer contents to files. | |
File mapping, user input, command processing, and display logic.
| #define get_next_char | ( | ) |
read the next characater from the virtual file
Line numbers are tracked when reading forward and stored in a line table for quick access when moving backwards. When reading forward, the End of Data (EOD) flag is set when the position is equal to the file size, and cleared when the position or reading direction changes.
Definition at line 53 of file view_engine.c.
| #define get_prev_char | ( | ) |
read the previous characater from the virtual fileThere is no need to track line numbers when moving backwards as they are stored in the line table and accessed as needed. When reading in reverse, the Beginning of Data (BOD) flag is set when the file position is zero, and cleared when the position or reading direction changes. Carriage-returns are ignored as they should be.
Definition at line 76 of file view_engine.c.
| void build_prompt | ( | View * | view | ) |
Build Prompt String.
| view | Pointer to the View structure containing the state and parameters of the view application. This structure is used to access and modify the state of the application as needed. |
This function constructs a prompt string that provides information about the current state of the view application. The prompt includes details such as the file name, current column, file number, file position, and whether the end of the document has been reached. The constructed prompt string is stored in the view->prompt_str buffer for display to the user.
Definition at line 907 of file view_engine.c.
References View::argc, View::argv, base_name(), View::cols, View::curr_argc, View::f_eod, View::f_is_pipe, View::file_name, View::file_size, View::ln_tbl, View::maxcol, View::page_bot_ln_no, View::page_bot_pos, View::page_top_ln_no, View::page_top_pos, View::pmincol, View::prompt_str, strnz__cat(), and strnz__cpy().
Referenced by get_cmd_char(), new_view_file(), and view_cmd_processor().
| void cat_file | ( | View * | view | ) |
Concatenate File to Standard Output.
Definition at line 1026 of file view_engine.c.
References View::f_eod.
| bool enter_file_spec | ( | Init * | init, |
| char * | file_spec ) |
use form to enter a file specification
| init | data structure |
| file_spec | - pointer to file specification the file_spec |
the user must provide a character array large enough to hold file_spec without overflowing
call form to get file_name write the name to a temporary file
Definition at line 2614 of file view_engine.c.
References View::begy, destroy_argv(), display_error(), em0, em1, em2, expand_tilde(), FA_CANCEL, View::in_fd, View::lines, Init::mapp_home, mk_dir(), popup_form(), ssnprintf(), str_to_args(), strnz(), strnz__cat(), strnz__cpy(), ui_restore_wins(), verify_spec_arg(), and Init::view.
Referenced by view_cmd_processor().
| int get_cmd_arg | ( | View * | view, |
| char * | prompt ) |
Get Command Argument from User Input.
| view | Pointer to the View structure containing the state and parameters of the view application. This structure is used to access and modify the state of the application as needed. |
| prompt | A string containing the prompt to be displayed to the user when requesting input for the command argument. This prompt is shown on the command line to guide the user in providing the necessary input for the command being executed. |
Definition at line 864 of file view_engine.c.
References cell_nt, cell_nt_rev, cell_ran, cf_accept(), View::cmd_arg, View::cmd_line, CMDLN, View::cols, View::curx, pad_refresh(), View::sfc, strnz__cpy(), ui_bkgdset(), ui_curs_set(), ui_cursor_move(), ui_mvwadd_wchnstr(), ui_render(), ui_waddstr(), and ui_wclrtoeol().
Referenced by view_cmd_processor().
| int get_cmd_char | ( | View * | view, |
| off_t * | n ) |
Get Command Character from User Input.
| view | Pointer to the View structure containing the state and parameters of the view application. This structure is used to access and modify the state of the application as needed. |
| n | Pointer to an off_t variable where the numeric argument entered by the user will be stored. If the user enters a numeric argument, it will be converted to an off_t value and stored in this variable for use by the calling function. |
Definition at line 732 of file view_engine.c.
References build_prompt(), cell_ran, cell_sp, View::cmd_arg, View::cmd_line, CMDLN, View::cols, View::curx, View::cury, display_prompt(), pad_refresh(), View::prompt_str, View::sfc, ui_cursor_enable_yx(), ui_cursor_move(), ui_get_event_no_mouse(), ui_getyx(), ui_mvwadd_wch(), ui_mvwadd_wchnstr(), ui_mvwaddch(), ui_render(), ui_wclrtoeol(), UiEvent::x, and UiEvent::y.
Referenced by view_cmd_processor().
| void lp | ( | View * | view, |
| char * | PrintFile ) |
Send File to Print Queue.
| view | Pointer to the View structure containing the state and |
| PrintFile | - file to print |
Definition at line 1039 of file view_engine.c.
References display_prompt(), shell(), and ssnprintf().
Referenced by view_cmd_processor().
| int view_cmd_processor | ( | Init * | init | ) |
Main Command Processing Loop for View.
| init | Pointer to the Init structure containing initialization parameters and state for the view application. This structure is used to pass necessary information and maintain state across different functions within the view application. |
'd' Breakpoint for Debugging
< Ctrl('L') or KEY_RESIZE - Handle terminal resize
< KEY_ALTHOME - horizontal scroll to the first column
< KEY_ALTEND horizontal scroll to the last column
< 'h', Ctrl('H'), KEY_LEFT, KEY_BACKSPACE - Horizontal scroll left by two thirds of the page width
< 'l', KEY_RIGHT - Horizontal scroll right by two thirds of the page width
'k', KEY_UP - Scroll up one line
'j', KEY_DOWN, KEY_ENTER - scroll down one line
Ctrl('B'), KEY_PPAGE - Previous Page
Ctrl('F'), KEY_NPAGE Next Page
'!', Execute Shell Command from within C-Menu View
'+', Set Startup Command
'-', Change View Settings
-i ignore_case in search
-n line numbers
-s squeeze multiple blank lines
-t n set tab stop columns
-w wrap long lines
-h display help
-n line numbers
-s Squeeze Multiple Blank Lines
-t n Set Tab Stop Columns
-h Display Help
'n' - Repeat Previous Search
'/' or '?' - Search Forward fromk top of page
'?' - Search Backward
'o' - Open a File
'G' - Go to the Beginning of the Document or line
'H' or KEY_F01 - Display Help Information
'm' - Set a Mark at the Current Position
'M' - Go to a Mark
'N' - Close Current File and Open Next File
'p' or '' - Go to a Percent of the File
Ctrl('Z') - Send File to Print Queue with Notation
'P' Print Current File
'P' or KEY_F09 or ESC - Close Current File and Open Next
'q' or 'Q' or KEY_F09 or ESC - Quit the Application
'v' - Open Current File in Editor
'w' - Write the current buffer to file
'V' - Display Version Information
Definition at line 214 of file view_engine.c.
References View::argc, View::argv, build_prompt(), cell_sp, View::cmd, View::cmd_arg, View::cmd_line, CMDLN, View::cols, CT_VIEW, View::cur_file_str, View::curr_argc, View::curx, View::cury, display_error(), display_prompt(), Init::editor, em0, em1, em2, enter_file_spec(), View::f_displaying_help, View::f_first_iter, View::f_full_screen, View::f_ignore_case, View::f_is_pipe, View::f_ln, View::f_redisplay_page, View::f_search_complete, View::f_squeeze, View::f_strip_ansi, View::file_pos, View::file_spec_ptr, full_screen_shell(), get_cmd_arg(), get_cmd_char(), go_to_eof(), go_to_line(), go_to_mark(), go_to_percent(), View::h_shift, View::in_spec, View::lines, View::ln_no, lp(), View::mark_tbl, View::maxcol, View::next_cmd_char, View::next_file_spec_ptr, next_page(), View::out_spec, View::page_bot_pos, View::page_top_pos, Perror(), View::pmincol, View::prev_file_pos, prev_page(), prev_regex_pattern, View::prompt_str, scroll_down(), View::scroll_lines, scroll_up(), search(), View::sfc, shell(), View::srch_beg_pos, View::srch_curr_pos, ssnprintf(), str_subc(), strnz__cat(), strnz__cpy(), View::tab_stop, View::tmp_file_name_ptr, ui_get_screen_size(), ui_mvwadd_wchnstr(), ui_restore_wins(), Init::view, view_boxwin_resize(), view_display_help(), view_display_page(), view_full_screen_resize(), View::wrap, and write_view_buffer().
Referenced by picker(), and view_file().
| int view_file | ( | Init * | init | ) |
Start view.
| init | Pointer to the Init structure containing initialization parameters and state for the view application. This structure is used to pass necessary information and maintain state across different functions within the view application. |
Definition at line 161 of file view_engine.c.
References View::argc, View::argv, border_title(), View::buf, View::cur_file_str, View::curr_argc, destroy_line_table(), View::f_bod, View::f_eod, View::f_full_screen, View::file_pos, View::file_size, View::file_spec_ptr, initialize_line_table(), View::ln_max_pos, View::maxcol, View::next_file_spec_ptr, next_page(), View::page_bot_ln_no, View::page_bot_pos, View::page_top_ln_no, View::page_top_pos, View::sfc, strnz__cpy(), View::title, ui_surface_destroy(), Init::view, view_cmd_processor(), and view_init_input().
Referenced by main(), and popup_view().
| int write_view_buffer | ( | Init * | init, |
| bool | f_strip_ansi ) |
Write buffer contents to files.
| init | data structure |
| f_strip_ansi | strip ANSI escape sequences |
write the buffer
Definition at line 978 of file view_engine.c.
References answer_yn(), display_error(), em0, em1, em2, View::f_eod, get_line(), View::in_spec, View::line_in_s, View::ln_tbl_size, View::out_fd, View::out_spec, ssnprintf(), strip_ansi(), strnlf(), strnz__cat(), strnz__cpy(), ui_restore_wins(), and Init::view.
Referenced by view_cmd_processor().