MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / re_nextline

Function re_nextline

extern/editline/src/refresh.c:95–122  ·  view source on GitHub ↗

re_nextline(): * Move to the next line or scroll */

Source from the content-addressed store, hash-verified

93 * Move to the next line or scroll
94 */
95private void
96re_nextline(EditLine *el)
97{
98 el->el_refresh.r_cursor.h = 0; /* reset it. */
99
100 /*
101 * If we would overflow (input is longer than terminal size),
102 * emulate scroll by dropping first line and shuffling the rest.
103 * We do this via pointer shuffling - it's safe in this case
104 * and we avoid memcpy().
105 */
106 if (el->el_refresh.r_cursor.v + 1 >= el->el_terminal.t_size.v) {
107 int i, lins = el->el_terminal.t_size.v;
108 Char *firstline = el->el_vdisplay[0];
109
110 for(i = 1; i < lins; i++)
111 el->el_vdisplay[i - 1] = el->el_vdisplay[i];
112
113 firstline[0] = '\0'; /* empty the string */
114 el->el_vdisplay[i - 1] = firstline;
115 } else
116 el->el_refresh.r_cursor.v++;
117
118 ELRE_ASSERT(el->el_refresh.r_cursor.v >= el->el_terminal.t_size.v,
119 (__F, "\r\nre_putc: overflow! r_cursor.v == %d > %d\r\n",
120 el->el_refresh.r_cursor.v, el->el_terminal.t_size.v),
121 abort());
122}
123
124/* re_addc():
125 * Draw c, expanding tabs, control chars etc.

Callers 2

re_addcFunction · 0.85
re_putcFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected