#include "histedit.h"Include dependency graph for el_term.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Classes | |
| struct | fkey_t |
| struct | el_term_t |
Defines | |
| #define | TERM_CAN_INSERT 0x001 |
| #define | TERM_CAN_DELETE 0x002 |
| #define | TERM_CAN_CEOL 0x004 |
| #define | TERM_CAN_TAB 0x008 |
| #define | TERM_CAN_ME 0x010 |
| #define | TERM_CAN_UP 0x020 |
| #define | TERM_HAS_META 0x040 |
| #define | TERM_HAS_AUTO_MARGINS 0x080 |
| #define | TERM_HAS_MAGIC_MARGINS 0x100 |
| #define | A_K_DN 0 |
| #define | A_K_UP 1 |
| #define | A_K_LT 2 |
| #define | A_K_RT 3 |
| #define | A_K_HO 4 |
| #define | A_K_EN 5 |
| #define | A_K_NKEYS 6 |
| #define | EL_FLAGS (el)->el_term.t_flags |
| #define | EL_CAN_INSERT (EL_FLAGS & TERM_CAN_INSERT) |
| #define | EL_CAN_DELETE (EL_FLAGS & TERM_CAN_DELETE) |
| #define | EL_CAN_CEOL (EL_FLAGS & TERM_CAN_CEOL) |
| #define | EL_CAN_TAB (EL_FLAGS & TERM_CAN_TAB) |
| #define | EL_CAN_ME (EL_FLAGS & TERM_CAN_ME) |
| #define | EL_HAS_META (EL_FLAGS & TERM_HAS_META) |
| #define | EL_HAS_AUTO_MARGINS (EL_FLAGS & TERM_HAS_AUTO_MARGINS) |
| #define | EL_HAS_MAGIC_MARGINS (EL_FLAGS & TERM_HAS_MAGIC_MARGINS) |
Functions | |
| protected void | term_move_to_line (EditLine *, int) |
| protected void | term_move_to_char (EditLine *, int) |
| protected void | term_clear_EOL (EditLine *, int) |
| protected void | term_overwrite (EditLine *, const char *, int) |
| protected void | term_insertwrite (EditLine *, char *, int) |
| protected void | term_deletechars (EditLine *, int) |
| protected void | term_clear_screen (EditLine *) |
| protected void | term_beep (EditLine *) |
| protected int | term_change_size (EditLine *, int, int) |
| protected int | term_get_size (EditLine *, int *, int *) |
| protected int | term_init (EditLine *) |
| protected void | term_bind_arrow (EditLine *) |
| protected void | term_print_arrow (EditLine *, const char *) |
| protected int | term_clear_arrow (EditLine *, const char *) |
| protected int | term_set_arrow (EditLine *, const char *, key_value_t *, int) |
| protected void | term_end (EditLine *) |
| protected void | term_get (EditLine *, const char **) |
| protected int | term_set (EditLine *, const char *) |
| protected int | term_settc (EditLine *, int, const char **) |
| protected int | term_telltc (EditLine *, int, const char **) |
| protected int | term_echotc (EditLine *, int, const char **) |
| protected int | term__putc (int) |
| protected void | term__flush (void) |
| #define A_K_DN 0 |
| #define A_K_EN 5 |
| #define A_K_HO 4 |
| #define A_K_LT 2 |
| #define A_K_NKEYS 6 |
Definition at line 82 of file el_term.h.
Referenced by term_bind_arrow(), term_clear_arrow(), term_init(), term_print_arrow(), and term_set_arrow().
| #define A_K_RT 3 |
| #define A_K_UP 1 |
| #define EL_CAN_CEOL (EL_FLAGS & TERM_CAN_CEOL) |
Definition at line 124 of file el_term.h.
Referenced by re_clear_lines(), term_clear_EOL(), and term_setflags().
| #define EL_CAN_DELETE (EL_FLAGS & TERM_CAN_DELETE) |
Definition at line 123 of file el_term.h.
Referenced by re_update_line(), term_deletechars(), and term_setflags().
| #define EL_CAN_INSERT (EL_FLAGS & TERM_CAN_INSERT) |
Definition at line 122 of file el_term.h.
Referenced by re_update_line(), term_insertwrite(), and term_setflags().
| #define EL_CAN_TAB (EL_FLAGS & TERM_CAN_TAB) |
Definition at line 125 of file el_term.h.
Referenced by term_echotc(), term_move_to_char(), term_telltc(), and tty_rawmode().
| #define EL_FLAGS (el)->el_term.t_flags |
| #define EL_HAS_AUTO_MARGINS (EL_FLAGS & TERM_HAS_AUTO_MARGINS) |
Definition at line 128 of file el_term.h.
Referenced by re_fastputc(), term_echotc(), term_move_to_line(), term_overwrite(), and term_telltc().
| #define EL_HAS_MAGIC_MARGINS (EL_FLAGS & TERM_HAS_MAGIC_MARGINS) |
Definition at line 129 of file el_term.h.
Referenced by re_fastputc(), term_echotc(), term_overwrite(), and term_telltc().
| #define EL_HAS_META (EL_FLAGS & TERM_HAS_META) |
| #define TERM_CAN_CEOL 0x004 |
| #define TERM_CAN_DELETE 0x002 |
| #define TERM_CAN_INSERT 0x001 |
| #define TERM_CAN_ME 0x010 |
| #define TERM_CAN_TAB 0x008 |
| #define TERM_CAN_UP 0x020 |
| #define TERM_HAS_AUTO_MARGINS 0x080 |
| #define TERM_HAS_MAGIC_MARGINS 0x100 |
| #define TERM_HAS_META 0x040 |
| protected void term__flush | ( | void | ) |
Definition at line 1239 of file term.c.
Referenced by ed_delete_next_char(), el_getc(), el_gets(), el_push(), em_delete_or_list(), re_fastaddc(), re_goto_bottom(), re_refresh_cursor(), read_prepare(), sig_handler(), and vi_list_or_eof().
01240 { 01241 01242 (void) fflush(term_outfile); 01243 }
Here is the caller graph for this function:

