Lines Matching +full:smp +full:- +full:offset
1 /*-
25 #define TABCH '-'
31 * vs_line --
37 vs_line(SCR *sp, SMAP *smp, size_t *yp, size_t *xp) in vs_line() argument
53 smp - HMAP, smp->lno, smp->off); in vs_line()
57 * don't touch it -- we'll get scrolling wrong, at best. in vs_line()
60 if (!F_ISSET(sp, SC_TINPUT_INFO) && VIP(sp)->totalcount > 1) in vs_line()
62 if (F_ISSET(sp, SC_SCR_EXWROTE) && smp - HMAP != LASTLINE(sp)) in vs_line()
71 is_cached = SMAP_CACHE(smp); in vs_line()
85 gp = sp->gp; in vs_line()
86 (void)gp->scr_cursor(sp, &oldy, &oldx); in vs_line()
87 (void)gp->scr_move(sp, smp - HMAP, 0); in vs_line()
90 dne = db_get(sp, smp->lno, 0, &p, &len); in vs_line()
104 cols_per_screen = sp->cols; in vs_line()
107 skip_cols = smp->coff; in vs_line()
109 skip_screens = smp->soff - 1; in vs_line()
129 * first screen. DO NOT CHANGE THIS -- IT'S RIGHT! The in vs_line()
135 cols_per_screen -= O_NUMBER_LENGTH; in vs_line()
136 if ((!dne || smp->lno == 1) && skip_cols == 0) { in vs_line()
138 sizeof(cbuf), O_NUMBER_FMT, (u_long)smp->lno); in vs_line()
139 (void)gp->scr_addstr(sp, (char*)cbuf, nlen); in vs_line()
145 * Special case non-existent lines and the first line of an empty in vs_line()
151 if (yp != NULL && smp->lno == sp->lno) { in vs_line()
152 *yp = smp - HMAP; in vs_line()
153 *xp = sp->cols - cols_per_screen; in vs_line()
161 smp->c_sboff = smp->c_eboff = 0; in vs_line()
162 smp->c_scoff = smp->c_eclen = 0; in vs_line()
170 if (smp->lno == 1) { in vs_line()
182 empty: (void)gp->scr_addstr(sp, in vs_line()
188 (void)gp->scr_clrtoeol(sp); in vs_line()
189 (void)gp->scr_move(sp, oldy, oldx); in vs_line()
196 if (sp->lno == smp->lno && sp->cno >= len) in vs_line()
197 sp->cno = len - 1; in vs_line()
209 * do us any good to have a line in front of us -- it would be really in vs_line()
217 smp->c_sboff = offset_in_line = 0; in vs_line()
218 smp->c_scoff = offset_in_char = 0; in vs_line()
225 offset_in_line = smp->c_sboff; in vs_line()
226 offset_in_char = smp->c_scoff; in vs_line()
231 cols_per_screen = sp->cols; in vs_line()
236 if (smp != HMAP && in vs_line()
237 SMAP_CACHE(tsmp = smp - 1) && tsmp->lno == smp->lno) { in vs_line()
238 if (tsmp->c_eclen != tsmp->c_ecsize) { in vs_line()
239 offset_in_line = tsmp->c_eboff; in vs_line()
240 offset_in_char = tsmp->c_eclen; in vs_line()
242 offset_in_line = tsmp->c_eboff + 1; in vs_line()
247 smp->c_sboff = offset_in_line; in vs_line()
248 smp->c_scoff = offset_in_char; in vs_line()
253 cols_per_screen = sp->cols; in vs_line()
271 cols_per_screen = sp->cols; in vs_line()
275 smp->c_sboff = offset_in_line; in vs_line()
276 smp->c_scoff = 255; in vs_line()
278 smp->c_sboff = offset_in_line; in vs_line()
279 smp->c_scoff = in vs_line()
280 offset_in_char = chlen - (scno - skip_cols); in vs_line()
281 --p; in vs_line()
283 smp->c_sboff = ++offset_in_line; in vs_line()
284 smp->c_scoff = 0; in vs_line()
288 /* Do it the hard way, for historic line-folding screens. */ in vs_line()
295 scno -= cols_per_screen; in vs_line()
298 cols_per_screen = sp->cols; in vs_line()
304 if (--skip_screens == 0) in vs_line()
310 smp->c_sboff = offset_in_line; in vs_line()
311 smp->c_scoff = offset_in_char = chlen - scno; in vs_line()
312 --p; in vs_line()
314 smp->c_sboff = ++offset_in_line; in vs_line()
315 smp->c_scoff = 0; in vs_line()
322 * character. Offset by 1 and use 0 as a flag value. Vs_line is in vs_line()
328 smp->lno != sp->lno || sp->cno < offset_in_line || in vs_line()
329 offset_in_line + cols_per_screen < sp->cno) { in vs_line()
335 cno_cnt = (sp->cno - offset_in_line) + 1; in vs_line()
338 ecbp = (cbp = cbuf) + SIZE(cbuf) - 1; in vs_line()
342 scno += chlen = TAB_OFF(scno) - offset_in_char; in vs_line()
345 scno += chlen = KEY_COL(sp, ch) - offset_in_char; in vs_line()
350 * Only display up to the right-hand column. Set a flag if in vs_line()
359 chlen -= scno - cols_per_screen; in vs_line()
360 smp->c_ecsize = smp->c_eclen = chlen; in vs_line()
363 smp->c_ecsize = chlen; in vs_line()
364 chlen -= scno - cols_per_screen; in vs_line()
365 smp->c_eclen = chlen; in vs_line()
370 smp->c_eboff = offset_in_line; in vs_line()
379 * put the cursor on a character -- if it's normal display in vs_line()
385 --cno_cnt == 0 && (F_ISSET(sp, SC_TINPUT) || !is_partial)) { in vs_line()
386 *yp = smp - HMAP; in vs_line()
389 *xp = scno - smp->c_ecsize; in vs_line()
391 *xp = scno - chlen; in vs_line()
393 *xp = scno - 1; in vs_line()
409 (void)gp->scr_waddstr(sp, cbuf, cbp - cbuf); \ in vs_line()
420 while (chlen--) { in vs_line()
440 chlen--;) in vs_line()
447 smp->c_ecsize = smp->c_eclen = KEY_COL(sp, ch); in vs_line()
448 smp->c_eboff = len - 1; in vs_line()
462 KEY_NAME(sp, '$'); chlen--;) in vs_line()
468 (void)gp->scr_clrtoeol(sp); in vs_line()
475 ret1: (void)gp->scr_move(sp, oldy, oldx); in vs_line()
480 * vs_number --
489 SMAP *smp; in vs_number() local
495 gp = sp->gp; in vs_number()
504 * line after the last line in the screen -- if it exists, we know in vs_number()
511 exist = db_exist(sp, TMAP->lno + 1); in vs_number()
513 (void)gp->scr_cursor(sp, &oldy, &oldx); in vs_number()
514 for (smp = HMAP; smp <= TMAP; ++smp) { in vs_number()
517 if (smp->coff != 0) in vs_number()
520 if (smp->soff != 1) in vs_number()
527 if (smp->lno != 1 && !exist && !db_exist(sp, smp->lno)) in vs_number()
530 (void)gp->scr_move(sp, smp - HMAP, 0); in vs_number()
531 len = snprintf(nbuf, sizeof(nbuf), O_NUMBER_FMT, (u_long)smp->lno); in vs_number()
532 (void)gp->scr_addstr(sp, nbuf, len); in vs_number()
534 (void)gp->scr_move(sp, oldy, oldx); in vs_number()