Lines Matching refs:es
3456 static struct edstate *es; /* current editor state */ variable
3520 es = &ebuf; in x_vi()
3568 if (es->linelen == 0) { in x_vi()
3585 if (c == -1 || (ssize_t)LINE <= es->linelen) in x_vi()
3588 if (es->cbuf != buf) in x_vi()
3589 memcpy(buf, es->cbuf, es->linelen); in x_vi()
3591 buf[es->linelen++] = '\n'; in x_vi()
3593 return (es->linelen); in x_vi()
3617 es->cursor--; in vi_hook()
3638 es->cursor = 0; in vi_hook()
3639 es->linelen = 0; in vi_hook()
3647 es->cursor = 0; in vi_hook()
3648 es->linelen = 0; in vi_hook()
3659 del_range(es->cursor, es->cursor + 1); in vi_hook()
3662 es->cbuf[es->cursor++] = ch; in vi_hook()
3745 es->linelen -= char_len(locpat[srchlen]); in vi_hook()
3746 es->cursor = es->linelen; in vi_hook()
3755 es->linelen = 1; in vi_hook()
3756 es->cursor = 1; in vi_hook()
3766 save_es = es; in vi_hook()
3767 es = &new_es; in vi_hook()
3769 es = save_es; in vi_hook()
3773 es->linelen -= char_len(locpat[i]); in vi_hook()
3775 es->cursor = es->linelen; in vi_hook()
3784 if ((size_t)es->linelen + 2 > in vi_hook()
3785 (size_t)es->cbufsize) in vi_hook()
3787 es->cbuf[es->linelen++] = '^'; in vi_hook()
3788 es->cbuf[es->linelen++] = UNCTRL(ch); in vi_hook()
3790 if (es->linelen >= es->cbufsize) in vi_hook()
3792 es->cbuf[es->linelen++] = ch; in vi_hook()
3794 es->cursor = es->linelen; in vi_hook()
3806 if (!es->cursor) in vi_hook()
3809 if ((size_t)es->cursor >= sizeof(srchpat) - 1) in vi_hook()
3810 es->cursor = sizeof(srchpat) - 2; in vi_hook()
3814 memmove(srchpat + 1, es->cbuf, es->cursor); in vi_hook()
3815 srchpat[es->cursor + 1] = '\0'; in vi_hook()
3817 argc1 = 2 + (int)es->cursor; in vi_hook()
3914 if (es->cursor == undo->cursor) { in vi_insert()
3920 es->cursor--; in vi_insert()
3921 if (es->cursor >= undo->linelen) in vi_insert()
3922 es->linelen--; in vi_insert()
3924 es->cbuf[es->cursor] = undo->cbuf[es->cursor]; in vi_insert()
3926 if (es->cursor == 0) in vi_insert()
3930 es->cursor--; in vi_insert()
3931 es->linelen--; in vi_insert()
3932 memmove(&es->cbuf[es->cursor], &es->cbuf[es->cursor + 1], in vi_insert()
3933 es->linelen - es->cursor + 1); in vi_insert()
3939 if (es->cursor != 0) { in vi_insert()
3941 memmove(es->cbuf, &es->cbuf[es->cursor], in vi_insert()
3942 es->linelen - es->cursor); in vi_insert()
3943 es->linelen -= es->cursor; in vi_insert()
3944 es->cursor = 0; in vi_insert()
3950 if (es->cursor != 0) { in vi_insert()
3952 memmove(&es->cbuf[tcursor], &es->cbuf[es->cursor], in vi_insert()
3953 es->linelen - es->cursor); in vi_insert()
3954 es->linelen -= es->cursor - tcursor; in vi_insert()
3955 if (inslen < es->cursor - tcursor) in vi_insert()
3958 inslen -= es->cursor - tcursor; in vi_insert()
3959 es->cursor = tcursor; in vi_insert()
4006 print_expansions(es, 0); in vi_insert()
4018 if (es->linelen >= es->cbufsize - 1) in vi_insert()
4022 memmove(&es->cbuf[es->cursor + 1], &es->cbuf[es->cursor], in vi_insert()
4023 es->linelen - es->cursor); in vi_insert()
4024 es->linelen++; in vi_insert()
4026 es->cbuf[es->cursor++] = ch; in vi_insert()
4027 if (insert == REPLACE && es->cursor > es->linelen) in vi_insert()
4028 es->linelen++; in vi_insert()
4047 if (cur == es->linelen && cur != 0) in vi_cmd()
4049 es->cursor = cur; in vi_cmd()
4055 undo->winleft = es->winleft; in vi_cmd()
4056 memmove(undo->cbuf, es->cbuf, es->linelen); in vi_cmd()
4057 undo->linelen = es->linelen; in vi_cmd()
4058 undo->cursor = es->cursor; in vi_cmd()
4113 if (es->linelen != 0) in vi_cmd()
4114 es->cursor++; in vi_cmd()
4122 es->cursor = es->linelen; in vi_cmd()
4127 es->cursor = domove(1, "^", 1); in vi_cmd()
4128 del_range(es->cursor, es->linelen); in vi_cmd()
4142 c2 = es->linelen; in vi_cmd()
4150 !ksh_isspace(es->cbuf[es->cursor])) { in vi_cmd()
4153 } while (ksh_isspace(es->cbuf[ncursor])); in vi_cmd()
4156 if (ncursor > es->cursor) { in vi_cmd()
4157 c1 = es->cursor; in vi_cmd()
4161 c2 = es->cursor; in vi_cmd()
4170 es->cursor = c1; in vi_cmd()
4182 if (es->linelen != 0) in vi_cmd()
4183 es->cursor++; in vi_cmd()
4187 if (es->cursor != 0) in vi_cmd()
4188 es->cursor--; in vi_cmd()
4200 if (any && es->cursor != 0) in vi_cmd()
4201 es->cursor--; in vi_cmd()
4209 del_range(es->cursor, es->linelen); in vi_cmd()
4214 yank_range(es->cursor, es->linelen); in vi_cmd()
4215 del_range(es->cursor, es->linelen); in vi_cmd()
4216 if (es->cursor != 0) in vi_cmd()
4217 es->cursor--; in vi_cmd()
4246 es->cursor = domove(1, "^", 1); in vi_cmd()
4273 if (es->linelen == 0) in vi_cmd()
4282 if (es->cursor + argcnt > es->linelen) in vi_cmd()
4285 es->cbuf[es->cursor + n] = cmd[1]; in vi_cmd()
4286 es->cursor += n - 1; in vi_cmd()
4297 if (es->linelen == 0) in vi_cmd()
4301 if (es->cursor + argcnt > es->linelen) in vi_cmd()
4302 argcnt = es->linelen - es->cursor; in vi_cmd()
4303 del_range(es->cursor, es->cursor + argcnt); in vi_cmd()
4309 if (es->linelen == 0) in vi_cmd()
4312 es->cbuf[es->linelen] = '\0'; in vi_cmd()
4313 histsave(&source->line, es->cbuf, true, in vi_cmd()
4320 shf_snprintf(es->cbuf, es->cbufsize, "%s %d", in vi_cmd()
4324 strlcpy(es->cbuf, in vi_cmd()
4326 es->cbufsize); in vi_cmd()
4327 es->linelen = strlen(es->cbuf); in vi_cmd()
4331 if (es->linelen == 0) in vi_cmd()
4335 if (es->cursor + argcnt > es->linelen) in vi_cmd()
4336 argcnt = es->linelen - es->cursor; in vi_cmd()
4337 yank_range(es->cursor, es->cursor + argcnt); in vi_cmd()
4338 del_range(es->cursor, es->cursor + argcnt); in vi_cmd()
4342 if (es->cursor > 0) { in vi_cmd()
4345 if (es->cursor < argcnt) in vi_cmd()
4346 argcnt = es->cursor; in vi_cmd()
4347 yank_range(es->cursor - argcnt, es->cursor); in vi_cmd()
4348 del_range(es->cursor - argcnt, es->cursor); in vi_cmd()
4349 es->cursor -= argcnt; in vi_cmd()
4355 t = es; in vi_cmd()
4356 es = undo; in vi_cmd()
4402 es->cursor = argcnt - 2; in vi_cmd()
4443 if (es->cursor != es->linelen) in vi_cmd()
4444 es->cursor++; in vi_cmd()
4451 if (es->cursor != 0) in vi_cmd()
4452 es->cursor--; in vi_cmd()
4464 if (es->linelen == 0) in vi_cmd()
4467 p = &es->cbuf[es->cursor]; in vi_cmd()
4477 if (es->cursor < es->linelen - 1) in vi_cmd()
4478 es->cursor++; in vi_cmd()
4485 int ret = x_do_comment(es->cbuf, es->cbufsize, in vi_cmd()
4486 &es->linelen); in vi_cmd()
4488 es->cursor = 0; in vi_cmd()
4496 print_expansions(es, 1); in vi_cmd()
4531 if (es->linelen != 0) in vi_cmd()
4532 es->cursor++; in vi_cmd()
4536 if (insert == 0 && es->cursor != 0 && es->cursor >= es->linelen) in vi_cmd()
4537 es->cursor--; in vi_cmd()
4550 if (!sub && es->cursor == 0) in domove()
4556 if (!sub && es->cursor == 0) in domove()
4562 if (!sub && es->cursor + 1 >= es->linelen) in domove()
4565 if (sub && ncursor < es->linelen) in domove()
4570 if (!sub && es->cursor + 1 >= es->linelen) in domove()
4573 if (sub && ncursor < es->linelen) in domove()
4602 if (!sub && es->cursor == 0) in domove()
4604 ncursor = es->cursor - argcnt; in domove()
4611 if (!sub && es->cursor + 1 >= es->linelen) in domove()
4613 if (es->linelen != 0) { in domove()
4614 ncursor = es->cursor + argcnt; in domove()
4615 if (ncursor > es->linelen) in domove()
4616 ncursor = es->linelen; in domove()
4621 if (!sub && es->cursor + 1 >= es->linelen) in domove()
4627 if (!sub && es->cursor + 1 >= es->linelen) in domove()
4638 while (ncursor < es->linelen - 1 && in domove()
4639 ksh_isspace(es->cbuf[ncursor])) in domove()
4645 if (ncursor > es->linelen) in domove()
4646 ncursor = es->linelen; in domove()
4652 if (es->linelen != 0) in domove()
4653 ncursor = es->linelen; in domove()
4659 ncursor = es->cursor; in domove()
4660 while (ncursor < es->linelen && in domove()
4661 (i = bracktype(es->cbuf[ncursor])) == 0) in domove()
4663 if (ncursor == es->linelen) in domove()
4668 if (++ncursor >= es->linelen) in domove()
4674 t = bracktype(es->cbuf[ncursor]); in domove()
4696 if (es->cursor > 0) in redo_insert()
4697 es->cursor--; in redo_insert()
4707 memmove(ybuf, &es->cbuf[a], yanklen); in yank_range()
4745 memmove(holdbufp, es->cbuf, es->linelen); in save_cbuf()
4746 holdlen = es->linelen; in save_cbuf()
4753 es->cursor = 0; in restore_cbuf()
4754 es->linelen = holdlen; in restore_cbuf()
4755 memmove(es->cbuf, holdbufp, holdlen); in restore_cbuf()
4806 if (es->cursor + len >= es->cbufsize) in putbuf()
4808 if (es->cursor + len > es->linelen) in putbuf()
4809 es->linelen = es->cursor + len; in putbuf()
4811 if (es->linelen + len >= es->cbufsize) in putbuf()
4813 memmove(&es->cbuf[es->cursor + len], &es->cbuf[es->cursor], in putbuf()
4814 es->linelen - es->cursor); in putbuf()
4815 es->linelen += len; in putbuf()
4817 memmove(&es->cbuf[es->cursor], buf, len); in putbuf()
4818 es->cursor += len; in putbuf()
4825 if (es->linelen != b) in del_range()
4826 memmove(&es->cbuf[a], &es->cbuf[b], es->linelen - b); in del_range()
4827 es->linelen -= b - a; in del_range()
4835 if (es->linelen == 0) in findch()
4837 ncursor = es->cursor; in findch()
4841 if (++ncursor == es->linelen) in findch()
4847 } while (es->cbuf[ncursor] != ch); in findch()
4863 ncursor = es->cursor; in forwword()
4864 while (ncursor < es->linelen && argcnt--) { in forwword()
4865 if (ksh_isalnux(es->cbuf[ncursor])) in forwword()
4866 while (ksh_isalnux(es->cbuf[ncursor]) && in forwword()
4867 ncursor < es->linelen) in forwword()
4869 else if (!ksh_isspace(es->cbuf[ncursor])) in forwword()
4870 while (!ksh_isalnux(es->cbuf[ncursor]) && in forwword()
4871 !ksh_isspace(es->cbuf[ncursor]) && in forwword()
4872 ncursor < es->linelen) in forwword()
4874 while (ksh_isspace(es->cbuf[ncursor]) && in forwword()
4875 ncursor < es->linelen) in forwword()
4886 ncursor = es->cursor; in backword()
4888 while (--ncursor > 0 && ksh_isspace(es->cbuf[ncursor])) in backword()
4891 if (ksh_isalnux(es->cbuf[ncursor])) in backword()
4893 ksh_isalnux(es->cbuf[ncursor])) in backword()
4897 !ksh_isalnux(es->cbuf[ncursor]) && in backword()
4898 !ksh_isspace(es->cbuf[ncursor])) in backword()
4911 ncursor = es->cursor; in endword()
4912 while (ncursor < es->linelen && argcnt--) { in endword()
4913 while (++ncursor < es->linelen - 1 && in endword()
4914 ksh_isspace(es->cbuf[ncursor])) in endword()
4916 if (ncursor < es->linelen - 1) { in endword()
4917 if (ksh_isalnux(es->cbuf[ncursor])) in endword()
4918 while (++ncursor < es->linelen && in endword()
4919 ksh_isalnux(es->cbuf[ncursor])) in endword()
4922 while (++ncursor < es->linelen && in endword()
4923 !ksh_isalnux(es->cbuf[ncursor]) && in endword()
4924 !ksh_isspace(es->cbuf[ncursor])) in endword()
4937 ncursor = es->cursor; in Forwword()
4938 while (ncursor < es->linelen && argcnt--) { in Forwword()
4939 while (!ksh_isspace(es->cbuf[ncursor]) && in Forwword()
4940 ncursor < es->linelen) in Forwword()
4942 while (ksh_isspace(es->cbuf[ncursor]) && in Forwword()
4943 ncursor < es->linelen) in Forwword()
4954 ncursor = es->cursor; in Backword()
4956 while (--ncursor >= 0 && ksh_isspace(es->cbuf[ncursor])) in Backword()
4958 while (ncursor >= 0 && !ksh_isspace(es->cbuf[ncursor])) in Backword()
4970 ncursor = es->cursor; in Endword()
4971 while (ncursor < es->linelen - 1 && argcnt--) { in Endword()
4972 while (++ncursor < es->linelen - 1 && in Endword()
4973 ksh_isspace(es->cbuf[ncursor])) in Endword()
4975 if (ncursor < es->linelen - 1) { in Endword()
4976 while (++ncursor < es->linelen && in Endword()
4977 !ksh_isspace(es->cbuf[ncursor])) in Endword()
5004 if ((es->linelen = strlen(hptr)) >= es->cbufsize) in grabhist()
5005 es->linelen = es->cbufsize - 1; in grabhist()
5006 memmove(es->cbuf, hptr, es->linelen); in grabhist()
5007 es->cursor = 0; in grabhist()
5038 if ((es->linelen = strlen(hptr)) >= es->cbufsize) in grabsearch()
5039 es->linelen = es->cbufsize - 1; in grabsearch()
5040 memmove(es->cbuf, hptr, es->linelen); in grabsearch()
5041 es->cursor = 0; in grabsearch()
5078 if (es->cursor < es->winleft) in outofwin()
5081 cur = es->winleft; in outofwin()
5082 while (cur < es->cursor) in outofwin()
5083 col = newcol((unsigned char)es->cbuf[cur++], col); in outofwin()
5098 while (tcur < es->cursor) { in rewindow()
5105 tcol = newcol((unsigned char)es->cbuf[tcur++], tcol); in rewindow()
5108 holdcol1 = newcol((unsigned char)es->cbuf[holdcur1++], in rewindow()
5110 es->winleft = holdcur1; in rewindow()
5131 cur = es->winleft; in display()
5134 while (col < winwidth && cur < es->linelen) { in display()
5135 if (cur == es->cursor && leftside) in display()
5137 if ((ch = es->cbuf[cur]) == '\t') in display()
5153 if (cur == es->cursor && !leftside) in display()
5157 if (cur == es->cursor) in display()
5183 if (es->winleft > 0 && moreright) in display()
5189 else if (es->winleft > 0) in display()
5239 restore_edstate(es, buf); in expand_word()
5250 nwords = x_cf_glob(&i, es->cbuf, es->linelen, es->cursor, in expand_word()
5257 buf = save_edstate(es); in expand_word()
5260 es->cursor = start; in expand_word()
5274 es->cursor += i; in expand_word()
5300 restore_edstate(es, buf); in complete_word()
5317 nwords = x_cf_glob(&flags, es->cbuf, es->linelen, es->cursor, in complete_word()
5362 buf = save_edstate(es); in complete_word()
5364 es->cursor = start; in complete_word()