|
C-Menu 0.2.9
A User Interface Toolkit
|
Navigation functions for the view application. More...
Functions | |
| off_t | get_next_line (View *view, off_t pos) |
| Get Next Line from View->buf. | |
| off_t | get_pos_next_line (View *view, off_t pos) |
| Get Position of Next Line. | |
| off_t | get_pos_prev_line (View *view, off_t pos) |
| Get Position of Previous Line. | |
| off_t | get_prev_line (View *view, off_t pos) |
| Get Previous Line from View->buf. | |
| void | go_to_eof (View *view) |
| Go to End of File. | |
| int | go_to_line (View *view, off_t line_idx) |
| Go to Specific Line. | |
| void | go_to_mark (View *view, int c) |
| Go to Mark. | |
| void | go_to_percent (View *view, int percent) |
| Go to Percent of File. | |
| void | go_to_position (View *view, off_t go_to_pos) |
| Go to Specific File Position. | |
| void | increment_ln (View *view) |
| Increment Line Index and Update Line Table. | |
| void | initialize_line_table (View *view) |
| Initialize Line Table. | |
| void | next_page (View *view) |
| Advance to Next Page. | |
| void | prev_page (View *view) |
| display previous page | |
| void | scroll_down_n_lines (View *view, int n) |
| Scroll N Lines. | |
| void | scroll_up_n_lines (View *view, int n) |
| Scroll Up N Lines. | |
| bool | search (View *view, int search_cmd, char *regex_pattern) |
| Search for Regular Expression Pattern. | |
| void | sync_ln (View *view) |
| Synchronize Line Table with Current File Position. | |
Navigation functions for the view application.
| off_t get_next_line | ( | View * | view, |
| off_t | pos ) |
Get Next Line from View->buf.
| view | struct |
| pos | buffer offset |
gets view->line_in_s
Definition at line 1460 of file view_engine.c.
References View::f_eod, View::f_squeeze, View::file_pos, View::line_in_beg_p, View::line_in_end_p, and View::line_in_s.
Referenced by get_prev_line(), scroll_down_n_lines(), scroll_up_n_lines(), search(), view_display_page(), and write_view_buffer().
| off_t get_pos_next_line | ( | View * | view, |
| off_t | pos ) |
Get Position of Next Line.
| view | data structure |
| pos | buffer offset |
Definition at line 1515 of file view_engine.c.
References View::f_eod, View::f_squeeze, View::file_pos, and View::file_size.
| off_t get_pos_prev_line | ( | View * | view, |
| off_t | pos ) |
Get Position of Previous Line.
| view | data structure |
| pos | buffer offset |
Definition at line 1550 of file view_engine.c.
References View::f_bod, View::file_pos, View::ln, and View::ln_tbl.
Referenced by get_prev_line().
| off_t get_prev_line | ( | View * | view, |
| off_t | pos ) |
Get Previous Line from View->buf.
| view | data structure |
| pos | buffer offset |
Definition at line 1503 of file view_engine.c.
References View::file_pos, get_next_line(), and get_pos_prev_line().
Referenced by search().
| void go_to_eof | ( | View * | view | ) |
Go to End of File.
| view | data structure |
Definition at line 1580 of file view_engine.c.
References View::cury, View::file_pos, View::file_size, View::ln, View::ln_tbl, next_page(), View::page_bot_pos, View::page_top_ln, View::page_top_pos, View::scroll_lines, and sync_ln().
Referenced by view_cmd_processor().
| int go_to_line | ( | View * | view, |
| off_t | line_idx ) |
Go to Specific Line.
| view | data structure |
| line_idx | line number to go to (1-based index) |
Definition at line 1622 of file view_engine.c.
References View::file_pos, go_to_position(), next_page(), View::page_bot_pos, View::page_top_pos, and sync_ln().
Referenced by view_cmd_processor().
| void go_to_mark | ( | View * | view, |
| int | c ) |
Go to Mark.
| 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. |
| c | The character representing the mark to go to. This character is typically a lowercase letter (a-z) corresponding to a mark that has been set previously in the view application. The function will attempt to navigate to the position associated with this mark, allowing the user to quickly jump to specific locations in the file based on the marks they have set. If the mark is not set, an error message will be displayed to the user. |
Definition at line 1072 of file view_engine.c.
References View::file_pos, go_to_position(), View::mark_tbl, and Perror().
Referenced by view_cmd_processor().
| void go_to_percent | ( | View * | view, |
| int | percent ) |
Go to Percent of File.
| view | data structure |
| percent | of file |
Definition at line 1599 of file view_engine.c.
References View::file_pos, View::file_size, View::ln, View::ln_tbl, next_page(), View::page_bot_pos, View::page_top_ln, View::page_top_pos, Perror(), View::scroll_lines, and sync_ln().
Referenced by view_cmd_processor().
| void go_to_position | ( | View * | view, |
| off_t | go_to_pos ) |
Go to Specific File Position.
| view | data Structure |
| go_to_pos |
Definition at line 1569 of file view_engine.c.
References View::file_pos, next_page(), View::page_bot_pos, View::page_top_pos, and sync_ln().
| void increment_ln | ( | View * | view | ) |
Increment Line Index and Update Line Table.
| view | data structure |
This function is called when a line feed character is encountered while reading the file. It increments the line index (view->ln) and checks if the current file position exceeds the maximum position recorded in the line table. If it does, it updates the line table with the new file position. If the line index exceeds the current size of the line table, the table is resized by allocating more memory.
Definition at line 1672 of file view_engine.c.
References View::file_pos, View::ln, View::ln_max_pos, View::ln_tbl, View::ln_tbl_cnt, View::ln_tbl_size, and Perror().
| void initialize_line_table | ( | View * | view | ) |
Initialize Line Table.
| view | data structure |
The line table is initialized with a specified increment size (LINE_TBL_INCR). Memory is allocated for the line table, and the first entry is set to 0, indicating the file position of the first line. The line index (view->ln) is initialized to 0.
Definition at line 1642 of file view_engine.c.
References View::ln, View::ln_max_pos, View::ln_tbl, View::ln_tbl_size, and Perror().
Referenced by new_view_file(), and view_file().
| void next_page | ( | View * | view | ) |
Advance to Next Page.
| view | data structure |
Advances from view->page_bot_pos to view the next page of content. view->page_bot_pos must be set properly when calling this function. If the current bottom position of the page is at the end of the file, the function returns without making any changes. Otherwise, it resets the maximum column and current line position to the top of the page, updates the file position to the current bottom position of the page, and sets the top position and line number of the page accordingly. Finally, it calls the function to display the new page content.
Definition at line 1331 of file view_engine.c.
References View::cury, View::file_pos, View::file_size, View::ln, View::ln_tbl, View::maxcol, View::page_top_ln, and view_display_page().
Referenced by go_to_eof(), go_to_line(), go_to_percent(), go_to_position(), new_view_file(), prev_page(), view_cmd_processor(), and view_file().
| void prev_page | ( | View * | view | ) |
display previous page
| view | data structure |
Displays the previous page starting at (view->page_top_ln - view->scroll_lines).
Definition at line 1308 of file view_engine.c.
References View::cury, View::ln, next_page(), View::page_top_ln, View::page_top_pos, and View::scroll_lines.
Referenced by view_cmd_processor().
| void scroll_down_n_lines | ( | View * | view, |
| int | n ) |
Scroll N Lines.
| view | data Structure |
| n | number of lines to scroll |
Locate New Top of Page
Scroll
Fill in Page Bottom
Definition at line 1375 of file view_engine.c.
References View::cury, display_line(), View::f_bod, View::f_eod, View::f_ln, View::file_size, fmt_line(), get_next_line(), View::ln, View::ln_tbl, View::lnno_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 view_cmd_processor().
| void scroll_up_n_lines | ( | View * | view, |
| int | n ) |
Scroll Up N Lines.
| view | data Structure |
| n | number of lines to scroll |
Fill in Page Top
Definition at line 1418 of file view_engine.c.
References View::cury, display_line(), View::f_eod, View::f_ln, View::file_pos, fmt_line(), get_next_line(), View::ln, View::ln_tbl, View::lnno_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 view_cmd_processor().
| bool search | ( | View * | view, |
| int | search_cmd, | ||
| char * | regex_pattern ) |
Search for Regular Expression Pattern.
| view | Pointer to View Structure |
| search_cmd | Search Command Character ('/' or '?') |
| regex_pattern | Regular Expression Pattern to Search For |
The search performs extended regular expression matching, ignoring ANSI sequences and Unicode characters. Matches are highlighted on the screen, and the search continues until the page is full or the end of the file is reached. If the search wraps around the file, a message is displayed indicating that the search is complete. The search state is maintained in the view structure, allowing for repeat searches and tracking of the current search position. This function highlights all matches in the current ncurses pad, including those not displayed on the screen, and tracks the first and last match columns for prompt display. ANSI sequences and Unicode characters are stripped before matching, so matching corresponds to the visual display
initialize iteration
get line to scan
< Note placement before get_next_line
< Note placement after get_prev_line
non-matching page filler
Display matching lines
All matches on the current line are highlighted, including those not displayed on the screen. Track first and last match columns for prompt display.
Definition at line 1101 of file view_engine.c.
References View::begx, cp_nt_rev, View::curx, View::cury, display_line(), View::f_first_iter, View::f_ignore_case, View::f_search_complete, View::file_name, View::file_pos, View::file_size, View::first_match_x, fmt_line(), get_next_line(), get_prev_line(), View::last_match_x, View::line_out_p, View::ln, View::maxcol, View::pad, View::page_bot_ln, View::page_bot_pos, View::page_top_ln, View::page_top_pos, Perror(), View::pmincol, View::scroll_lines, View::smaxcol, View::srch_beg_pos, View::srch_curr_pos, ssnprintf(), View::stripped_line_out, strnz__cat(), strnz__cpy(), sync_ln(), and View::tmp_prompt_str.
Referenced by view_cmd_processor().
| void sync_ln | ( | View * | view | ) |
Synchronize Line Table with Current File Position.
| view | data Structure |
The line table (view->ln_tbl) is an array that stores the file position of each line. The index (view->ln + 1) corresponds to the current line number. (the line number table is 0-based, while line numbering starts at 1).
If the line or position requested is not in the line table, this function reads forward to sycn. If the line or positione requested is behind the current line table index, the line index will be decremented it matches the file position.
Definition at line 1702 of file view_engine.c.
References View::f_eod, View::file_pos, View::ln, View::ln_max_pos, View::ln_tbl, and View::ln_tbl_cnt.
Referenced by go_to_eof(), go_to_line(), go_to_percent(), go_to_position(), and search().