Lines Matching +full:cs +full:- +full:0
1 /*-
25 * There are two types of "words". Bigwords are easy -- groups of anything
34 * same as "eeee" -- in particular, single character words, and commands that
36 * you have to resolve the cursor after each search so that the look-ahead to
39 * Empty lines, and lines that consist of only white-space characters count
50 * One historic note -- in the original vi, the 'w', 'W' and 'B' commands
56 * command, go absolutely nuts. If the lines contained only white-space
60 * implementation treats all of these cases as a single white-space word.
70 * v_wordW -- [count]W
82 * v_wordw -- [count]w
94 * fword --
101 VCS cs; in fword() local
104 cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; in fword()
105 cs.cs_lno = vp->m_start.lno; in fword()
106 cs.cs_cno = vp->m_start.cno; in fword()
107 if (cs_init(sp, &cs)) in fword()
111 * If in white-space: in fword()
113 * Else, move to the first non-white-space character, which in fword()
117 if (cs.cs_flags == CS_EMP || (cs.cs_flags == 0 && ISBLANK(cs.cs_ch))) { in fword()
118 if (ISMOTION(vp) && cs.cs_flags != CS_EMP && cnt == 1) { in fword()
119 if (ISCMD(vp->rkp, 'c')) in fword()
120 return (0); in fword()
121 if (ISCMD(vp->rkp, 'd') || ISCMD(vp->rkp, 'y')) { in fword()
122 if (cs_fspace(sp, &cs)) in fword()
127 if (cs_fblank(sp, &cs)) in fword()
129 --cnt; in fword()
133 * Cyclically move to the next word -- this involves skipping in fword()
134 * over word characters and then any trailing non-word characters. in fword()
139 while (cnt--) { in fword()
141 if (cs_next(sp, &cs)) in fword()
143 if (cs.cs_flags == CS_EOF) in fword()
145 if (cs.cs_flags != 0 || ISBLANK(cs.cs_ch)) in fword()
154 if (cnt == 0 && ISMOTION(vp)) { in fword()
155 if ((ISCMD(vp->rkp, 'd') || in fword()
156 ISCMD(vp->rkp, 'y')) && in fword()
157 cs_fspace(sp, &cs)) in fword()
163 if (cs_fblank(sp, &cs)) in fword()
165 if (cs.cs_flags == CS_EOF) in fword()
169 while (cnt--) { in fword()
170 state = cs.cs_flags == 0 && in fword()
171 inword(cs.cs_ch) ? INWORD : NOTWORD; in fword()
173 if (cs_next(sp, &cs)) in fword()
175 if (cs.cs_flags == CS_EOF) in fword()
177 if (cs.cs_flags != 0 || ISBLANK(cs.cs_ch)) in fword()
180 if (!inword(cs.cs_ch)) in fword()
183 if (inword(cs.cs_ch)) in fword()
187 if (cnt == 0 && ISMOTION(vp)) { in fword()
188 if ((ISCMD(vp->rkp, 'd') || in fword()
189 ISCMD(vp->rkp, 'y')) && in fword()
190 cs_fspace(sp, &cs)) in fword()
196 if (cs.cs_flags != 0 || ISBLANK(cs.cs_ch)) in fword()
197 if (cs_fblank(sp, &cs)) in fword()
199 if (cs.cs_flags == CS_EOF) in fword()
210 cs.cs_lno == vp->m_start.lno && cs.cs_cno == vp->m_start.cno) { in fword()
211 v_eof(sp, &vp->m_start); in fword()
216 vp->m_stop.lno = cs.cs_lno; in fword()
217 vp->m_stop.cno = cs.cs_cno; in fword()
218 if (ISMOTION(vp) && cs.cs_flags == 0) in fword()
219 --vp->m_stop.cno; in fword()
222 * Non-motion commands move to the end of the range. Delete in fword()
225 vp->m_final = ISMOTION(vp) ? vp->m_start : vp->m_stop; in fword()
226 return (0); in fword()
230 * v_wordE -- [count]E
242 * v_worde -- [count]e
254 * eword --
261 VCS cs; in eword() local
264 cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; in eword()
265 cs.cs_lno = vp->m_start.lno; in eword()
266 cs.cs_cno = vp->m_start.cno; in eword()
267 if (cs_init(sp, &cs)) in eword()
276 if (cs.cs_flags == 0 && !ISBLANK(cs.cs_ch)) { in eword()
277 if (cs_next(sp, &cs)) in eword()
279 if (cs.cs_flags == 0 && !ISBLANK(cs.cs_ch)) in eword()
282 if (cs_fblank(sp, &cs)) in eword()
286 * Cyclically move to the next word -- this involves skipping in eword()
287 * over word characters and then any trailing non-word characters. in eword()
292 while (cnt--) { in eword()
294 if (cs_next(sp, &cs)) in eword()
296 if (cs.cs_flags == CS_EOF) in eword()
298 if (cs.cs_flags != 0 || ISBLANK(cs.cs_ch)) in eword()
306 if (cnt == 0) { in eword()
307 if (cs.cs_flags == 0 && cs_prev(sp, &cs)) in eword()
313 if (cs_fblank(sp, &cs)) in eword()
315 if (cs.cs_flags == CS_EOF) in eword()
319 while (cnt--) { in eword()
320 state = cs.cs_flags == 0 && in eword()
321 inword(cs.cs_ch) ? INWORD : NOTWORD; in eword()
323 if (cs_next(sp, &cs)) in eword()
325 if (cs.cs_flags == CS_EOF) in eword()
327 if (cs.cs_flags != 0 || ISBLANK(cs.cs_ch)) in eword()
330 if (!inword(cs.cs_ch)) in eword()
333 if (inword(cs.cs_ch)) in eword()
337 if (cnt == 0) { in eword()
338 if (cs.cs_flags == 0 && cs_prev(sp, &cs)) in eword()
344 if (cs.cs_flags != 0 || ISBLANK(cs.cs_ch)) in eword()
345 if (cs_fblank(sp, &cs)) in eword()
347 if (cs.cs_flags == CS_EOF) in eword()
358 cs.cs_lno == vp->m_start.lno && cs.cs_cno == vp->m_start.cno) { in eword()
359 v_eof(sp, &vp->m_start); in eword()
364 vp->m_stop.lno = cs.cs_lno; in eword()
365 vp->m_stop.cno = cs.cs_cno; in eword()
368 * Non-motion commands move to the end of the range. in eword()
371 vp->m_final = ISMOTION(vp) ? vp->m_start : vp->m_stop; in eword()
372 return (0); in eword()
376 * v_WordB -- [count]B
388 * v_wordb -- [count]b
400 * bword --
407 VCS cs; in bword() local
410 cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; in bword()
411 cs.cs_lno = vp->m_start.lno; in bword()
412 cs.cs_cno = vp->m_start.cno; in bword()
413 if (cs_init(sp, &cs)) in bword()
423 if (cs.cs_flags == 0 && !ISBLANK(cs.cs_ch)) { in bword()
424 if (cs_prev(sp, &cs)) in bword()
426 if (cs.cs_flags == 0 && !ISBLANK(cs.cs_ch)) in bword()
429 if (cs_bblank(sp, &cs)) in bword()
433 * Cyclically move to the beginning of the previous word -- this in bword()
435 * non-word characters. Note, for the 'b' command, the definition in bword()
439 while (cnt--) { in bword()
441 if (cs_prev(sp, &cs)) in bword()
443 if (cs.cs_flags == CS_SOF) in bword()
445 if (cs.cs_flags != 0 || ISBLANK(cs.cs_ch)) in bword()
453 if (cnt == 0) { in bword()
454 if (cs.cs_flags == 0 && cs_next(sp, &cs)) in bword()
460 if (cs_bblank(sp, &cs)) in bword()
462 if (cs.cs_flags == CS_SOF) in bword()
466 while (cnt--) { in bword()
467 state = cs.cs_flags == 0 && in bword()
468 inword(cs.cs_ch) ? INWORD : NOTWORD; in bword()
470 if (cs_prev(sp, &cs)) in bword()
472 if (cs.cs_flags == CS_SOF) in bword()
474 if (cs.cs_flags != 0 || ISBLANK(cs.cs_ch)) in bword()
477 if (!inword(cs.cs_ch)) in bword()
480 if (inword(cs.cs_ch)) in bword()
484 if (cnt == 0) { in bword()
485 if (cs.cs_flags == 0 && cs_next(sp, &cs)) in bword()
491 if (cs.cs_flags != 0 || ISBLANK(cs.cs_ch)) in bword()
492 if (cs_bblank(sp, &cs)) in bword()
494 if (cs.cs_flags == CS_SOF) in bword()
499 ret: if (cs.cs_lno == vp->m_start.lno && cs.cs_cno == vp->m_start.cno) { in bword()
500 v_sof(sp, &vp->m_start); in bword()
505 vp->m_stop.lno = cs.cs_lno; in bword()
506 vp->m_stop.cno = cs.cs_cno; in bword()
514 * The historic vi didn't get this right -- the `yb' command yanked in bword()
518 vp->m_final = vp->m_stop; in bword()
520 --vp->m_start.cno; in bword()
521 return (0); in bword()