Files | |
| file | edit.c |
| file | sheet.c |
| Prototype implementation of Sheet data structure. | |
| file | sheet.h |
Data Structures | |
| struct | coord_t |
| Character cell coordinates. More... | |
| struct | doc_t |
| Document. More... | |
| struct | pane_t |
| Pane. More... | |
| struct | sheet_t |
| Sheet. More... | |
| struct | spt_t |
| S-point. More... | |
| struct | tag_t |
| Tag. More... | |
Defines | |
| #define | BUF_SIZE 64 |
| #define | ED_INFTY 65536 |
| #define | INFNAME_MAX_LEN 128 |
| Maximum filename length that can be entered. | |
| #define | ROW_BUF_SIZE 4096 |
| #define | TAB_WIDTH 8 |
Enumerations | |
| enum | { , INITIAL_SIZE = 32 } |
| enum | dir_spec { dir_before, dir_after } |
| Direction (in linear space). More... | |
| enum | redraw_flags |
Functions | |
| static void | caret_move (int drow, int dcolumn, enum dir_spec align_dir) |
| Change the caret position. | |
| static void | caret_update (void) |
| Scroll pane after caret has moved. | |
| static int | coord_cmp (coord_t const *a, coord_t const *b) |
| Compare coordinats. | |
| static void | cursor_hide (void) |
| static void | cursor_setvis (bool visible) |
| static void | cursor_show (void) |
| static void | delete_char_after (void) |
| Delete the character after the caret. | |
| static void | delete_char_before (void) |
| Delete the character before the caret. | |
| static int | file_insert (char *fname) |
| Insert file at caret position. | |
| static int | file_save (char const *fname) |
| Save the document. | |
| static void | file_save_as (void) |
| Change document name and save. | |
| static int | file_save_range (char const *fname, spt_t const *spos, spt_t const *epos) |
| Save a range of text into a file. | |
| static char * | filename_prompt (char const *prompt, char const *init_value) |
| Ask for a file name. | |
| static void | insert_char (wchar_t c) |
| Insert a character at caret position. | |
| static void | insert_clipboard_data (void) |
| static void | key_handle_ctrl (console_event_t const *ev) |
| Handle Ctrl-key combination. | |
| static void | key_handle_movement (unsigned int key, bool shift) |
| static void | key_handle_shift (console_event_t const *ev) |
| Handle Shift-key combination. | |
| static void | key_handle_unmod (console_event_t const *ev) |
| Handle key without modifier. | |
| int | main (int argc, char *argv[]) |
| static void | pane_caret_display (void) |
| Set cursor to reflect position of the caret. | |
| static void | pane_row_display (void) |
| Display just the row where the caret is. | |
| static void | pane_row_range_display (int r0, int r1) |
| static void | pane_status_display (void) |
| Display pane status in the status line. | |
| static void | pane_text_display (void) |
| static void | pt_get_eof (spt_t *pt) |
| Get end-of-file s-point. | |
| static void | pt_get_sof (spt_t *pt) |
| Get start-of-file s-point. | |
| static char * | range_get_str (spt_t const *spos, spt_t const *epos) |
| Return contents of range as a new string. | |
| static bool | selection_active (void) |
| Check for non-empty selection. | |
| static void | selection_copy (void) |
| static void | selection_delete (void) |
| Delete selected text. | |
| static void | selection_get_points (spt_t *pa, spt_t *pb) |
| static void | selection_sel_all (void) |
| void | sheet_copy_out (sheet_t *sh, spt_t const *spos, spt_t const *epos, char *buf, size_t bufsize, spt_t *fpos) |
| Read text from sheet. | |
| int | sheet_delete (sheet_t *sh, spt_t *spos, spt_t *epos) |
| Delete text from sheet. | |
| void | sheet_get_cell_pt (sheet_t *sh, coord_t const *coord, enum dir_spec dir, spt_t *pt) |
| Get point preceding or following character cell. | |
| void | sheet_get_num_rows (sheet_t *sh, int *rows) |
| Get the number of rows in a sheet. | |
| void | sheet_get_row_width (sheet_t *sh, int row, int *length) |
| Get the number of character cells a row occupies. | |
| int | sheet_init (sheet_t *sh) |
| Initialize an empty sheet. | |
| int | sheet_insert (sheet_t *sh, spt_t *pos, enum dir_spec dir, char *str) |
| Insert text into sheet. | |
| void | sheet_place_tag (sheet_t *sh, spt_t const *pt, tag_t *tag) |
| Place a tag on the specified s-point. | |
| void | sheet_remove_tag (sheet_t *sh, tag_t *tag) |
| Remove a tag from the sheet. | |
| static int | spt_cmp (spt_t const *a, spt_t const *b) |
| Compare s-points. | |
| bool | spt_equal (spt_t const *a, spt_t const *b) |
| Test if two s-points are equal. | |
| void | spt_get_coord (spt_t const *pos, coord_t *coord) |
| Get the coordinates of an s-point. | |
| static void | status_display (char const *str) |
| Display text in the status line. | |
| static int | tag_cmp (tag_t const *a, tag_t const *b) |
| Compare tags. | |
| void | tag_get_pt (tag_t const *tag, spt_t *pt) |
| Get s-point on which the tag is located right now. | |
Variables | |
| static int | con |
| static bool | cursor_visible |
| static doc_t | doc |
| static bool | done |
| static pane_t | pane |
| static sysarg_t | scr_columns |
| static sysarg_t | scr_rows |
| anonymous enum |
| enum dir_spec |
| static void caret_move | ( | int | drow, | |
| int | dcolumn, | |||
| enum dir_spec | align_dir | |||
| ) | [static] |
Change the caret position.
Moves caret relatively to the current position. Looking at the first character cell after the caret and moving by drow and dcolumn, we get to a new character cell, and thus a new character. Then we either go to the point before the the character or after it, depending on align_dir.
| static void caret_update | ( | void | ) | [static] |
| static int file_insert | ( | char * | fname | ) | [static] |
Insert text into sheet.
| sh | Sheet to insert to. | |
| pos | Point where to insert. | |
| dir | Whether to insert before or after the point (affects tags). | |
| str | The text to insert (printable characters, tabs, newlines). |
dir_before, the tags will move forward and vice versa.
1.4.7