| protected int term__putc | ( | int | ) |
Definition at line 1228 of file term.c.
Referenced by ed_command(), re_clear_lines(), re_fastputc(), re_goto_bottom(), term_beep(), term_clear_EOL(), term_clear_screen(), term_deletechars(), term_insertwrite(), term_move_to_char(), term_move_to_line(), and term_overwrite().
01229 { 01230 01231 return (fputc(c, term_outfile)); 01232 }
Here is the caller graph for this function:

| protected void term_beep | ( | EditLine * | ) |
Definition at line 847 of file term.c.
Referenced by c_gets(), ce_inc_search(), ed_command(), el_beep(), el_push(), em_delete_or_list(), and vi_list_or_eof().
00848 { 00849 if (GoodStr(T_bl)) 00850 /* what termcap says we should use */ 00851 (void) tputs(Str(T_bl), 1, term__putc); 00852 else 00853 term__putc('\007'); /* an ASCII bell; ^G */ 00854 }
Here is the caller graph for this function:

| protected void term_bind_arrow | ( | EditLine * | ) |
Definition at line 1171 of file term.c.
Referenced by map_init_emacs(), map_init_vi(), and term_set().
01172 { 01173 el_action_t *map; 01174 const el_action_t *dmap; 01175 int i, j; 01176 char *p; 01177 fkey_t *arrow = el->el_term.t_fkey; 01178 01179 /* Check if the components needed are initialized */ 01180 if (el->el_term.t_buf == NULL || el->el_map.key == NULL) 01181 return; 01182 01183 map = el->el_map.type == MAP_VI ? el->el_map.alt : el->el_map.key; 01184 dmap = el->el_map.type == MAP_VI ? el->el_map.vic : el->el_map.emacs; 01185 01186 term_reset_arrow(el); 01187 01188 for (i = 0; i < A_K_NKEYS; i++) { 01189 p = el->el_term.t_str[arrow[i].key]; 01190 if (p && *p) { 01191 j = (unsigned char) *p; 01192 /* 01193 * Assign the arrow keys only if: 01194 * 01195 * 1. They are multi-character arrow keys and the user 01196 * has not re-assigned the leading character, or 01197 * has re-assigned the leading character to be 01198 * ED_SEQUENCE_LEAD_IN 01199 * 2. They are single arrow keys pointing to an 01200 * unassigned key. 01201 */ 01202 if (arrow[i].type == XK_NOD) 01203 key_clear(el, map, p); 01204 else { 01205 if (p[1] && (dmap[j] == map[j] || 01206 map[j] == ED_SEQUENCE_LEAD_IN)) { 01207 key_add(el, p, &arrow[i].fun, 01208 arrow[i].type); 01209 map[j] = ED_SEQUENCE_LEAD_IN; 01210 } else if (map[j] == ED_UNASSIGNED) { 01211 key_clear(el, map, p); 01212 if (arrow[i].type == XK_CMD) 01213 map[j] = arrow[i].fun.cmd; 01214 else 01215 key_add(el, p, &arrow[i].fun, 01216 arrow[i].type); 01217 } 01218 } 01219 } 01220 } 01221 }
Here is the caller graph for this function:

