aboutsummaryrefslogtreecommitdiff
path: root/src/work.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/work.c')
-rw-r--r--src/work.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/work.c b/src/work.c
index e6ab140..15c9ea4 100644
--- a/src/work.c
+++ b/src/work.c
@@ -369,7 +369,12 @@ write_match_to_buffer(u8view_t sv, u8view_t *hl)
char offset[/* len(INT64_MAX - 1) */ 19];
pos_state_t ps = {.buf = {baseptr, PTRDIFF_MAX}};
- if (flags.l) {
+ if (flags.b) {
+ offsetsz = sprintf(offset, "%td", sv.p - baseptr);
+ array_extend_sv(buf, COL_LN);
+ array_extend(buf, offset, offsetsz);
+ array_extend_sv(buf, COL_RS);
+ } else {
compute_pos(sv.p, &ps);
offsetsz = sprintf(offset, "%td", ps.row + 1);
@@ -385,11 +390,6 @@ write_match_to_buffer(u8view_t sv, u8view_t *hl)
array_extend_sv(buf, COL_LN);
array_extend(buf, offset, offsetsz);
array_extend_sv(buf, COL_RS);
- } else {
- offsetsz = sprintf(offset, "%td", sv.p - baseptr);
- array_extend_sv(buf, COL_LN);
- array_extend(buf, offset, offsetsz);
- array_extend_sv(buf, COL_RS);
}
array_extend_sv(buf, COL_SE);