aboutsummaryrefslogtreecommitdiff
path: root/vis-operators.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-12-22 14:36:20 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-12-22 18:11:04 +0100
commitc6d76158b597d6c9bcfe222129d2897fececc45f (patch)
tree6aae2f997b019d51dc8916b8c08007e28d91ef11 /vis-operators.c
parent0f15c4af6c68edb3fa8e3331260e1da43121827f (diff)
downloadvis-c6d76158b597d6c9bcfe222129d2897fececc45f.tar.gz
vis-c6d76158b597d6c9bcfe222129d2897fececc45f.tar.xz
text: introduce EMARK to denote an invalid mark
Technically this macro name is in the reserved namespace of errno.h. The same is true for EPOS. Maybe we should rename them at some point, but for now the short names are convenient. Fix #443 Close #444
Diffstat (limited to 'vis-operators.c')
-rw-r--r--vis-operators.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/vis-operators.c b/vis-operators.c
index 51f03ab..8d28dc4 100644
--- a/vis-operators.c
+++ b/vis-operators.c
@@ -185,7 +185,7 @@ static size_t op_cursor(Vis *vis, Text *txt, OperatorContext *c) {
static size_t op_join(Vis *vis, Text *txt, OperatorContext *c) {
size_t pos = text_line_begin(txt, c->range.end), prev_pos;
- Mark mark = NULL;
+ Mark mark = EMARK;
/* if operator and range are both linewise, skip last line break */
if (c->linewise && text_range_is_linewise(txt, &c->range)) {
@@ -208,7 +208,7 @@ static size_t op_join(Vis *vis, Text *txt, OperatorContext *c) {
if (text_byte_get(txt, pos-1, &prev) && !isspace((unsigned char)prev) &&
text_byte_get(txt, pos, &next) && next != '\r' && next != '\n')
text_insert(txt, pos, c->arg->s, len);
- if (!mark)
+ if (mark == EMARK)
mark = text_mark_set(txt, pos);
} while (pos != prev_pos);