| protected int term_change_size | ( | EditLine * | , | |
| int | , | |||
| int | ||||
| ) |
Definition at line 1007 of file term.c.
Referenced by el_resize(), and term_set().
01008 { 01009 /* 01010 * Just in case 01011 */ 01012 Val(T_co) = (cols < 2) ? 80 : cols; 01013 Val(T_li) = (lins < 1) ? 24 : lins; 01014 01015 /* re-make display buffers */ 01016 if (term_rebuffer_display(el) == -1) 01017 return (-1); 01018 re_clear_display(el); 01019 return (0); 01020 }
Here is the caller graph for this function:

| protected int term_clear_arrow | ( | EditLine * | , | |
| const char * | ||||
| ) |
Definition at line 1136 of file term.c.
Referenced by map_bind().
01137 { 01138 fkey_t *arrow = el->el_term.t_fkey; 01139 int i; 01140 01141 for (i = 0; i < A_K_NKEYS; i++) 01142 if (strcmp(name, arrow[i].name) == 0) { 01143 arrow[i].type = XK_NOD; 01144 return (0); 01145 } 01146 return (-1); 01147 }
Here is the caller graph for this function:

| protected void term_clear_EOL | ( | EditLine * | , | |
| int | ||||
| ) |
Definition at line 808 of file term.c.
Referenced by re_clear_lines(), and re_update_line().
00809 { 00810 int i; 00811 00812 if (EL_CAN_CEOL && GoodStr(T_ce)) 00813 (void) tputs(Str(T_ce), 1, term__putc); 00814 else { 00815 for (i = 0; i < num; i++) 00816 term__putc(' '); 00817 el->el_cursor.h += num; /* have written num spaces */ 00818 } 00819 }
Here is the caller graph for this function:

| protected void term_clear_screen | ( | EditLine * | ) |
Definition at line 826 of file term.c.
Referenced by ed_clear_screen().
00827 { /* clear the whole screen and home */ 00828 00829 if (GoodStr(T_cl)) 00830 /* send the clear screen code */ 00831 (void) tputs(Str(T_cl), Val(T_li), term__putc); 00832 else if (GoodStr(T_ho) && GoodStr(T_cd)) { 00833 (void) tputs(Str(T_ho), Val(T_li), term__putc); /* home */ 00834 /* clear to bottom of screen */ 00835 (void) tputs(Str(T_cd), Val(T_li), term__putc); 00836 } else { 00837 term__putc('\r'); 00838 term__putc('\n'); 00839 } 00840 }
Here is the caller graph for this function:

