Lines Matching refs:pos

36 static void cmdline_search_stat(int dirc, pos_T *pos, pos_T *cursor_pos, int show_top_bot_msg, char…
37 static void update_search_stat(int dirc, pos_T *pos, pos_T *cursor_pos, searchstat_T *stat, int rec…
610 pos_T *pos, in searchit() argument
671 if (pos->col == MAXCOL) in searchit()
675 && pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count in searchit()
676 && pos->col < MAXCOL - 2) in searchit()
678 ptr = ml_get_buf(buf, pos->lnum, FALSE); in searchit()
679 if ((int)STRLEN(ptr) <= pos->col) in searchit()
682 start_char_len = (*mb_ptr2len)(ptr + pos->col); in searchit()
701 start_pos = *pos; // remember start pos for detecting no match in searchit()
704 if (pos->lnum == 0) // correct lnum for when starting in line 0 in searchit()
706 pos->lnum = 1; in searchit()
707 pos->col = 0; in searchit()
721 lnum = pos->lnum - 1; in searchit()
725 lnum = pos->lnum; in searchit()
745 col = at_first_line && (options & SEARCH_COL) ? pos->col in searchit()
1000 pos->lnum = lnum + endpos.lnum; in searchit()
1001 pos->col = endpos.col; in searchit()
1004 if (pos->lnum > 1) // just in case in searchit()
1006 --pos->lnum; in searchit()
1007 pos->col = (colnr_T)STRLEN(ml_get_buf(buf, in searchit()
1008 pos->lnum, FALSE)); in searchit()
1013 --pos->col; in searchit()
1015 && pos->lnum <= buf->b_ml.ml_line_count) in searchit()
1017 ptr = ml_get_buf(buf, pos->lnum, FALSE); in searchit()
1018 pos->col -= (*mb_head_off)(ptr, ptr + pos->col); in searchit()
1029 pos->lnum = lnum + matchpos.lnum; in searchit()
1030 pos->col = matchpos.col; in searchit()
1037 pos->coladd = 0; in searchit()
1057 && ((lnum - pos->lnum) & 0x3f) == 0 in searchit()
1140 if (pos->lnum > buf->b_ml.ml_line_count) in searchit()
1142 pos->lnum = buf->b_ml.ml_line_count; in searchit()
1143 pos->col = (int)STRLEN(ml_get_buf(buf, pos->lnum, FALSE)); in searchit()
1144 if (pos->col > 0) in searchit()
1145 --pos->col; in searchit()
1219 pos_T pos; // position of the last match in do_search() local
1247 pos = curwin->w_cursor; // start searching at the cursor position in do_search()
1280 if (hasFolding(pos.lnum, NULL, &pos.lnum)) in do_search()
1281 pos.col = MAXCOL - 2; // avoid overflow when adding 1 in do_search()
1285 if (hasFolding(pos.lnum, &pos.lnum, NULL)) in do_search()
1286 pos.col = 0; in do_search()
1518 if (!spats[0].off.line && spats[0].off.off && pos.col < MAXCOL - 2) in do_search()
1523 if (decl(&pos) == -1) in do_search()
1527 pos.lnum = 0; // allow lnum == 0 here in do_search()
1528 pos.col = MAXCOL; in do_search()
1534 if (incl(&pos) == -1) in do_search()
1538 pos.lnum = curbuf->b_ml.ml_line_count + 1; in do_search()
1539 pos.col = 0; in do_search()
1547 c = searchit(curwin, curbuf, &pos, NULL, in do_search()
1559 && ((dirc == '/' && LT_POS(pos, curwin->w_cursor)) in do_search()
1560 || (dirc == '?' && LT_POS(curwin->w_cursor, pos)))) in do_search()
1578 pos_T org_pos = pos; in do_search()
1582 c = pos.lnum + spats[0].off.off; in do_search()
1584 pos.lnum = 1; in do_search()
1586 pos.lnum = curbuf->b_ml.ml_line_count; in do_search()
1588 pos.lnum = c; in do_search()
1589 pos.col = 0; in do_search()
1593 else if (pos.col < MAXCOL - 2) // just in case in do_search()
1600 if (incl(&pos) == -1) in do_search()
1607 if (decl(&pos) == -1) in do_search()
1611 if (!EQUAL_POS(pos, org_pos)) in do_search()
1622 cmdline_search_stat(dirc, &pos, &curwin->w_cursor, in do_search()
1658 curwin->w_cursor = pos; in do_search()
1682 pos_T *pos, in search_for_exact_line() argument
1694 pos->lnum += dir; in search_for_exact_line()
1695 if (pos->lnum < 1) in search_for_exact_line()
1699 pos->lnum = buf->b_ml.ml_line_count; in search_for_exact_line()
1705 pos->lnum = 1; in search_for_exact_line()
1709 else if (pos->lnum > buf->b_ml.ml_line_count) in search_for_exact_line()
1713 pos->lnum = 1; in search_for_exact_line()
1719 pos->lnum = 1; in search_for_exact_line()
1723 if (pos->lnum == start) in search_for_exact_line()
1726 start = pos->lnum; in search_for_exact_line()
1727 ptr = ml_get_buf(buf, pos->lnum, FALSE); in search_for_exact_line()
1729 pos->col = (colnr_T) (p - ptr); in search_for_exact_line()
2080 static pos_T pos; // current search position in findmatchlimit() local
2107 pos = curwin->w_cursor; in findmatchlimit()
2108 pos.coladd = 0; in findmatchlimit()
2109 linep = ml_get(pos.lnum); in findmatchlimit()
2166 if (*ptr == '#' && pos.col <= (colnr_T)(ptr - linep)) in findmatchlimit()
2176 else if (linep[pos.col] == '/') in findmatchlimit()
2178 if (linep[pos.col + 1] == '*') in findmatchlimit()
2182 pos.col++; in findmatchlimit()
2184 else if (pos.col > 0 && linep[pos.col - 1] == '*') in findmatchlimit()
2188 pos.col--; in findmatchlimit()
2191 else if (linep[pos.col] == '*') in findmatchlimit()
2193 if (linep[pos.col + 1] == '/') in findmatchlimit()
2198 else if (pos.col > 0 && linep[pos.col - 1] == '/') in findmatchlimit()
2217 if (linep[pos.col] == NUL && pos.col) in findmatchlimit()
2218 --pos.col; in findmatchlimit()
2221 initc = PTR2CHAR(linep + pos.col); in findmatchlimit()
2228 pos.col += mb_ptr2len(linep + pos.col); in findmatchlimit()
2244 for (col = pos.col; check_prevcol(linep, col, '\\', &col);) in findmatchlimit()
2267 pos.col = 0; in findmatchlimit()
2272 if (pos.lnum == curbuf->b_ml.ml_line_count) in findmatchlimit()
2275 else if (pos.lnum == 1) in findmatchlimit()
2277 pos.lnum += hash_dir; in findmatchlimit()
2278 linep = ml_get(pos.lnum); in findmatchlimit()
2283 pos.col = (colnr_T) (ptr - linep); in findmatchlimit()
2292 return &pos; in findmatchlimit()
2297 return &pos; in findmatchlimit()
2306 return &pos; in findmatchlimit()
2312 return &pos; in findmatchlimit()
2341 if (lisp && comment_col != MAXCOL && pos.col > (colnr_T)comment_col) in findmatchlimit()
2354 if (lispcomm && pos.col < (colnr_T)comment_col) in findmatchlimit()
2357 if (pos.col == 0) // at start of line, go to prev. one in findmatchlimit()
2359 if (pos.lnum == 1) // start of file in findmatchlimit()
2361 --pos.lnum; in findmatchlimit()
2366 linep = ml_get(pos.lnum); in findmatchlimit()
2367 pos.col = (colnr_T)STRLEN(linep); // pos.col on trailing NUL in findmatchlimit()
2381 pos.col = comment_col; in findmatchlimit()
2386 --pos.col; in findmatchlimit()
2388 pos.col -= (*mb_head_off)(linep, linep + pos.col); in findmatchlimit()
2393 if (linep[pos.col] == NUL in findmatchlimit()
2398 && pos.col == (colnr_T)comment_col) in findmatchlimit()
2402 if (pos.lnum == curbuf->b_ml.ml_line_count // end of file in findmatchlimit()
2410 ++pos.lnum; in findmatchlimit()
2415 linep = ml_get(pos.lnum); in findmatchlimit()
2416 pos.col = 0; in findmatchlimit()
2427 pos.col += (*mb_ptr2len)(linep + pos.col); in findmatchlimit()
2429 ++pos.col; in findmatchlimit()
2436 if (pos.col == 0 && (flags & FM_BLOCKSTOP) && in findmatchlimit()
2440 return &pos; in findmatchlimit()
2450 if (linep[pos.col] == '*' && linep[pos.col + 1] == '/') in findmatchlimit()
2452 pos.col++; in findmatchlimit()
2453 return &pos; in findmatchlimit()
2462 if (pos.col == 0) in findmatchlimit()
2466 if (linep[pos.col - 1] == 'R' in findmatchlimit()
2467 && linep[pos.col] == '"' in findmatchlimit()
2468 && vim_strchr(linep + pos.col + 1, '(') != NULL) in findmatchlimit()
2474 if (!find_rawstring_end(linep, &pos, in findmatchlimit()
2478 match_pos = pos; in findmatchlimit()
2481 linep = ml_get(pos.lnum); // may have been released in findmatchlimit()
2484 else if ( linep[pos.col - 1] == '/' in findmatchlimit()
2485 && linep[pos.col] == '*' in findmatchlimit()
2486 && (pos.col == 1 || linep[pos.col - 2] != '*') in findmatchlimit()
2487 && (int)pos.col < comment_col) in findmatchlimit()
2490 match_pos = pos; in findmatchlimit()
2493 else if (linep[pos.col - 1] == '*' && linep[pos.col] == '/') in findmatchlimit()
2496 pos = match_pos; in findmatchlimit()
2497 else if (pos.col > 1 && linep[pos.col - 2] == '/' in findmatchlimit()
2498 && (int)pos.col <= comment_col) in findmatchlimit()
2499 pos.col -= 2; in findmatchlimit()
2504 return &pos; in findmatchlimit()
2526 if (ptr == linep + pos.col + backwards) in findmatchlimit()
2555 if (pos.lnum > 1) in findmatchlimit()
2557 ptr = ml_get(pos.lnum - 1); in findmatchlimit()
2572 linep = ml_get(pos.lnum); in findmatchlimit()
2590 c = PTR2CHAR(linep + pos.col); in findmatchlimit()
2595 if (pos.col == 0 || linep[pos.col - 1] != '\\') in findmatchlimit()
2609 for (col = pos.col - 1; col >= 0; --col) in findmatchlimit()
2612 if ((((int)pos.col - 1 - col) & 1) == 0) in findmatchlimit()
2632 if (pos.col > 1) in findmatchlimit()
2634 if (linep[pos.col - 2] == '\'') in findmatchlimit()
2636 pos.col -= 2; in findmatchlimit()
2639 else if (linep[pos.col - 2] == '\\' && in findmatchlimit()
2640 pos.col > 2 && linep[pos.col - 3] == '\'') in findmatchlimit()
2642 pos.col -= 3; in findmatchlimit()
2647 else if (linep[pos.col + 1]) // forward search in findmatchlimit()
2649 if (linep[pos.col + 1] == '\\' && in findmatchlimit()
2650 linep[pos.col + 2] && linep[pos.col + 3] == '\'') in findmatchlimit()
2652 pos.col += 3; in findmatchlimit()
2655 else if (linep[pos.col + 2] == '\'') in findmatchlimit()
2657 pos.col += 2; in findmatchlimit()
2672 && pos.col > 1 in findmatchlimit()
2673 && check_prevcol(linep, pos.col, '\\', NULL) in findmatchlimit()
2674 && check_prevcol(linep, pos.col - 1, '#', NULL)) in findmatchlimit()
2687 for (col = pos.col; check_prevcol(linep, col, '\\', &col);) in findmatchlimit()
2699 return &pos; in findmatchlimit()
2709 pos = match_pos; in findmatchlimit()
2710 return &pos; in findmatchlimit()
2892 pos_T pos; in is_zero_width() local
2908 CLEAR_POS(&pos); in is_zero_width()
2912 pos = *cur; in is_zero_width()
2917 if (searchit(curwin, curbuf, &pos, NULL, direction, pattern, 1, in is_zero_width()
2926 pos.lnum, regmatch.startpos[0].col, NULL, NULL); in is_zero_width()
2930 && direction == FORWARD ? regmatch.startpos[0].col < pos.col in is_zero_width()
2931 : regmatch.startpos[0].col > pos.col); in is_zero_width()
2958 pos_T pos; // position after the pattern in current_search() local
2977 orig_pos = pos = curwin->w_cursor; in current_search()
2981 incl(&pos); in current_search()
2983 decl(&pos); in current_search()
3011 end_pos = pos; in current_search()
3017 result = searchit(curwin, curbuf, &pos, &end_pos, in current_search()
3040 CLEAR_POS(&pos); in current_search()
3046 pos.lnum = curwin->w_buffer->b_ml.ml_line_count; in current_search()
3047 pos.col = (colnr_T)STRLEN( in current_search()
3053 start_pos = pos; in current_search()
3064 curwin->w_cursor = pos; in current_search()
3070 curwin->w_cursor = pos; // put the cursor on the start of the match in current_search()
3123 pos_T *pos, in cmdline_search_stat() argument
3133 update_search_stat(dirc, pos, cursor_pos, &stat, recompute, maxcount, in cmdline_search_stat()
3202 pos_T *pos, in update_search_stat() argument
3211 pos_T p = (*pos); in update_search_stat()
4098 pos_T pos = curwin->w_cursor; in f_searchcount() local
4165 pos.lnum = tv_get_number_chk(&li->li_tv, &error); in f_searchcount()
4172 pos.col = tv_get_number_chk(&li->li_tv, &error) - 1; in f_searchcount()
4179 pos.coladd = tv_get_number_chk(&li->li_tv, &error); in f_searchcount()
4197 update_search_stat(0, &pos, &pos, &stat, recompute, maxcount, timeout); in f_searchcount()