Lines Matching defs:buff_curpos

213   int buff_curpos;   /* The historical location of the cursor in */
418 int buff_curpos; /* The cursor position within gl->line[] */
912 static int gl_place_cursor(GetLine *gl, int buff_curpos);
1792 gl->buff_curpos = 0;
1817 gl->vi.undo.buff_curpos = 0;
2957 int buff_curpos = gl->buff_curpos;
2969 if((gl->insert || buff_curpos >= gl->ntotal) && gl->ntotal >= gl->linelen)
2974 if(gl->insert || buff_curpos >= gl->ntotal) {
2978 if(buff_curpos < gl->ntotal)
2979 gl_make_gap_in_buffer(gl, buff_curpos, 1);
2983 gl_buffer_char(gl, c, buff_curpos);
2984 gl->buff_curpos++;
2989 if(gl_print_string(gl, gl->line + buff_curpos, '\0') ||
2999 int old_width = gl_displayed_char_width(gl, gl->line[buff_curpos],
3004 gl_buffer_char(gl, c, buff_curpos);
3012 if(gl_print_string(gl, gl->line + buff_curpos, '\0'))
3024 gl->buff_curpos++;
3034 if(gl_print_string(gl, gl->line + buff_curpos, '\0') ||
3037 gl->buff_curpos++;
3046 gl_buffer_char(gl, c, buff_curpos);
3047 gl->buff_curpos++;
3051 if(gl_print_char(gl, c, gl->line[gl->buff_curpos]))
3073 int buff_curpos; /* The original value of gl->buff_curpos */
3078 buff_curpos = gl->buff_curpos;
3096 if(gl->ntotal > gl->buff_curpos)
3097 gl_make_gap_in_buffer(gl, gl->buff_curpos, buff_slen);
3101 gl_buffer_string(gl, s, buff_slen, gl->buff_curpos);
3102 gl->buff_curpos += buff_slen;
3107 if(gl_print_string(gl, gl->line + buff_curpos, '\0') ||
4192 return gl_place_cursor(gl, gl->buff_curpos - count);
4201 return gl_place_cursor(gl, gl->buff_curpos + count);
4278 strlcpy(gl->cutbuf, gl->line + gl->buff_curpos, gl->linelen);
4282 gl_truncate_buffer(gl, gl->buff_curpos);
4292 return gl_place_cursor(gl, gl->buff_curpos);
4304 int nc = gl->buff_curpos - gl->insert_curpos;
4364 if(gl->buff_curpos + nc > gl->ntotal)
4365 nc = gl->ntotal - gl->buff_curpos;
4370 memcpy(gl->cutbuf, gl->line + gl->buff_curpos, nc);
4387 int nrestore = gl->buff_curpos + nc <= gl->vi.undo.ntotal ?
4388 nc : gl->vi.undo.ntotal - gl->buff_curpos;
4393 gl_buffer_string(gl, gl->vi.undo.line + gl->buff_curpos, nrestore,
4394 gl->buff_curpos);
4404 gl_truncate_buffer(gl, (gl->vi.undo.ntotal > gl->buff_curpos) ?
4405 gl->vi.undo.ntotal : gl->buff_curpos);
4411 gl_remove_from_buffer(gl, gl->buff_curpos, nc);
4416 if(gl_print_string(gl, gl->line + gl->buff_curpos, '\0'))
4426 return gl_place_cursor(gl, gl->buff_curpos);
4451 if(count > gl->buff_curpos - gl->insert_curpos)
4452 count = gl->buff_curpos - gl->insert_curpos;
4467 if (--count >= gl->buff_curpos)
4468 return gl_forward_delete_char(gl, count - gl->buff_curpos, NULL);
4470 return gl_backward_delete_char(gl, gl->buff_curpos - count, NULL);
4482 if(curpos >= gl->buff_curpos)
4483 return gl_forward_delete_char(gl, curpos - gl->buff_curpos + 1, NULL);
4485 return gl_backward_delete_char(gl, ++gl->buff_curpos - curpos + 1, NULL);
4507 gl_nth_word_end_forward(gl,count) - gl->buff_curpos + 1, 1);
4510 gl_nth_word_start_forward(gl,count) - gl->buff_curpos,
4524 int buff_curpos = gl->buff_curpos;
4538 return gl_delete_chars(gl, buff_curpos - gl->buff_curpos,
4588 if(gl_delete_chars(gl, pos - gl->buff_curpos + 1, 1))
4591 int buff_curpos = gl->buff_curpos;
4593 gl_delete_chars(gl, buff_curpos - gl->buff_curpos, 1))
4678 while(gl->buff_curpos <= last) {
4679 char *cptr = gl->line + gl->buff_curpos;
4684 gl_buffer_char(gl, toupper((int) *cptr), gl->buff_curpos);
4685 gl->buff_curpos++;
4693 return gl_place_cursor(gl, gl->buff_curpos); /* bounds check */
4714 while(gl->buff_curpos <= last) {
4715 char *cptr = gl->line + gl->buff_curpos;
4720 gl_buffer_char(gl, tolower((int) *cptr), gl->buff_curpos);
4721 gl->buff_curpos++;
4729 return gl_place_cursor(gl, gl->buff_curpos); /* bounds check */
4739 char *cptr; /* &gl->line[gl->buff_curpos] */
4758 for(i=0; i<count && gl->buff_curpos < gl->ntotal; i++) {
4759 int pos = gl->buff_curpos;
4775 for(first=1; gl->buff_curpos<gl->ntotal && gl_is_word_char((int) *cptr);
4776 gl->buff_curpos++, cptr++) {
4800 return gl_place_cursor(gl, gl->buff_curpos); /* bounds check */
4811 int buff_curpos = gl->buff_curpos;
4835 if(gl_place_cursor(gl, buff_curpos))
4882 if(gl->buff_curpos < 1 || gl->buff_curpos >= gl->ntotal)
4892 from[0] = gl->line[gl->buff_curpos - 1];
4893 from[1] = gl->line[gl->buff_curpos];
4895 swap[0] = gl->line[gl->buff_curpos];
4896 swap[1] = gl->line[gl->buff_curpos - 1];
4901 if(gl_place_cursor(gl, gl->buff_curpos-1))
4906 gl_buffer_char(gl, swap[0], gl->buff_curpos);
4907 gl_buffer_char(gl, swap[1], gl->buff_curpos+1);
4918 gl_print_char(gl, swap[1], gl->line[gl->buff_curpos+2]))
4926 if(gl_print_string(gl, gl->line + gl->buff_curpos, '\0') ||
4933 return gl_place_cursor(gl, gl->buff_curpos + 2);
4942 gl->buff_mark = gl->buff_curpos;
4960 gl->buff_mark = gl->buff_curpos;
4987 if(gl->buff_mark == gl->buff_curpos) {
4994 if(gl->buff_mark < gl->buff_curpos && gl_exchange_point_and_mark(gl,1,NULL))
4999 if(gl_delete_chars(gl, gl->buff_mark - gl->buff_curpos, 1))
5004 gl->buff_mark = gl->buff_curpos;
5024 if(mark == gl->buff_curpos) {
5031 if(mark < gl->buff_curpos) {
5033 cb = gl->buff_curpos - 1;
5035 ca = gl->buff_curpos;
5056 gl->buff_mark = gl->buff_curpos;
5099 gl->buff_mark = gl->buff_curpos + 1;
5266 gl->buff_curpos = gl->ntotal;
5321 gl->buff_curpos = gl->ntotal;
5358 _glh_search_prefix(gl->glh, gl->line, gl->buff_curpos +
5376 gl->buff_curpos = gl->ntotal;
5420 _glh_search_prefix(gl->glh, gl->line, gl->buff_curpos +
5437 gl->buff_curpos = gl->ntotal;
5496 buff_pos = gl->buff_curpos;
5500 matches = cpl_complete_word(gl->cpl, gl->line, gl->buff_curpos, cb->data,
5550 gl_make_gap_in_buffer(gl, gl->buff_curpos, nextra);
5554 gl_buffer_string(gl, matches->suffix, suffix_len, gl->buff_curpos);
5559 gl->buff_curpos + suffix_len);
5563 gl->buff_curpos += nextra;
5572 gl_place_cursor(gl, gl->buff_curpos))
5619 start_path = _pu_start_of_path(gl->line, gl->buff_curpos);
5625 pathlen = gl->buff_curpos - (start_path - gl->line);
5680 gl_make_gap_in_buffer(gl, gl->buff_curpos, nextra);
5682 gl->buff_curpos += nextra;
5683 gl_remove_from_buffer(gl, gl->buff_curpos, -nextra);
5732 start_path = _pu_start_of_path(gl->line, gl->buff_curpos);
5738 pathlen = gl->buff_curpos - (start_path - gl->line);
6077 } else if(gl->buff_curpos >= gl->ntotal) {
6133 CplMatches *matches = cpl_complete_word(gl->cpl, gl->line, gl->buff_curpos,
6585 start_path = _pu_start_of_path(gl->line, gl->buff_curpos);
6591 pathlen = gl->buff_curpos - (start_path - gl->line);
6701 gl->buff_curpos = gl->ntotal;
6741 gl->buff_curpos = gl->ntotal;
6999 gl->insert_curpos = gl->buff_curpos;
7018 gl->insert_curpos = gl->buff_curpos;
7045 for(i=0; i<count && gl->buff_curpos < gl->ntotal; i++) {
7046 char *cptr = gl->line + gl->buff_curpos++;
7065 return gl_place_cursor(gl, gl->buff_curpos); /* bounds check */
7140 if(gl->ntotal - gl->buff_curpos >= count) {
7161 return gl_place_cursor(gl, gl->buff_curpos); /* bounds check */
7202 if(gl->buff_curpos + count >= gl->ntotal)
7203 count = gl->ntotal - gl->buff_curpos;
7209 memcpy(gl->cutbuf, gl->line + gl->buff_curpos, count);
7224 if(count > gl->buff_curpos)
7225 count = gl->buff_curpos;
7228 gl_place_cursor(gl, gl->buff_curpos - count);
7232 memcpy(gl->cutbuf, gl->line + gl->buff_curpos, count);
7243 if (--count >= gl->buff_curpos)
7244 return gl_forward_copy_char(gl, count - gl->buff_curpos, NULL);
7246 return gl_backward_copy_char(gl, gl->buff_curpos - count, NULL);
7258 if(curpos >= gl->buff_curpos)
7259 return gl_forward_copy_char(gl, curpos - gl->buff_curpos + 1, NULL);
7261 return gl_backward_copy_char(gl, ++gl->buff_curpos - curpos + 1, NULL);
7275 memcpy(gl->cutbuf, gl->line + gl->buff_curpos, gl->ntotal - gl->buff_curpos);
7276 gl->cutbuf[gl->ntotal - gl->buff_curpos] = '\0';
7289 memcpy(gl->cutbuf, gl->line, gl->buff_curpos);
7290 gl->cutbuf[gl->buff_curpos] = '\0';
7398 for(i=0, pos=gl->buff_curpos; i<count && pos < gl->ntotal; i++) {
7422 for(i=0, pos=gl->buff_curpos; i<count && pos >= gl->insert_curpos; i++) {
7498 bufpos = gl->buff_curpos + 1;
7547 bufpos = gl->buff_curpos;
7586 bufpos = gl->buff_curpos;
7630 int n = next - gl->buff_curpos;
7634 memcpy(gl->cutbuf, gl->line + gl->buff_curpos, n);
7652 int n = gl->buff_curpos - next;
7694 n = pos + 1 - gl->buff_curpos;
7695 memcpy(gl->cutbuf, gl->line + gl->buff_curpos, n);
7697 n = gl->buff_curpos - pos;
7771 * buff_curpos int The new buffer cursor position.
7776 static int gl_place_cursor(GetLine *gl, int buff_curpos)
7782 if(buff_curpos >= gl->ntotal)
7783 buff_curpos = gl->vi.command ? gl->ntotal-1 : gl->ntotal;
7784 if(buff_curpos < 0)
7785 buff_curpos = 0;
7789 gl->buff_curpos = buff_curpos;
7794 gl_displayed_string_width(gl, gl->line, buff_curpos, gl->prompt_len));
7812 gl->vi.undo.buff_curpos = gl->buff_curpos;
7868 if(gl->buff_curpos < gl->vi.undo.buff_curpos)
7869 gl->vi.undo.buff_curpos = gl->buff_curpos;
7871 gl->buff_curpos = gl->vi.undo.buff_curpos;
7979 if (--count >= gl->buff_curpos)
7980 return gl_vi_forward_change_char(gl, count - gl->buff_curpos, NULL);
7982 return gl_vi_backward_change_char(gl, gl->buff_curpos - count, NULL);
7994 if(curpos >= gl->buff_curpos)
7995 return gl_vi_forward_change_char(gl, curpos - gl->buff_curpos + 1, NULL);
7997 return gl_vi_backward_change_char(gl, ++gl->buff_curpos - curpos + 1,
8015 gl->vi.repeat.command_curpos = gl->buff_curpos;
8117 char c = gl->line[gl->buff_curpos];
8125 for(i=gl->buff_curpos+1; i<gl->ntotal; i++) {
8138 for(i=gl->buff_curpos-1; i>=0; i--) {
8149 for(i=gl->buff_curpos+1; i<gl->ntotal; i++)
10391 gl->buff_curpos = gl->ntotal;
10460 gl->buff_curpos = 0;
10474 gl->vi.undo.buff_curpos = 0;
11124 status = a->fn(gl, a->data, count, gl->buff_curpos, gl->line);
12133 if(gl->buff_curpos > gl->ntotal)
12134 gl->buff_curpos = gl->ntotal;