| protected void term_deletechars | ( | EditLine * | , | |
| int | ||||
| ) |
Definition at line 705 of file term.c.
Referenced by re_update_line().
00706 { 00707 if (num <= 0) 00708 return; 00709 00710 if (!EL_CAN_DELETE) { 00711 #ifdef DEBUG_EDIT 00712 (void) fprintf(el->el_errfile, " ERROR: cannot delete \n"); 00713 #endif /* DEBUG_EDIT */ 00714 return; 00715 } 00716 if (num > el->el_term.t_size.h) { 00717 #ifdef DEBUG_SCREEN 00718 (void) fprintf(el->el_errfile, 00719 "term_deletechars: num is riduculous: %d\r\n", num); 00720 #endif /* DEBUG_SCREEN */ 00721 return; 00722 } 00723 if (GoodStr(T_DC)) /* if I have multiple delete */ 00724 if ((num > 1) || !GoodStr(T_dc)) { /* if dc would be more 00725 * expen. */ 00726 (void) tputs(tgoto(Str(T_DC), num, num), 00727 num, term__putc); 00728 return; 00729 } 00730 if (GoodStr(T_dm)) /* if I have delete mode */ 00731 (void) tputs(Str(T_dm), 1, term__putc); 00732 00733 if (GoodStr(T_dc)) /* else do one at a time */ 00734 while (num--) 00735 (void) tputs(Str(T_dc), 1, term__putc); 00736 00737 if (GoodStr(T_ed)) /* if I have delete mode */ 00738 (void) tputs(Str(T_ed), 1, term__putc); 00739 }
Here is the caller graph for this function:

| protected int term_echotc | ( | EditLine * | , | |
| int | , | |||
| const char ** | ||||
| ) |
| protected void term_end | ( | EditLine * | ) |
Definition at line 352 of file term.c.
Referenced by el_end().
00353 { 00354 00355 el_free((ptr_t) el->el_term.t_buf); 00356 el->el_term.t_buf = NULL; 00357 el_free((ptr_t) el->el_term.t_cap); 00358 el->el_term.t_cap = NULL; 00359 el->el_term.t_loc = 0; 00360 el_free((ptr_t) el->el_term.t_str); 00361 el->el_term.t_str = NULL; 00362 el_free((ptr_t) el->el_term.t_val); 00363 el->el_term.t_val = NULL; 00364 el_free((ptr_t) el->el_term.t_fkey); 00365 el->el_term.t_fkey = NULL; 00366 term_free_display(el); 00367 }
Here is the caller graph for this function:

| protected void term_get | ( | EditLine * | , | |
| const char ** | ||||
| ) |
Definition at line 872 of file term.c.
References el, editline::el_term, and el_term_t::t_name.
Referenced by el_get().
Here is the caller graph for this function:

| protected int term_get_size | ( | EditLine * | , | |
| int * | , | |||
| int * | ||||
| ) |
Definition at line 971 of file term.c.
Referenced by el_resize(), and term_set().
00972 { 00973 00974 *cols = Val(T_co); 00975 *lins = Val(T_li); 00976 00977 #ifdef TIOCGWINSZ 00978 { 00979 struct winsize ws; 00980 if (ioctl(el->el_infd, TIOCGWINSZ, (ioctl_t) & ws) != -1) { 00981 if (ws.ws_col) 00982 *cols = ws.ws_col; 00983 if (ws.ws_row) 00984 *lins = ws.ws_row; 00985 } 00986 } 00987 #endif 00988 #ifdef TIOCGSIZE 00989 { 00990 struct ttysize ts; 00991 if (ioctl(el->el_infd, TIOCGSIZE, (ioctl_t) & ts) != -1) { 00992 if (ts.ts_cols) 00993 *cols = ts.ts_cols; 00994 if (ts.ts_lines) 00995 *lins = ts.ts_lines; 00996 } 00997 } 00998 #endif 00999 return (Val(T_co) != *cols || Val(T_li) != *lins); 01000 }
Here is the caller graph for this function:

| protected int term_init | ( | EditLine * | ) |
Definition at line 321 of file term.c.
Referenced by el_init().
00322 { 00323 00324 el->el_term.t_buf = (char *) el_malloc(TC_BUFSIZE); 00325 if (el->el_term.t_buf == NULL) 00326 return (-1); 00327 el->el_term.t_cap = (char *) el_malloc(TC_BUFSIZE); 00328 if (el->el_term.t_cap == NULL) 00329 return (-1); 00330 el->el_term.t_fkey = (fkey_t *) el_malloc(A_K_NKEYS * sizeof(fkey_t)); 00331 if (el->el_term.t_fkey == NULL) 00332 return (-1); 00333 el->el_term.t_loc = 0; 00334 el->el_term.t_str = (char **) el_malloc(T_str * sizeof(char *)); 00335 if (el->el_term.t_str == NULL) 00336 return (-1); 00337 (void) memset(el->el_term.t_str, 0, T_str * sizeof(char *)); 00338 el->el_term.t_val = (int *) el_malloc(T_val * sizeof(int)); 00339 if (el->el_term.t_val == NULL) 00340 return (-1); 00341 (void) memset(el->el_term.t_val, 0, T_val * sizeof(int)); 00342 term_outfile = el->el_outfile; 00343 (void) term_set(el, NULL); 00344 term_init_arrow(el); 00345 return (0); 00346 }
Here is the caller graph for this function:

| protected void term_insertwrite | ( | EditLine * | , | |
| char * | , | |||
| int | ||||
| ) |
Definition at line 747 of file term.c.
Referenced by re_update_line().
00748 { 00749 if (num <= 0) 00750 return; 00751 if (!EL_CAN_INSERT) { 00752 #ifdef DEBUG_EDIT 00753 (void) fprintf(el->el_errfile, " ERROR: cannot insert \n"); 00754 #endif /* DEBUG_EDIT */ 00755 return; 00756 } 00757 if (num > el->el_term.t_size.h) { 00758 #ifdef DEBUG_SCREEN 00759 (void) fprintf(el->el_errfile, 00760 "StartInsert: num is riduculous: %d\r\n", num); 00761 #endif /* DEBUG_SCREEN */ 00762 return; 00763 } 00764 if (GoodStr(T_IC)) /* if I have multiple insert */ 00765 if ((num > 1) || !GoodStr(T_ic)) { 00766 /* if ic would be more expensive */ 00767 (void) tputs(tgoto(Str(T_IC), num, num), 00768 num, term__putc); 00769 term_overwrite(el, cp, num); 00770 /* this updates el_cursor.h */ 00771 return; 00772 } 00773 if (GoodStr(T_im) && GoodStr(T_ei)) { /* if I have insert mode */ 00774 (void) tputs(Str(T_im), 1, term__putc); 00775 00776 el->el_cursor.h += num; 00777 do 00778 term__putc(*cp++); 00779 while (--num); 00780 00781 if (GoodStr(T_ip)) /* have to make num chars insert */ 00782 (void) tputs(Str(T_ip), 1, term__putc); 00783 00784 (void) tputs(Str(T_ei), 1, term__putc); 00785 return; 00786 } 00787 do { 00788 if (GoodStr(T_ic)) /* have to make num chars insert */ 00789 (void) tputs(Str(T_ic), 1, term__putc); 00790 /* insert a char */ 00791 00792 term__putc(*cp++); 00793 00794 el->el_cursor.h++; 00795 00796 if (GoodStr(T_ip)) /* have to make num chars insert */ 00797 (void) tputs(Str(T_ip), 1, term__putc); 00798 /* pad the inserted char */ 00799 00800 } while (--num); 00801 }
Here is the caller graph for this function:

| protected void term_move_to_char | ( | EditLine * | , | |
| int | ||||
| ) |
Definition at line 574 of file term.c.
Referenced by re_clear_lines(), re_refresh_cursor(), re_update_line(), and term_move_to_line().
00575 { 00576 int del, i; 00577 00578 mc_again: 00579 if (where == el->el_cursor.h) 00580 return; 00581 00582 if (where > el->el_term.t_size.h) { 00583 #ifdef DEBUG_SCREEN 00584 (void) fprintf(el->el_errfile, 00585 "term_move_to_char: where is riduculous: %d\r\n", where); 00586 #endif /* DEBUG_SCREEN */ 00587 return; 00588 } 00589 if (!where) { /* if where is first column */ 00590 term__putc('\r'); /* do a CR */ 00591 el->el_cursor.h = 0; 00592 return; 00593 } 00594 del = where - el->el_cursor.h; 00595 00596 if ((del < -4 || del > 4) && GoodStr(T_ch)) 00597 /* go there directly */ 00598 (void) tputs(tgoto(Str(T_ch), where, where), where, term__putc); 00599 else { 00600 if (del > 0) { /* moving forward */ 00601 if ((del > 4) && GoodStr(T_RI)) 00602 (void) tputs(tgoto(Str(T_RI), del, del), 00603 del, term__putc); 00604 else { 00605 /* if I can do tabs, use them */ 00606 if (EL_CAN_TAB) { 00607 if ((el->el_cursor.h & 0370) != 00608 (where & 0370)) { 00609 /* if not within tab stop */ 00610 for (i = 00611 (el->el_cursor.h & 0370); 00612 i < (where & 0370); 00613 i += 8) 00614 term__putc('\t'); 00615 /* then tab over */ 00616 el->el_cursor.h = where & 0370; 00617 } 00618 } 00619 /* 00620 * it's usually cheaper to just write the 00621 * chars, so we do. 00622 */ 00623 /* 00624 * NOTE THAT term_overwrite() WILL CHANGE 00625 * el->el_cursor.h!!! 00626 */ 00627 term_overwrite(el, 00628 &el->el_display[el->el_cursor.v][el->el_cursor.h], 00629 where - el->el_cursor.h); 00630 00631 } 00632 } else { /* del < 0 := moving backward */ 00633 if ((-del > 4) && GoodStr(T_LE)) 00634 (void) tputs(tgoto(Str(T_LE), -del, -del), 00635 -del, term__putc); 00636 else { /* can't go directly there */ 00637 /* 00638 * if the "cost" is greater than the "cost" 00639 * from col 0 00640 */ 00641 if (EL_CAN_TAB ? 00642 ((unsigned int)-del > 00643 (((unsigned int) where >> 3) + 00644 (where & 07))) 00645 : (-del > where)) { 00646 term__putc('\r'); /* do a CR */ 00647 el->el_cursor.h = 0; 00648 goto mc_again; /* and try again */ 00649 } 00650 for (i = 0; i < -del; i++) 00651 term__putc('\b'); 00652 } 00653 } 00654 } 00655 el->el_cursor.h = where; /* now where is here */ 00656 }
Here is the caller graph for this function:

| protected void term_move_to_line | ( | EditLine * | , | |
| int | ||||
| ) |
Definition at line 518 of file term.c.
Referenced by re_clear_lines(), re_goto_bottom(), re_refresh_cursor(), and re_update_line().
00519 { 00520 int del; 00521 00522 if (where == el->el_cursor.v) 00523 return; 00524 00525 if (where > el->el_term.t_size.v) { 00526 #ifdef DEBUG_SCREEN 00527 (void) fprintf(el->el_errfile, 00528 "term_move_to_line: where is ridiculous: %d\r\n", where); 00529 #endif /* DEBUG_SCREEN */ 00530 return; 00531 } 00532 if ((del = where - el->el_cursor.v) > 0) { 00533 while (del > 0) { 00534 if (EL_HAS_AUTO_MARGINS && 00535 el->el_display[el->el_cursor.v][0] != '\0') { 00536 /* move without newline */ 00537 term_move_to_char(el, el->el_term.t_size.h - 1); 00538 term_overwrite(el, 00539 &el->el_display[el->el_cursor.v][el->el_cursor.h], 00540 1); 00541 /* updates Cursor */ 00542 del--; 00543 } else { 00544 if ((del > 1) && GoodStr(T_DO)) { 00545 (void) tputs(tgoto(Str(T_DO), del, del), 00546 del, term__putc); 00547 del = 0; 00548 } else { 00549 for (; del > 0; del--) 00550 term__putc('\n'); 00551 /* because the \n will become \r\n */ 00552 el->el_cursor.h = 0; 00553 } 00554 } 00555 } 00556 } else { /* del < 0 */ 00557 if (GoodStr(T_UP) && (-del > 1 || !GoodStr(T_up))) 00558 (void) tputs(tgoto(Str(T_UP), -del, -del), -del, 00559 term__putc); 00560 else { 00561 if (GoodStr(T_up)) 00562 for (; del < 0; del++) 00563 (void) tputs(Str(T_up), 1, term__putc); 00564 } 00565 } 00566 el->el_cursor.v = where;/* now where is here */ 00567 }
Here is the caller graph for this function:

| protected void term_overwrite | ( | EditLine * | , | |
| const char * | , | |||
| int | ||||
| ) |
Definition at line 663 of file term.c.
Referenced by ed_delete_next_char(), em_delete_or_list(), re_update_line(), term_insertwrite(), term_move_to_char(), term_move_to_line(), term_overwrite(), and vi_list_or_eof().
00664 { 00665 if (n <= 0) 00666 return; /* catch bugs */ 00667 00668 if (n > el->el_term.t_size.h) { 00669 #ifdef DEBUG_SCREEN 00670 (void) fprintf(el->el_errfile, 00671 "term_overwrite: n is riduculous: %d\r\n", n); 00672 #endif /* DEBUG_SCREEN */ 00673 return; 00674 } 00675 do { 00676 term__putc(*cp++); 00677 el->el_cursor.h++; 00678 } while (--n); 00679 00680 if (el->el_cursor.h >= el->el_term.t_size.h) { /* wrap? */ 00681 if (EL_HAS_AUTO_MARGINS) { /* yes */ 00682 el->el_cursor.h = 0; 00683 el->el_cursor.v++; 00684 if (EL_HAS_MAGIC_MARGINS) { 00685 /* force the wrap to avoid the "magic" 00686 * situation */ 00687 char c; 00688 if ((c = el->el_display[el->el_cursor.v][el->el_cursor.h]) 00689 != '\0') 00690 term_overwrite(el, &c, 1); 00691 else 00692 term__putc(' '); 00693 el->el_cursor.h = 1; 00694 } 00695 } else /* no wrap, but cursor stays on screen */ 00696 el->el_cursor.h = el->el_term.t_size.h; 00697 } 00698 }
Here is the caller graph for this function:

| protected void term_print_arrow | ( | EditLine * | , | |
| const char * | ||||
| ) |
Definition at line 1154 of file term.c.
Referenced by map_bind(), and map_print_all_keys().
01155 { 01156 int i; 01157 fkey_t *arrow = el->el_term.t_fkey; 01158 01159 for (i = 0; i < A_K_NKEYS; i++) 01160 if (*name == '\0' || strcmp(name, arrow[i].name) == 0) 01161 if (arrow[i].type != XK_NOD) 01162 key_kprint(el, arrow[i].name, &arrow[i].fun, 01163 arrow[i].type); 01164 }
Here is the caller graph for this function:

| protected int term_set | ( | EditLine * | , | |
| const char * | ||||
| ) |
Definition at line 882 of file term.c.
Referenced by el_set(), and term_init().
00883 { 00884 int i; 00885 char buf[TC_BUFSIZE]; 00886 char *area; 00887 const struct termcapstr *t; 00888 sigset_t oset, nset; 00889 int lins, cols; 00890 00891 (void) sigemptyset(&nset); 00892 (void) sigaddset(&nset, SIGWINCH); 00893 (void) sigprocmask(SIG_BLOCK, &nset, &oset); 00894 00895 area = buf; 00896 00897 00898 if (term == NULL) 00899 term = getenv("TERM"); 00900 00901 if (!term || !term[0]) 00902 term = "dumb"; 00903 00904 if (strcmp(term, "emacs") == 0) 00905 el->el_flags |= EDIT_DISABLED; 00906 00907 memset(el->el_term.t_cap, 0, TC_BUFSIZE); 00908 00909 i = tgetent(el->el_term.t_cap, term); 00910 00911 if (i <= 0) { 00912 if (i == -1) 00913 (void) fprintf(el->el_errfile, 00914 "Cannot read termcap database;\n"); 00915 else if (i == 0) 00916 (void) fprintf(el->el_errfile, 00917 "No entry for terminal type \"%s\";\n", term); 00918 (void) fprintf(el->el_errfile, 00919 "using dumb terminal settings.\n"); 00920 Val(T_co) = 80; /* do a dumb terminal */ 00921 Val(T_pt) = Val(T_km) = Val(T_li) = 0; 00922 Val(T_xt) = Val(T_MT); 00923 for (t = tstr; t->name != NULL; t++) 00924 term_alloc(el, t, NULL); 00925 } else { 00926 /* auto/magic margins */ 00927 Val(T_am) = tgetflag("am"); 00928 Val(T_xn) = tgetflag("xn"); 00929 /* Can we tab */ 00930 Val(T_pt) = tgetflag("pt"); 00931 Val(T_xt) = tgetflag("xt"); 00932 /* do we have a meta? */ 00933 Val(T_km) = tgetflag("km"); 00934 Val(T_MT) = tgetflag("MT"); 00935 /* Get the size */ 00936 Val(T_co) = tgetnum("co"); 00937 Val(T_li) = tgetnum("li"); 00938 for (t = tstr; t->name != NULL; t++) { 00939 /* XXX: some systems tgetstr needs non const */ 00940 term_alloc(el, t, tgetstr(strchr(t->name, *t->name), 00941 &area)); 00942 } 00943 } 00944 00945 if (Val(T_co) < 2) 00946 Val(T_co) = 80; /* just in case */ 00947 if (Val(T_li) < 1) 00948 Val(T_li) = 24; 00949 00950 el->el_term.t_size.v = Val(T_co); 00951 el->el_term.t_size.h = Val(T_li); 00952 00953 term_setflags(el); 00954 00955 /* get the correct window size */ 00956 (void) term_get_size(el, &lins, &cols); 00957 if (term_change_size(el, lins, cols) == -1) 00958 return (-1); 00959 (void) sigprocmask(SIG_SETMASK, &oset, NULL); 00960 term_bind_arrow(el); 00961 el->el_term.t_name = term; 00962 return (i <= 0 ? -1 : 0); 00963 }
Here is the caller graph for this function:

| protected int term_set_arrow | ( | EditLine * | , | |
| const char * | , | |||
| key_value_t * | , | |||
| int | ||||
| ) |
Definition at line 1117 of file term.c.
Referenced by map_bind().
01118 { 01119 fkey_t *arrow = el->el_term.t_fkey; 01120 int i; 01121 01122 for (i = 0; i < A_K_NKEYS; i++) 01123 if (strcmp(name, arrow[i].name) == 0) { 01124 arrow[i].fun = *fun; 01125 arrow[i].type = type; 01126 return (0); 01127 } 01128 return (-1); 01129 }
Here is the caller graph for this function:

| protected int term_settc | ( | EditLine * | , | |
| int | , | |||
| const char ** | ||||
| ) |
| protected int term_telltc | ( | EditLine * | , | |
| int | , | |||
| const char ** | ||||
| ) |
1.4.7

