Lines Matching defs:sp
65 v_tcmd(SCR *sp, VICMD *vp, ARG_CHAR_T prompt, u_int flags)
68 vp->m_final.lno = sp->lno;
69 vp->m_final.cno = sp->cno;
72 if (txt_map_init(sp))
76 sp->lno = TMAP[0].lno;
77 sp->cno = 0;
80 F_SET(sp, SC_TINPUT_INFO);
85 if (O_ISSET(sp, O_ALTWERASE))
87 if (O_ISSET(sp, O_TTYWERASE))
91 if (v_txt(sp, vp, NULL, NULL, 0, prompt, 0, 1, flags))
95 F_CLR(sp, SC_TINPUT_INFO);
98 if (txt_map_end(sp))
101 if (IS_ONELINE(sp))
102 F_SET(sp, SC_SCR_REDRAW); /* XXX */
105 sp->lno = vp->m_final.lno;
106 sp->cno = vp->m_final.cno;
116 txt_map_init(SCR *sp)
121 vip = VIP(sp);
122 if (!IS_ONELINE(sp)) {
134 vip->sv_t_maxrows = sp->t_maxrows;
135 vip->sv_t_minrows = sp->t_minrows;
136 vip->sv_t_rows = sp->t_rows;
142 if (IS_SMALL(sp))
144 HMAP + (sp->t_maxrows - 1); TMAP < esmp; ++TMAP) {
158 sp->t_rows = sp->t_minrows = ++sp->t_maxrows;
168 txt_map_end(SCR *sp)
173 vip = VIP(sp);
174 if (!IS_ONELINE(sp)) {
176 sp->t_rows = vip->sv_t_rows;
177 sp->t_minrows = vip->sv_t_minrows;
178 sp->t_maxrows = vip->sv_t_maxrows;
184 if (IS_SMALL(sp)) {
185 for (cnt = sp->t_rows; cnt <= sp->t_maxrows; ++cnt) {
186 (void)sp->gp->scr_move(sp, cnt, 0);
187 (void)sp->gp->scr_clrtoeol(sp);
189 TMAP = HMAP + (sp->t_rows - 1);
198 if (!O_ISSET(sp, O_LEFTRIGHT))
201 if (vs_sm_1down(sp))
226 * sp->lno and sp->cno. Make them consistent as necessary.
228 #define UPDATE_POSITION(sp, tp) { \
229 (sp)->lno = (tp)->lno; \
230 (sp)->cno = (tp)->cno; \
242 SCR *sp,
280 gp = sp->gp;
281 vip = VIP(sp);
287 F_SET(sp, SC_TINPUT);
295 tiqh = sp->tiq;
306 BINC_RETW(sp, tp->lb, tp->lb_len, len);
311 newtp: if ((tp = text_init(sp, lp, len, len + 32)) == NULL)
320 tp->lno = sp->lno;
321 tp->cno = sp->cno;
336 if (LF_ISSET(TXT_EMARK) && txt_emark(sp, tp, tm->cno))
354 if (v_txt_auto(sp, ai_line, NULL, 0, tp))
391 (void)vs_change(sp, tp->lno, LINE_RESET);
421 if ((margin = O_VAL(sp, O_WRAPMARGIN)) != 0)
422 margin = sp->cols - margin;
424 margin = O_VAL(sp, O_WRAPLEN);
471 UPDATE_POSITION(sp, tp);
472 if (vs_refresh(sp, 1))
481 next: if (v_event_get(sp, evp, 0, ec_flags))
490 if (filec_redraw && !F_ISSET(sp, SC_SCR_EXWROTE)) {
495 sp->rows ? 1 : sp->rows - vip->totalcount;
496 fc.e_tlno = sp->rows;
498 (void)vs_repaint(sp, &fc);
499 (void)vs_refresh(sp, 1);
508 F_SET(sp, SC_EXIT_FORCE);
520 if (vs_repaint(sp, &ev))
525 v_emsg(sp, NULL, VIM_WRESIZE);
528 v_event_err(sp, evp);
560 if (LF_ISSET(TXT_CEDIT) && O_STR(sp, O_CEDIT) != NULL &&
561 O_STR(sp, O_CEDIT)[0] == evp->e_c)
563 if (LF_ISSET(TXT_FILEC) && O_STR(sp, O_FILEC) != NULL &&
564 O_STR(sp, O_FILEC)[0] == evp->e_c)
571 if (txt_fc(sp, tp, &filec_redraw))
581 if (v_event_flush(sp, CH_ABBREVIATED))
582 msgq(sp, M_ERR,
594 BINC_GOTO(sp, EVENT, vip->rep,
656 if (txt_hex(sp, tp))
673 if (vs_change(sp, tp->lno, LINE_RESET))
675 } else if (F_ISSET(sp, SC_SCRIPT))
676 (void)v_event_push(sp, NULL, L("\r"), 1, CH_NOMAP);
700 if (txt_abbrev(sp, tp, &evp->e_c, \
713 txt_unmap(sp, tp, &ec_flags); \
736 if (vs_change(sp, tp->lno, LINE_RESET))
759 if (O_ISSET(sp, O_AUTOINDENT))
771 if ((ntp = text_init(sp, p,
774 TAILQ_INSERT_TAIL(sp->tiq, ntp, q);
791 if (v_txt_auto(sp, OOBLNO, &ait, ait.ai, ntp))
793 FREE_SPACEW(sp, ait.lb, ait.lb_len);
795 if (v_txt_auto(sp, OOBLNO, tp, tp->cno, ntp))
812 BINC_GOTOW(sp, ntp->lb,
825 BINC_GOTOW(sp, ntp->lb, ntp->lb_len, ntp->len + 1);
834 if (vs_change(sp, tp->lno, LINE_INSERT))
889 txt_Rresolve(sp, sp->tiq, tp, len);
912 if (txt_resolve(sp, sp->tiq, flags))
915 BINC_GOTOW(sp, tp->lb, tp->lb_len, tp->len + 1);
927 if (vs_change(sp, tp->lno, LINE_RESET))
959 BINC_GOTOW(sp, ait.lb, ait.lb_len, tp->ai);
980 (void)txt_dent(sp, tp, 0);
999 txt_backup(sp, sp->tiq, tp, &flags)) == NULL)
1008 txt_nomorech(sp);
1051 txt_backup(sp, sp->tiq, tp, &flags)) == NULL)
1061 txt_nomorech(sp);
1150 txt_backup(sp, sp->tiq, tp, &flags)) == NULL)
1158 txt_nomorech(sp);
1196 if (txt_dent(sp, tp, 1))
1249 match_chars = VIP(sp)->mcs;
1269 msgq(sp, M_BERR,
1285 if (txt_abbrev(sp, tp, &evp->e_c,
1295 txt_unmap(sp, tp, &ec_flags);
1300 insl_ch: if (txt_insch(sp, tp, &evp->e_c, flags))
1322 if (txt_hex(sp, tp))
1338 if (vs_column(sp, &tcol))
1341 if (txt_margin(sp, tp, &wmt, &tmp, flags))
1359 BINC_GOTOW(sp, tp->lb, tp->lb_len, tp->len + 1);
1379 msgq(sp, M_ERR,
1401 if ((margin != 0 || !KEYS_WAITING(sp)) &&
1402 vs_change(sp, tp->lno, LINE_RESET))
1411 if (!KEYS_WAITING(sp) && txt_showmatch(sp, tp))
1421 !F_ISSET(sp, SC_TINPUT_INFO) && !filec_redraw &&
1422 vs_resolve(sp, NULL, 0))
1429 if (margin != 0 || !KEYS_WAITING(sp)) {
1430 UPDATE_POSITION(sp, tp);
1431 if (vs_refresh(sp, margin != 0))
1436 if (FL_ISSET(is_flags, IS_RUNNING) && txt_isrch(sp, vp, tp, &is_flags))
1445 F_CLR(sp, SC_TINPUT);
1455 if (!F_ISSET(sp, SC_TINPUT_INFO)) {
1463 F_CLR(sp, SC_TINPUT);
1464 txt_err(sp, sp->tiq);
1473 txt_abbrev(SCR *sp, TEXT *tp, CHAR_T *pushcp, int isinfoline, int *didsubp, int *turnoffp)
1485 vip = VIP(sp);
1576 if ((qp = seq_find(sp, NULL, NULL, p, len, SEQ_ABBREV, NULL)) == NULL)
1598 if (v_event_push(sp, NULL, &ch, 1, CH_ABBREVIATED))
1600 if (v_event_push(sp, NULL, qp->output, qp->olen, CH_ABBREVIATED))
1639 txt_unmap(SCR *sp, TEXT *tp, u_int32_t *ec_flagsp)
1679 txt_ai_resolve(SCR *sp, TEXT *tp, int *changedp)
1709 ts = O_VAL(sp, O_TABSTOP);
1766 v_txt_auto(SCR *sp, recno_t lno, TEXT *aitp, size_t len, TEXT *tp)
1781 if (db_get(sp, lno, DBG_FATAL, &t, &len))
1796 BINC_RETW(sp, tp->lb, tp->lb_len, tp->len + nlen);
1816 txt_backup(SCR *sp, TEXTH *tiqh, TEXT *tp, u_int32_t *flagsp)
1824 msgq(sp, M_BERR,
1833 vip = VIP(sp);
1847 if (vs_change(sp, ntp->lno + 1, LINE_DELETE))
1891 txt_dent(SCR *sp, TEXT *tp, int isindent)
1898 ts = O_VAL(sp, O_TABSTOP);
1899 sw = O_VAL(sp, O_SHIFTWIDTH);
1919 COL_OFF(current, ts) : KEY_COL(sp, tp->lb[cno]);
1949 COL_OFF(current, ts) : KEY_COL(sp, tp->lb[cno]);
1981 (void)txt_insch(sp, tp, &ch, 0);
1983 (void)txt_insch(sp, tp, &ch, 0);
1992 txt_fc(SCR *sp, TEXT *tp, int *redrawp)
2005 ex_cinit(sp, &cmd, 0, 0, OOBLNO, OOBLNO, 0);
2020 if (IS_ESCAPE(sp, &cmd, *ap)) {
2040 (void)argv_flt_ex(sp, &cmd, p, len);
2042 if ((bp = argv_uesc(sp, &cmd, p, len)) == NULL)
2044 if (argv_flt_path(sp, &cmd, bp, STRLEN(bp))) {
2045 FREE_SPACEW(sp, bp, 0);
2048 FREE_SPACEW(sp, bp, 0);
2055 (void)sp->gp->scr_bell(sp);
2063 if (txt_fc_col(sp, argc, argv))
2082 if ((bp = argv_esc(sp, &cmd, cmd.argv[0]->bp, nlen)) == NULL)
2104 BINC_RETW(sp, tp->lb, tp->lb_len, tp->len + nlen);
2117 FREE_SPACEW(sp, bp, 0);
2124 INT2CHAR(sp, cmd.argv[0]->bp, cmd.argv[0]->len + 1, np, nplen);
2130 BINC_RETW(sp, tp->lb, tp->lb_len, tp->len + 1);
2150 txt_fc_col(SCR *sp, int argc, ARGS **argv)
2160 gp = sp->gp;
2163 INT2CHAR(sp, argv[0]->bp, argv[0]->len + 1, np, nlen);
2186 col += KEY_COL(sp, *p);
2196 if (F_ISSET(sp, SC_TINPUT_INFO)) {
2198 F_CLR(sp, SC_TINPUT_INFO);
2207 if (colwidth >= sp->cols) {
2209 INT2CHAR(sp, av[0]->bp+prefix, av[0]->len+1-prefix,
2211 pp = msg_print(sp, np, &nf);
2212 (void)ex_printf(sp, "%s\n", pp);
2214 FREE_SPACE(sp, pp, 0);
2221 numcols = (sp->cols - 1) / colwidth;
2232 INT2CHAR(sp, argv[base]->bp+prefix,
2234 pp = msg_print(sp, np, &nf);
2235 cnt = ex_printf(sp, "%s", pp);
2237 FREE_SPACE(sp, pp, 0);
2241 (void)ex_printf(sp,
2245 (void)ex_puts(sp, "\n");
2248 (void)ex_puts(sp, "\n");
2251 (void)ex_fflush(sp);
2257 F_SET(sp, SC_TINPUT_INFO);
2267 txt_emark(SCR *sp, TEXT *tp, size_t cno)
2280 nlen = KEY_COL(sp, ch);
2282 (void)vs_columns(sp, tp->lb, tp->lno, &cno, &olen);
2284 olen = KEY_COL(sp, tp->lb[cno]);
2292 BINC_RETW(sp, tp->lb, tp->lb_len, tp->len + olen);
2302 KEY_NEEDSWIDE(sp, tp->lb[cno]))
2307 KEY_NAME(sp, tp->lb[cno]),
2312 return (vs_change(sp, tp->lno, LINE_RESET));
2320 txt_err(SCR *sp, TEXTH *tiqh)
2334 !db_exist(sp, lno) && lno > 0; --lno);
2336 sp->lno = lno == 0 ? 1 : lno;
2337 sp->cno = 0;
2340 F_SET(sp, SC_SCR_REDRAW);
2353 txt_hex(SCR *sp, TEXT *tp)
2433 txt_insch(SCR *sp, TEXT *tp, CHAR_T *chp, u_int flags)
2461 (void)vs_columns(sp, tp->lb, tp->lno, &cno, &nlen);
2464 nlen = KEY_COL(sp, *chp);
2476 (void)vs_columns(sp,
2479 olen = KEY_COL(sp, tp->lb[cno]);
2489 BINC_RETW(sp,
2499 KEY_NEEDSWIDE(sp, tp->lb[cno]))
2504 KEY_NAME(sp, tp->lb[cno]) + nlen,
2529 BINC_RETW(sp, tp->lb, tp->lb_len, tp->len + 1);
2548 txt_isrch(SCR *sp, VICMD *vp, TEXT *tp, u_int8_t *is_flagsp)
2555 if (IS_ONELINE(sp)) {
2581 if (IS_SHELLMETA(sp, tp->lb[tp->cno - 1]) &&
2604 F_SET(VIP(sp), VIP_S_MODELINE);
2605 F_CLR(sp, SC_TINPUT | SC_TINPUT_INFO);
2606 if (txt_map_end(sp))
2625 !f_search(sp,
2627 !b_search(sp,
2629 sp->lno = vp->m_final.lno;
2630 sp->cno = vp->m_final.cno;
2633 if (!KEYS_WAITING(sp) && vs_refresh(sp, 0))
2639 if (txt_map_init(sp))
2641 F_CLR(VIP(sp), VIP_S_MODELINE);
2642 F_SET(sp, SC_TINPUT | SC_TINPUT_INFO);
2656 if (vs_line(sp, &TMAP[0], NULL, NULL))
2658 (void)sp->gp->scr_refresh(sp, 0);
2668 txt_resolve(SCR *sp, TEXTH *tiqh, u_int32_t flags)
2682 vip = VIP(sp);
2686 txt_ai_resolve(sp, tp, &changed);
2689 if (db_set(sp, tp->lno, tp->lb, tp->len) ||
2690 (changed && vs_change(sp, tp->lno, LINE_RESET)))
2695 txt_ai_resolve(sp, tp, &changed);
2698 if (db_append(sp, 0, lno, tp->lb, tp->len) ||
2699 (changed && vs_change(sp, tp->lno, LINE_RESET)))
2708 F_CLR(sp, SC_TINPUT);
2722 txt_showmatch(SCR *sp, TEXT *tp)
2729 gp = sp->gp;
2735 UPDATE_POSITION(sp, tp);
2736 if (vs_refresh(sp, 1))
2743 if (vs_sm_position(sp, &m, 0, P_TOP))
2749 if (cs_init(sp, &cs))
2751 startc = STRCHR(VIP(sp)->mcs, endc = cs.cs_ch)[-1];
2755 if (cs_prev(sp, &cs))
2759 msgq(sp, M_BERR,
2760 "Unmatched %s", KEY_NAME(sp, endc));
2774 sp->lno = cs.cs_lno;
2775 sp->cno = cs.cs_cno;
2776 if (vs_refresh(sp, 1))
2780 return (v_event_get(sp,
2781 NULL, O_VAL(sp, O_MATCHTIME) * 100, EC_TIMEOUT));
2789 txt_margin(SCR *sp, TEXT *tp, TEXT *wmtp, int *didbreak, u_int32_t flags)
2827 vip = VIP(sp);
2865 txt_Rresolve(SCR *sp, TEXTH *tiqh, TEXT *tp, const size_t orig_len)
2904 if (db_get(sp,
2919 txt_nomorech(SCR *sp)
2921 msgq(sp, M_BERR, "194|No more characters to erase");