diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-10-31 20:15:49 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-10-31 20:16:10 +0100 |
commit | c5cc1dab1d5610c0d96f72dc36ac6d4b4476c8ed (patch) | |
tree | e17ad0370de82f619e6cb4f2e67248cf373519a2 /src/work.c | |
parent | a0cbd4f04311392b785cf260abe52e2eb5695312 (diff) |
Make -l the default and add -b
Diffstat (limited to 'src/work.c')
-rw-r--r-- | src/work.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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); |