2 #include "text-objects.h"
5 void vis_textobject(Vis
*vis
, enum VisTextObject id
) {
6 if (id
< LENGTH(vis_textobjects
)) {
7 vis
->action
.textobj
= &vis_textobjects
[id
];
8 action_do(vis
, &vis
->action
);
12 static Filerange
search_forward(Vis
*vis
, Text
*txt
, size_t pos
) {
13 return text_object_search_forward(txt
, pos
, vis
->search_pattern
);
16 static Filerange
search_backward(Vis
*vis
, Text
*txt
, size_t pos
) {
17 return text_object_search_backward(txt
, pos
, vis
->search_pattern
);
20 const TextObject vis_textobjects
[] = {
21 [VIS_TEXTOBJECT_INNER_WORD
] = { .txt
= text_object_word
},
22 [VIS_TEXTOBJECT_OUTER_WORD
] = { .txt
= text_object_word_outer
},
23 [VIS_TEXTOBJECT_INNER_LONGWORD
] = { .txt
= text_object_longword
},
24 [VIS_TEXTOBJECT_OUTER_LONGWORD
] = { .txt
= text_object_longword_outer
},
25 [VIS_TEXTOBJECT_SENTENCE
] = { .txt
= text_object_sentence
},
26 [VIS_TEXTOBJECT_PARAGRAPH
] = { .txt
= text_object_paragraph
},
27 [VIS_TEXTOBJECT_OUTER_SQUARE_BRACKET
] = { .txt
= text_object_square_bracket
, .type
= OUTER
},
28 [VIS_TEXTOBJECT_INNER_SQUARE_BRACKET
] = { .txt
= text_object_square_bracket
, .type
= INNER
},
29 [VIS_TEXTOBJECT_OUTER_CURLY_BRACKET
] = { .txt
= text_object_curly_bracket
, .type
= OUTER
},
30 [VIS_TEXTOBJECT_INNER_CURLY_BRACKET
] = { .txt
= text_object_curly_bracket
, .type
= INNER
},
31 [VIS_TEXTOBJECT_OUTER_ANGLE_BRACKET
] = { .txt
= text_object_angle_bracket
, .type
= OUTER
},
32 [VIS_TEXTOBJECT_INNER_ANGLE_BRACKET
] = { .txt
= text_object_angle_bracket
, .type
= INNER
},
33 [VIS_TEXTOBJECT_OUTER_PARANTHESE
] = { .txt
= text_object_paranthese
, .type
= OUTER
},
34 [VIS_TEXTOBJECT_INNER_PARANTHESE
] = { .txt
= text_object_paranthese
, .type
= INNER
},
35 [VIS_TEXTOBJECT_OUTER_QUOTE
] = { .txt
= text_object_quote
, .type
= OUTER
},
36 [VIS_TEXTOBJECT_INNER_QUOTE
] = { .txt
= text_object_quote
, .type
= INNER
},
37 [VIS_TEXTOBJECT_OUTER_SINGLE_QUOTE
] = { .txt
= text_object_single_quote
, .type
= OUTER
},
38 [VIS_TEXTOBJECT_INNER_SINGLE_QUOTE
] = { .txt
= text_object_single_quote
, .type
= INNER
},
39 [VIS_TEXTOBJECT_OUTER_BACKTICK
] = { .txt
= text_object_backtick
, .type
= OUTER
},
40 [VIS_TEXTOBJECT_INNER_BACKTICK
] = { .txt
= text_object_backtick
, .type
= INNER
},
41 [VIS_TEXTOBJECT_OUTER_ENTIRE
] = { .txt
= text_object_entire
, },
42 [VIS_TEXTOBJECT_INNER_ENTIRE
] = { .txt
= text_object_entire_inner
, },
43 [VIS_TEXTOBJECT_OUTER_FUNCTION
] = { .txt
= text_object_function
, },
44 [VIS_TEXTOBJECT_INNER_FUNCTION
] = { .txt
= text_object_function_inner
, },
45 [VIS_TEXTOBJECT_OUTER_LINE
] = { .txt
= text_object_line
, },
46 [VIS_TEXTOBJECT_INNER_LINE
] = { .txt
= text_object_line_inner
, },
47 [VIS_TEXTOBJECT_SEARCH_FORWARD
] = { .vis
= search_forward
, .type
= SPLIT
},
48 [VIS_TEXTOBJECT_SEARCH_BACKWARD
] = { .vis
= search_backward
, .type
= SPLIT
},