diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2014-08-25 18:47:00 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2014-08-25 18:47:00 +0200 |
| commit | b5d121dc1ca4edc0cfff888ba411f0837e6e0ebc (patch) | |
| tree | 35a3aef6d494c93674922f6b5500e0d273cb0848 /text-motions.h | |
| parent | bc0f09dce9fb9420ea1d5c10ebfacf50916b10af (diff) | |
| download | vis-b5d121dc1ca4edc0cfff888ba411f0837e6e0ebc.tar.gz vis-b5d121dc1ca4edc0cfff888ba411f0837e6e0ebc.tar.xz | |
Move motion related stuff into own file
Diffstat (limited to 'text-motions.h')
| -rw-r--r-- | text-motions.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/text-motions.h b/text-motions.h new file mode 100644 index 0000000..bbeca49 --- /dev/null +++ b/text-motions.h @@ -0,0 +1,58 @@ +#ifndef TEXT_MOTIONS_H +#define TEXT_MOTIONS_H + +#include <stddef.h> +#include "text.h" + +/* begin finish + * v v + * | I am a line! | + * ^ ^ + * start end + */ +size_t text_line_begin(Text*, size_t pos); +size_t text_line_start(Text*, size_t pos); +size_t text_line_finish(Text*, size_t pos); +size_t text_line_end(Text*, size_t pos); +/* + * A word consists of a sequence of non-blank characters, separated with white space. + * TODO?: An empty line is also considered to be a word. This is equivalant to a WORD + * in vim terminology. + */ +size_t text_word_end_next(Text*, size_t pos); +size_t text_word_end_prev(Text*, size_t pos); +size_t text_word_start_next(Text*, size_t pos); +size_t text_word_start_prev(Text*, size_t pos); +/* + * These are variants of the above with the additional possibility to implement + * a custom word detection logic. Can be used to implment the equivalent of a what + * vim reconizes as a word (lowercase). + */ +size_t text_word_boundry_end_next(Text*, size_t pos, int (*isboundry)(int)); +size_t text_word_boundry_end_prev(Text*, size_t pos, int (*isboundry)(int)); +size_t text_word_boundry_start_next(Text*, size_t pos, int (*isboundry)(int)); +size_t text_word_boundry_start_prev(Text*, size_t pos, int (*isboundry)(int)); +/* TODO: implement the following semantics + * A sentence is defined as ending at a '.', '!' or '?' followed by either the + * end of a line, or by a space or tab. Any number of closing ')', ']', '"' + * and ''' characters may appear after the '.', '!' or '?' before the spaces, + * tabs or end of line. A paragraph and section boundary is also a sentence + * boundary. + */ +size_t text_sentence_next(Text*, size_t pos); +size_t text_sentence_prev(Text*, size_t pos); +/* TODO: implement the following semantics + * A paragraph begins after each empty line. A section boundary is also a + * paragraph boundary. Note that a blank line (only containing white space) + * is NOT a paragraph boundary. + */ +size_t text_paragraph_next(Text*, size_t pos); +size_t text_paragraph_prev(Text*, size_t pos); +/* A section begins after a form-feed in the first column. +size_t text_section_next(Text*, size_t pos); +size_t text_section_prev(Text*, size_t pos); +*/ +/* search coresponding '(', ')', '{', '}', '[', ']', '>', '<', '"', ''' */ +size_t text_bracket_match(Text*, size_t pos); + +#endif |
