diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-07-08 09:52:56 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-07-08 09:52:56 +0200 |
| commit | ad10da5cc094204eb6f319841ab73246b689abb4 (patch) | |
| tree | 9493aadbf020088befc922d61187c80c72f0f2dc /vis.h | |
| parent | 5c600e15c1c1ab64f385de918c93d2bdb23955d5 (diff) | |
| download | vis-ad10da5cc094204eb6f319841ab73246b689abb4.tar.gz vis-ad10da5cc094204eb6f319841ab73246b689abb4.tar.xz | |
vis: cleanup marks implementation
We now use ' to refer to marks. Mark a is set using 'am and restored
using 'aM while this is slightly harder to type than ma and 'a it is
consistent with register usage for yank/put and allows a default
mark to be used which is handy for quick selection manipulation
primitives.
Diffstat (limited to 'vis.h')
| -rw-r--r-- | vis.h | 53 |
1 files changed, 27 insertions, 26 deletions
@@ -501,8 +501,6 @@ enum VisMotion { VIS_MOVE_RIGHT_TILL, VIS_MOVE_FILE_BEGIN, VIS_MOVE_FILE_END, - VIS_MOVE_MARK, - VIS_MOVE_MARK_LINE, VIS_MOVE_SEARCH_WORD_FORWARD, VIS_MOVE_SEARCH_WORD_BACKWARD, VIS_MOVE_SEARCH_REPEAT_FORWARD, @@ -546,10 +544,6 @@ enum VisMotion { * - ``VIS_MOVE_{LEFT,RIGHT}_{TO,TILL}`` * * The character to search for as ``const char *``. - * - * - `VIS_MOVE_MARK` and `VIS_MOVE_MARK_LINE` - * - * A valid ``enum VisMark``. */ bool vis_motion(Vis*, enum VisMotion, ...); @@ -690,12 +684,36 @@ enum VisMark { /** Translate single character mark name to corresponding constant. */ enum VisMark vis_mark_from(Vis*, char mark); /** - * Set a mark. + * Specify mark to use. * @rst - * .. note:: The same semantics as for `text_mark_set` apply. + * .. note:: If none is specified `VIS_MARK_DEFAULT` will be used. * @endrst */ -void vis_mark_set(Vis*, enum VisMark mark, size_t pos); +void vis_mark(Vis*, enum VisMark); +enum VisMark vis_mark_used(Vis*); +/** + * Store a set of ``Filerange``s in a mark. + * + * @param id The register to use. + * @param sel The array containing the file ranges. + */ +void vis_mark_set(Vis*, enum VisMark id, Array *sel); +/** + * Get an array of file ranges stored in the mark. + * + * @rst + * .. warning:: The caller must eventually free the Array by calling + * ``array_release``. + * @endrst + */ +Array vis_mark_get(Vis*, enum VisMark id); +/** + * Normalize an Array of Fileranges. + * + * Removes invalid ranges, merges overlapping ones and sorts + * according to the start position. + */ +void vis_mark_normalize(Array*); /** @} */ /** Register specifiers. */ @@ -719,7 +737,6 @@ enum VisRegister { VIS_REG_COMMAND, /* last used :-command ": */ VIS_REG_SHELL, /* last used shell command given to either <, >, |, or ! */ VIS_REG_NUMBER, /* cursor number */ - VIS_REG_SELECTION, /* last used selections */ VIS_REG_a, VIS_REG_b, VIS_REG_c, VIS_REG_d, VIS_REG_e, VIS_REG_f, VIS_REG_g, VIS_REG_h, VIS_REG_i, VIS_REG_j, VIS_REG_k, VIS_REG_l, VIS_REG_m, VIS_REG_n, VIS_REG_o, @@ -758,22 +775,6 @@ const char *vis_register_slot_get(Vis*, enum VisRegister, size_t slot, size_t *l /** Set register content. */ bool vis_register_put(Vis*, enum VisRegister, const char *data, size_t len); bool vis_register_slot_put(Vis*, enum VisRegister, size_t slot, const char *data, size_t len); -/** - * Store a set of ``Filerange``s in a register. - * - * @param id The register to use. - * @param sel The array containing the file ranges. - */ -void vis_register_selections_set(Vis*, enum VisRegister id, Array *sel); -/** - * Get an array of file ranges stored in the register. - * - * @rst - * .. warning:: The caller must eventually free the Array by calling - * ``array_release``. - * @endrst - */ -Array vis_register_selections_get(Vis*, enum VisRegister id); /** * @} |
