aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2020-07-26 16:47:19 +0200
committerMarc André Tanner <mat@brain-dump.org>2020-08-01 14:59:32 +0200
commitd1d5853517685cc9a7968784b9b0c4b505fd7bfa (patch)
tree00c927aa483eccb5ec53f06f19d95ea87db910ef
parentb962bd56a3d53e801a2509ebb68b4c6e4df676cf (diff)
downloadvis-d1d5853517685cc9a7968784b9b0c4b505fd7bfa.tar.gz
vis-d1d5853517685cc9a7968784b9b0c4b505fd7bfa.tar.xz
vis: remove z> rightmost pairwise selection combinator
-rw-r--r--config.def.h1
-rw-r--r--main.c44
-rw-r--r--man/vis.12
3 files changed, 0 insertions, 47 deletions
diff --git a/config.def.h b/config.def.h
index 894149f..b851cf6 100644
--- a/config.def.h
+++ b/config.def.h
@@ -135,7 +135,6 @@ static const KeyBinding bindings_selections[] = {
{ "&", ACTION(SELECTIONS_INTERSECT) },
{ "~", ACTION(SELECTIONS_COMPLEMENT) },
{ "\\", ACTION(SELECTIONS_MINUS) },
- { "z>", ACTION(SELECTIONS_COMBINE_RIGHTMOST) },
{ "_", ACTION(SELECTIONS_TRIM) },
{ "<S-Tab>", ACTION(SELECTIONS_ALIGN_INDENT_RIGHT) },
{ "<Tab>", ACTION(SELECTIONS_ALIGN_INDENT_LEFT) },
diff --git a/main.c b/main.c
index a75d0b8..fb46399 100644
--- a/main.c
+++ b/main.c
@@ -88,9 +88,6 @@ static const char *selections_intersect(Vis*, const char *keys, const Arg *arg);
static const char *selections_complement(Vis*, const char *keys, const Arg *arg);
/* subtract selections from mark */
static const char *selections_minus(Vis*, const char *keys, const Arg *arg);
-/* pairwise combine selections from mark */
-static const char *selections_combine(Vis*, const char *keys, const Arg *arg);
-static Filerange combine_rightmost(const Filerange*, const Filerange*);
/* adjust current used count according to keys */
static const char *count(Vis*, const char *keys, const Arg *arg);
/* move to the count-th line or if not given either to the first (arg->i < 0)
@@ -286,7 +283,6 @@ enum {
VIS_ACTION_SELECTIONS_INTERSECT,
VIS_ACTION_SELECTIONS_COMPLEMENT,
VIS_ACTION_SELECTIONS_MINUS,
- VIS_ACTION_SELECTIONS_COMBINE_RIGHTMOST,
VIS_ACTION_TEXT_OBJECT_WORD_OUTER,
VIS_ACTION_TEXT_OBJECT_WORD_INNER,
VIS_ACTION_TEXT_OBJECT_LONGWORD_OUTER,
@@ -1031,11 +1027,6 @@ static const KeyAction vis_action[] = {
VIS_HELP("Subtract selections from mark")
selections_minus
},
- [VIS_ACTION_SELECTIONS_COMBINE_RIGHTMOST] = {
- "vis-selections-combine-rightmost",
- VIS_HELP("Pairwise combine: rightmost")
- selections_combine, { .combine = combine_rightmost }
- },
[VIS_ACTION_TEXT_OBJECT_WORD_OUTER] = {
"vis-textobject-word-outer",
VIS_HELP("A word leading and trailing whitespace included")
@@ -1790,41 +1781,6 @@ static const char *selections_minus(Vis *vis, const char *keys, const Arg *arg)
return keys;
}
-static Filerange combine_rightmost(const Filerange *r1, const Filerange *r2) {
- if (!r1)
- return *r2;
- if (!r2)
- return *r1;
- return r1->start < r2->start || (r1->start == r2->start && r1->end < r2->end) ? *r2 : *r1;
-}
-
-static const char *selections_combine(Vis *vis, const char *keys, const Arg *arg) {
- Win *win = vis_window(vis);
- View *view = vis_view(vis);
- enum VisMark mark = vis_mark_used(vis);
- Array a = view_selections_get_all(view);
- Array b = vis_mark_get(win, mark);
- Array sel;
- array_init_from(&sel, &a);
-
- Filerange *r1 = array_get(&a, 0), *r2 = array_get(&b, 0);
- for (size_t i = 0, j = 0; r1 || r2; r1 = array_get(&a, ++i), r2 = array_get(&b, ++j)) {
- Filerange new = arg->combine(r1, r2);
- if (text_range_valid(&new))
- array_add(&sel, &new);
- }
-
- vis_mark_normalize(&sel);
- selections_set(vis, view, &sel);
- vis_cancel(vis);
-
- array_release(&a);
- array_release(&b);
- array_release(&sel);
-
- return keys;
-}
-
static const char *replace(Vis *vis, const char *keys, const Arg *arg) {
if (!keys[0]) {
vis_keymap_disable(vis);
diff --git a/man/vis.1 b/man/vis.1
index a6621a5..9a10cc0 100644
--- a/man/vis.1
+++ b/man/vis.1
@@ -1162,8 +1162,6 @@ set intersection
set minus
.It Ic ~
set complement
-.It Ic z>
-pairwise combine, choose rightmost
.El
.
.Sh VI(M) COMMANDS