robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
d9a7b68795
master
1#pragma once 2 3#include <stdbool.h> 4#include <stddef.h> 5#include <stdint.h> 6 7#include "nvim/eval/typval_defs.h" // IWYU pragma: keep 8#include "nvim/normal_defs.h" // IWYU pragma: keep 9#include "nvim/os/time_defs.h" 10#include "nvim/pos_defs.h" 11#include "nvim/regexp_defs.h" // IWYU pragma: keep 12#include "nvim/types_defs.h" 13#include "nvim/vim_defs.h" // IWYU pragma: keep 14 15/// Values for the find_pattern_in_path() function args 'type' and 'action': 16enum { 17FIND_ANY = 1 , 18FIND_DEFINE = 2 , 19CHECK_PATH = 3 , 20}; 21 22enum { 23ACTION_SHOW = 1 , 24ACTION_GOTO = 2 , 25ACTION_SPLIT = 3 , 26ACTION_SHOW_ALL = 4 , 27ACTION_EXPAND = 5 , 28}; 29 30/// Values for "options" argument in do_search() and searchit() 31enum { 32SEARCH_REV = 0x01 ,///< go in reverse of previous dir. 33SEARCH_ECHO = 0x02 ,///< echo the search command and handle options 34SEARCH_MSG = 0x0c ,///< give messages (yes, it's not 0x04) 35SEARCH_NFMSG = 0x08 ,///< give all messages except not found 36SEARCH_OPT = 0x10 ,///< interpret optional flags 37SEARCH_HIS = 0x20 ,///< put search pattern in history 38SEARCH_END = 0x40 ,///< put cursor at end of match 39SEARCH_NOOF = 0x80 ,///< don't add offset to position 40SEARCH_START = 0x100 ,///< start search without col offset 41SEARCH_MARK = 0x200 ,///< set previous context mark 42SEARCH_KEEP = 0x400 ,///< keep previous search pattern 43SEARCH_PEEK = 0x800 ,///< peek for typed char, cancel search 44SEARCH_COL = 0x1000 ,///< start at specified column instead of zero 45}; 46 47/// Values for flags argument for findmatchlimit() 48enum { 49FM_BACKWARD = 0x01 ,///< search backwards 50FM_FORWARD = 0x02 ,///< search forwards 51FM_BLOCKSTOP = 0x04 ,///< stop at start/end of block 52FM_SKIPCOMM = 0x08 ,///< skip comments (cursor must start outside) 53}; 54 55/// Values for sub_cmd and which_pat argument for search_regcomp() 56/// Also used for which_pat argument for searchit() 57enum { 58RE_SEARCH = 0 ,///< save/use pat in/from search_pattern 59RE_SUBST = 1 ,///< save/use pat in/from subst_pattern 60RE_BOTH = 2 ,///< save pat in both patterns 61RE_LAST = 2 ,///< use last used pattern if "pat" is NULL 62}; 63 64// Values for searchcount() 65enum {SEARCH_STAT_DEF_TIMEOUT = 40 , }; 66// 'W ': 2 + 67// '[>9999/>9999]': 13 + 1 (NUL) 68enum {SEARCH_STAT_BUF_LEN = 16 , }; 69 70/// Structure containing offset definition for the last search pattern 71/// 72/// @note Only offset for the last search pattern is used, not for the last 73/// substitute pattern. 74typedef struct { 75char dir ;///< Search direction: forward ('/') or backward ('?') 76bool line ;///< True if search has line offset. 77bool end ;///< True if search sets cursor at the end. 78int64_t off ;///< Actual offset value. 79}SearchOffset ; 80 81/// Structure containing last search pattern and its attributes. 82typedef struct { 83char * pat ;///< The pattern (in allocated memory) or NULL. 84size_t patlen ;///< The length of the pattern (0 if pat is NULL). 85bool magic ;///< Magicness of the pattern. 86bool no_scs ;///< No smartcase for this pattern. 87Timestamp timestamp ;///< Time of the last change. 88SearchOffset off ;///< Pattern offset. 89AdditionalData * additional_data ;///< Additional data from ShaDa file. 90}SearchPattern ; 91 92/// Optional extra arguments for searchit(). 93typedef struct { 94linenr_T sa_stop_lnum ;///< stop after this line number when != 0 95proftime_T * sa_tm ;///< timeout limit or NULL 96int sa_timed_out ;///< set when timed out 97int sa_wrapped ;///< search wrapped around 98}searchit_arg_T ; 99 100typedef struct { 101int cur ;// current position of found words 102int cnt ;// total count of found words 103bool exact_match ;// true if matched exactly on specified position 104int incomplete ;// 0: search was fully completed 105// 1: recomputing was timed out 106// 2: max count exceeded 107int last_maxcount ;// the max count of the last search 108}searchstat_T ; 109 110#include "search.h.generated.h"