diff options
| author | WormHeamer | 2026-01-03 05:10:36 -0500 |
|---|---|---|
| committer | WormHeamer | 2026-01-03 05:10:36 -0500 |
| commit | 66915d847415bd4803d8dcade82b5fb267b88b5a (patch) | |
| tree | 89a138e94d6d0e4f1206ab92a772e554dff877a7 /txt.h | |
| parent | 2bbd0fe917d49d5d3e3fbee63808aa487172130b (diff) | |
word v bigword, K to view man page
Diffstat (limited to 'txt.h')
| -rw-r--r-- | txt.h | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -33,6 +33,12 @@ typedef struct { } TxtLoc; typedef struct { + struct Txt *t; + u32 p0, i0; + u32 p1, i1; +} TxtRange; + +typedef struct { TxtPieceTbl v[TXT_HIST_MAX]; TxtLoc cur[TXT_HIST_MAX]; u32 i, n; @@ -146,4 +152,22 @@ static inline TxtLoc cprev(TxtLoc l) { return l; } +static inline TxtRange txt_range(TxtLoc a, TxtLoc b) { + ASSERT(a.t == b.t); + if (txt_before(b, a)) + return (TxtRange) { a.t, b.p, b.i, a.p, a.i }; + else + return (TxtRange) { a.t, a.p, a.i, b.p, b.i }; +} + +static inline TxtRange txt_range_incl(TxtLoc a, TxtLoc b) { + if (txt_before(b, a)) { + TxtLoc t = a; + a = b; + b = t; + } + b = cnext(b); + return (TxtRange) { a.t, a.p, a.i, b.p, b.i }; +} + #endif |
