• Home
  • Raw
  • Download

Lines Matching refs:es

3456 static struct edstate	*es;			/* current editor state */  variable
3510 es = &ebuf; in x_vi()
3511 es->cbuf = buf; in x_vi()
3513 undo->cbufsize = es->cbufsize = len > LINE ? LINE : len; in x_vi()
3515 es->linelen = undo->linelen = 0; in x_vi()
3516 es->cursor = undo->cursor = 0; in x_vi()
3517 es->winleft = undo->winleft = 0; in x_vi()
3575 if (es->linelen == 0) { in x_vi()
3592 if (c == -1 || (ssize_t)len <= es->linelen) in x_vi()
3595 if (es->cbuf != buf) in x_vi()
3596 memmove(buf, es->cbuf, es->linelen); in x_vi()
3598 buf[es->linelen++] = '\n'; in x_vi()
3600 return (es->linelen); in x_vi()
3624 es->cursor--; in vi_hook()
3645 es->cursor = 0; in vi_hook()
3646 es->linelen = 0; in vi_hook()
3656 es->cursor = 0; in vi_hook()
3657 es->linelen = 0; in vi_hook()
3668 del_range(es->cursor, es->cursor + 1); in vi_hook()
3671 es->cbuf[es->cursor++] = ch; in vi_hook()
3754 es->linelen -= char_len((unsigned char)locpat[srchlen]); in vi_hook()
3755 es->cursor = es->linelen; in vi_hook()
3764 es->linelen = 1; in vi_hook()
3765 es->cursor = 1; in vi_hook()
3775 save_es = es; in vi_hook()
3776 es = &new_es; in vi_hook()
3778 es = save_es; in vi_hook()
3781 es->linelen -= char_len((unsigned char)locpat[i]); in vi_hook()
3783 es->cursor = es->linelen; in vi_hook()
3792 if ((size_t)es->linelen + 2 > in vi_hook()
3793 (size_t)es->cbufsize) in vi_hook()
3795 es->cbuf[es->linelen++] = '^'; in vi_hook()
3796 es->cbuf[es->linelen++] = ch ^ '@'; in vi_hook()
3798 if (es->linelen >= es->cbufsize) in vi_hook()
3800 es->cbuf[es->linelen++] = ch; in vi_hook()
3802 es->cursor = es->linelen; in vi_hook()
3897 if (es->cursor == undo->cursor) { in vi_insert()
3903 es->cursor--; in vi_insert()
3904 if (es->cursor >= undo->linelen) in vi_insert()
3905 es->linelen--; in vi_insert()
3907 es->cbuf[es->cursor] = undo->cbuf[es->cursor]; in vi_insert()
3909 if (es->cursor == 0) in vi_insert()
3913 es->cursor--; in vi_insert()
3914 es->linelen--; in vi_insert()
3915 memmove(&es->cbuf[es->cursor], &es->cbuf[es->cursor + 1], in vi_insert()
3916 es->linelen - es->cursor + 1); in vi_insert()
3922 if (es->cursor != 0) { in vi_insert()
3924 memmove(es->cbuf, &es->cbuf[es->cursor], in vi_insert()
3925 es->linelen - es->cursor); in vi_insert()
3926 es->linelen -= es->cursor; in vi_insert()
3927 es->cursor = 0; in vi_insert()
3933 if (es->cursor != 0) { in vi_insert()
3935 memmove(&es->cbuf[tcursor], &es->cbuf[es->cursor], in vi_insert()
3936 es->linelen - es->cursor); in vi_insert()
3937 es->linelen -= es->cursor - tcursor; in vi_insert()
3938 if (inslen < es->cursor - tcursor) in vi_insert()
3941 inslen -= es->cursor - tcursor; in vi_insert()
3942 es->cursor = tcursor; in vi_insert()
3989 print_expansions(es, 0); in vi_insert()
4001 if (es->linelen >= es->cbufsize - 1) in vi_insert()
4005 memmove(&es->cbuf[es->cursor + 1], &es->cbuf[es->cursor], in vi_insert()
4006 es->linelen - es->cursor); in vi_insert()
4007 es->linelen++; in vi_insert()
4009 es->cbuf[es->cursor++] = ch; in vi_insert()
4010 if (insert == REPLACE && es->cursor > es->linelen) in vi_insert()
4011 es->linelen++; in vi_insert()
4030 if (cur == es->linelen && cur != 0) in vi_cmd()
4032 es->cursor = cur; in vi_cmd()
4038 undo->winleft = es->winleft; in vi_cmd()
4039 memmove(undo->cbuf, es->cbuf, es->linelen); in vi_cmd()
4040 undo->linelen = es->linelen; in vi_cmd()
4041 undo->cursor = es->cursor; in vi_cmd()
4096 if (es->linelen != 0) in vi_cmd()
4097 es->cursor++; in vi_cmd()
4105 es->cursor = es->linelen; in vi_cmd()
4110 es->cursor = domove(1, "^", 1); in vi_cmd()
4111 del_range(es->cursor, es->linelen); in vi_cmd()
4125 c2 = es->linelen; in vi_cmd()
4133 !ksh_isspace(es->cbuf[es->cursor])) { in vi_cmd()
4136 } while (ksh_isspace(es->cbuf[ncursor])); in vi_cmd()
4139 if (ncursor > es->cursor) { in vi_cmd()
4140 c1 = es->cursor; in vi_cmd()
4144 c2 = es->cursor; in vi_cmd()
4153 es->cursor = c1; in vi_cmd()
4165 if (es->linelen != 0) in vi_cmd()
4166 es->cursor++; in vi_cmd()
4169 if (es->cursor != 0) in vi_cmd()
4170 es->cursor--; in vi_cmd()
4181 if (any && es->cursor != 0) in vi_cmd()
4182 es->cursor--; in vi_cmd()
4190 del_range(es->cursor, es->linelen); in vi_cmd()
4195 yank_range(es->cursor, es->linelen); in vi_cmd()
4196 del_range(es->cursor, es->linelen); in vi_cmd()
4197 if (es->cursor != 0) in vi_cmd()
4198 es->cursor--; in vi_cmd()
4227 es->cursor = domove(1, "^", 1); in vi_cmd()
4254 if (es->linelen == 0) in vi_cmd()
4263 if (es->cursor + argcnt > es->linelen) in vi_cmd()
4266 es->cbuf[es->cursor + n] = cmd[1]; in vi_cmd()
4267 es->cursor += n - 1; in vi_cmd()
4278 if (es->linelen == 0) in vi_cmd()
4282 if (es->cursor + argcnt > es->linelen) in vi_cmd()
4283 argcnt = es->linelen - es->cursor; in vi_cmd()
4284 del_range(es->cursor, es->cursor + argcnt); in vi_cmd()
4290 if (es->linelen == 0) in vi_cmd()
4293 es->cbuf[es->linelen] = '\0'; in vi_cmd()
4294 histsave(&source->line, es->cbuf, true, in vi_cmd()
4301 shf_snprintf(es->cbuf, es->cbufsize, "%s %d", in vi_cmd()
4305 strlcpy(es->cbuf, in vi_cmd()
4307 es->cbufsize); in vi_cmd()
4308 es->linelen = strlen(es->cbuf); in vi_cmd()
4312 if (es->linelen == 0) in vi_cmd()
4316 if (es->cursor + argcnt > es->linelen) in vi_cmd()
4317 argcnt = es->linelen - es->cursor; in vi_cmd()
4318 yank_range(es->cursor, es->cursor + argcnt); in vi_cmd()
4319 del_range(es->cursor, es->cursor + argcnt); in vi_cmd()
4323 if (es->cursor > 0) { in vi_cmd()
4326 if (es->cursor < argcnt) in vi_cmd()
4327 argcnt = es->cursor; in vi_cmd()
4328 yank_range(es->cursor - argcnt, es->cursor); in vi_cmd()
4329 del_range(es->cursor - argcnt, es->cursor); in vi_cmd()
4330 es->cursor -= argcnt; in vi_cmd()
4336 t = es; in vi_cmd()
4337 es = undo; in vi_cmd()
4419 if (es->cursor != es->linelen) in vi_cmd()
4420 es->cursor++; in vi_cmd()
4427 if (es->cursor != 0) in vi_cmd()
4428 es->cursor--; in vi_cmd()
4440 if (es->linelen == 0) in vi_cmd()
4443 p = &es->cbuf[es->cursor]; in vi_cmd()
4453 if (es->cursor < es->linelen - 1) in vi_cmd()
4454 es->cursor++; in vi_cmd()
4461 int ret = x_do_comment(es->cbuf, es->cbufsize, in vi_cmd()
4462 &es->linelen); in vi_cmd()
4464 es->cursor = 0; in vi_cmd()
4472 print_expansions(es, 1); in vi_cmd()
4502 if (insert == 0 && es->cursor != 0 && es->cursor >= es->linelen) in vi_cmd()
4503 es->cursor--; in vi_cmd()
4516 if (!sub && es->cursor == 0) in domove()
4522 if (!sub && es->cursor == 0) in domove()
4528 if (!sub && es->cursor + 1 >= es->linelen) in domove()
4531 if (sub && ncursor < es->linelen) in domove()
4536 if (!sub && es->cursor + 1 >= es->linelen) in domove()
4539 if (sub && ncursor < es->linelen) in domove()
4567 if (!sub && es->cursor == 0) in domove()
4569 ncursor = es->cursor - argcnt; in domove()
4576 if (!sub && es->cursor + 1 >= es->linelen) in domove()
4578 if (es->linelen != 0) { in domove()
4579 ncursor = es->cursor + argcnt; in domove()
4580 if (ncursor > es->linelen) in domove()
4581 ncursor = es->linelen; in domove()
4586 if (!sub && es->cursor + 1 >= es->linelen) in domove()
4592 if (!sub && es->cursor + 1 >= es->linelen) in domove()
4603 while (ncursor < es->linelen - 1 && in domove()
4604 ksh_isspace(es->cbuf[ncursor])) in domove()
4610 if (ncursor > es->linelen) in domove()
4611 ncursor = es->linelen; in domove()
4617 if (es->linelen != 0) in domove()
4618 ncursor = es->linelen; in domove()
4624 ncursor = es->cursor; in domove()
4625 while (ncursor < es->linelen && in domove()
4626 (i = bracktype(es->cbuf[ncursor])) == 0) in domove()
4628 if (ncursor == es->linelen) in domove()
4633 if (++ncursor >= es->linelen) in domove()
4639 t = bracktype(es->cbuf[ncursor]); in domove()
4661 if (es->cursor > 0) in redo_insert()
4662 es->cursor--; in redo_insert()
4672 memmove(ybuf, &es->cbuf[a], yanklen); in yank_range()
4710 memmove(holdbuf, es->cbuf, es->linelen); in save_cbuf()
4711 holdlen = es->linelen; in save_cbuf()
4718 es->cursor = 0; in restore_cbuf()
4719 es->linelen = holdlen; in restore_cbuf()
4720 memmove(es->cbuf, holdbuf, holdlen); in restore_cbuf()
4771 if (es->cursor + len >= es->cbufsize) in putbuf()
4773 if (es->cursor + len > es->linelen) in putbuf()
4774 es->linelen = es->cursor + len; in putbuf()
4776 if (es->linelen + len >= es->cbufsize) in putbuf()
4778 memmove(&es->cbuf[es->cursor + len], &es->cbuf[es->cursor], in putbuf()
4779 es->linelen - es->cursor); in putbuf()
4780 es->linelen += len; in putbuf()
4782 memmove(&es->cbuf[es->cursor], buf, len); in putbuf()
4783 es->cursor += len; in putbuf()
4790 if (es->linelen != b) in del_range()
4791 memmove(&es->cbuf[a], &es->cbuf[b], es->linelen - b); in del_range()
4792 es->linelen -= b - a; in del_range()
4800 if (es->linelen == 0) in findch()
4802 ncursor = es->cursor; in findch()
4806 if (++ncursor == es->linelen) in findch()
4812 } while (es->cbuf[ncursor] != ch); in findch()
4828 ncursor = es->cursor; in forwword()
4829 while (ncursor < es->linelen && argcnt--) { in forwword()
4830 if (ksh_isalnux(es->cbuf[ncursor])) in forwword()
4831 while (ksh_isalnux(es->cbuf[ncursor]) && in forwword()
4832 ncursor < es->linelen) in forwword()
4834 else if (!ksh_isspace(es->cbuf[ncursor])) in forwword()
4835 while (!ksh_isalnux(es->cbuf[ncursor]) && in forwword()
4836 !ksh_isspace(es->cbuf[ncursor]) && in forwword()
4837 ncursor < es->linelen) in forwword()
4839 while (ksh_isspace(es->cbuf[ncursor]) && in forwword()
4840 ncursor < es->linelen) in forwword()
4851 ncursor = es->cursor; in backword()
4853 while (--ncursor > 0 && ksh_isspace(es->cbuf[ncursor])) in backword()
4856 if (ksh_isalnux(es->cbuf[ncursor])) in backword()
4858 ksh_isalnux(es->cbuf[ncursor])) in backword()
4862 !ksh_isalnux(es->cbuf[ncursor]) && in backword()
4863 !ksh_isspace(es->cbuf[ncursor])) in backword()
4876 ncursor = es->cursor; in endword()
4877 while (ncursor < es->linelen && argcnt--) { in endword()
4878 while (++ncursor < es->linelen - 1 && in endword()
4879 ksh_isspace(es->cbuf[ncursor])) in endword()
4881 if (ncursor < es->linelen - 1) { in endword()
4882 if (ksh_isalnux(es->cbuf[ncursor])) in endword()
4883 while (++ncursor < es->linelen && in endword()
4884 ksh_isalnux(es->cbuf[ncursor])) in endword()
4887 while (++ncursor < es->linelen && in endword()
4888 !ksh_isalnux(es->cbuf[ncursor]) && in endword()
4889 !ksh_isspace(es->cbuf[ncursor])) in endword()
4902 ncursor = es->cursor; in Forwword()
4903 while (ncursor < es->linelen && argcnt--) { in Forwword()
4904 while (!ksh_isspace(es->cbuf[ncursor]) && in Forwword()
4905 ncursor < es->linelen) in Forwword()
4907 while (ksh_isspace(es->cbuf[ncursor]) && in Forwword()
4908 ncursor < es->linelen) in Forwword()
4919 ncursor = es->cursor; in Backword()
4921 while (--ncursor >= 0 && ksh_isspace(es->cbuf[ncursor])) in Backword()
4923 while (ncursor >= 0 && !ksh_isspace(es->cbuf[ncursor])) in Backword()
4935 ncursor = es->cursor; in Endword()
4936 while (ncursor < es->linelen - 1 && argcnt--) { in Endword()
4937 while (++ncursor < es->linelen - 1 && in Endword()
4938 ksh_isspace(es->cbuf[ncursor])) in Endword()
4940 if (ncursor < es->linelen - 1) { in Endword()
4941 while (++ncursor < es->linelen && in Endword()
4942 !ksh_isspace(es->cbuf[ncursor])) in Endword()
4969 if ((es->linelen = strlen(hptr)) >= es->cbufsize) in grabhist()
4970 es->linelen = es->cbufsize - 1; in grabhist()
4971 memmove(es->cbuf, hptr, es->linelen); in grabhist()
4972 es->cursor = 0; in grabhist()
5003 if ((es->linelen = strlen(hptr)) >= es->cbufsize) in grabsearch()
5004 es->linelen = es->cbufsize - 1; in grabsearch()
5005 memmove(es->cbuf, hptr, es->linelen); in grabsearch()
5006 es->cursor = 0; in grabsearch()
5043 if (es->cursor < es->winleft) in outofwin()
5046 cur = es->winleft; in outofwin()
5047 while (cur < es->cursor) in outofwin()
5048 col = newcol((unsigned char)es->cbuf[cur++], col); in outofwin()
5063 while (tcur < es->cursor) { in rewindow()
5070 tcol = newcol((unsigned char)es->cbuf[tcur++], tcol); in rewindow()
5073 holdcol1 = newcol((unsigned char)es->cbuf[holdcur1++], in rewindow()
5075 es->winleft = holdcur1; in rewindow()
5096 cur = es->winleft; in display()
5099 while (col < winwidth && cur < es->linelen) { in display()
5100 if (cur == es->cursor && leftside) in display()
5102 if ((ch = es->cbuf[cur]) == '\t') in display()
5118 if (cur == es->cursor && !leftside) in display()
5122 if (cur == es->cursor) in display()
5148 if (es->winleft > 0 && moreright) in display()
5154 else if (es->winleft > 0) in display()
5204 restore_edstate(es, buf); in expand_word()
5215 nwords = x_cf_glob(&i, es->cbuf, es->linelen, es->cursor, in expand_word()
5222 buf = save_edstate(es); in expand_word()
5225 es->cursor = start; in expand_word()
5239 es->cursor += i; in expand_word()
5265 restore_edstate(es, buf); in complete_word()
5282 nwords = x_cf_glob(&flags, es->cbuf, es->linelen, es->cursor, in complete_word()
5327 buf = save_edstate(es); in complete_word()
5329 es->cursor = start; in complete_word()