diff options
Diffstat (limited to 'core/Places.zig')
| -rw-r--r-- | core/Places.zig | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/core/Places.zig b/core/Places.zig index 9b8754b9..1416dbd3 100644 --- a/core/Places.zig +++ b/core/Places.zig @@ -433,7 +433,7 @@ pub fn fill(set: *Places, p: *Pardes, pane: *Pane, bytes: usize, steps: u64) voi } if (set.fold and (set.hay_revision != f.revision or set.hay.len != f.content.len)) if (!set.freshHay(gpa, f)) return set.clear(gpa); - if (set.re == null) return set.settleSeek(pane); + if (set.re == null) return set.settleSeek(p.settings.tab, pane); const re = &set.re.?; const hay: []const u8 = if (set.fold) set.hay else f.content; for (re.branches) |*b| b.re.steps = @max(1, steps / re.branches.len); @@ -506,12 +506,12 @@ pub fn fill(set: *Places, p: *Pardes, pane: *Pane, bytes: usize, steps: u64) voi set.gen +%= 1; set.hits_gen +%= 1; } - set.settleSeek(pane); + set.settleSeek(p.settings.tab, pane); } /// The place at or after `seek` becomes current, once all the text /// between them has been searched (never a false "next" across a gap). -fn settleSeek(set: *Places, pane: *Pane) void { +fn settleSeek(set: *Places, tab: u16, pane: *Pane) void { const seek = set.seek orelse return; const hits = set.hits.items; const i = firstFrom(hits, seek); @@ -525,10 +525,10 @@ fn settleSeek(set: *Places, pane: *Pane) void { set.seek = null; set.gen +%= 1; if (!set.seek_moves) return; - if (set.current) |c| return set.goTo(pane, c, false); + if (set.current) |c| return set.goTo(tab, pane, c, false); // Nothing matches: the body as it was before the query, as helix // leaves it. - set.restore(pane); + set.restore(tab, pane); } /// The places have more to do on a frame of their own: places still to @@ -542,7 +542,7 @@ pub fn busy(set: *const Places, pane: *const Pane) bool { /// Make place `i` current: the primary selection on it (a new one beside /// the others in select mode, `add`), the view on it, centred when it was /// off it. -pub fn goTo(set: *Places, pane: *Pane, i: usize, add: bool) void { +pub fn goTo(set: *Places, tab: u16, pane: *Pane, i: usize, add: bool) void { const f = if (pane.file) |*file| file else return; if (i >= set.hits.items.len) return; const t = &pane.body; @@ -557,17 +557,17 @@ pub fn goTo(set: *Places, pane: *Pane, i: usize, add: bool) void { .{ .anchor = h.start, .head = h.end }; if (add and got.n < ranges.len) { ranges[got.n] = next; - t.setRanges(text, ranges[0 .. got.n + 1], &.{}, got.n, true); + t.setRanges(tab, text, ranges[0 .. got.n + 1], &.{}, got.n, true); } else { ranges[got.pri] = next; - t.setRanges(text, ranges[0..got.n], &.{}, got.pri, true); + t.setRanges(tab, text, ranges[0..got.n], &.{}, got.pri, true); } set.current = i; set.gen +%= 1; const off = pane.scroll(); if (t.cur_row < off or t.cur_row >= off + @as(i32, pane.rows)) pane.scrollBy(t.cur_row - off - @divTrunc(@as(i32, pane.rows), 2)); - t.show(); + t.show(tab); } /// n and N (and Ctrl-n, Ctrl-p on a query's line): the next place after @@ -596,7 +596,7 @@ pub fn step(set: *Places, p: *Pardes, pane: *Pane, forward: bool, count: u32, ad while (i > 0 and hits[i - 1].end > from) i -= 1; i = if (i == 0) hits.len - 1 else i - 1; } - set.goTo(pane, i, add); + set.goTo(p.settings.tab, pane, i, add); } } @@ -629,14 +629,14 @@ pub fn remember(set: *Places, p: *Pardes, pane: *Pane) void { } /// The body as `remember` kept it: its selections and its view. -pub fn restore(set: *Places, pane: *Pane) void { +pub fn restore(set: *Places, tab: u16, pane: *Pane) void { const f = if (pane.file) |*file| file else return; if (set.snap.len == 0) return; for (set.snap) |*r| { r.anchor = @min(r.anchor, f.content.len); r.head = @min(r.head, f.content.len); } - pane.body.setRanges(f.content, set.snap, &.{}, set.snap_pri, set.snap_expl); + pane.body.setRanges(tab, f.content, set.snap, &.{}, set.snap_pri, set.snap_expl); f.scroll = set.snap_scroll; f.syntax_dirty = true; pane.hscroll = set.snap_hscroll; @@ -672,7 +672,7 @@ pub fn paint(set: *Places, p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, var last_line: i32 = -1; var vr: i32 = 0; while (vr < body_h) : (vr += 1) { - const line = pane.wrapAt(vr).line; + const line = pane.wrapAt(p.settings.tab, vr).line; if (line == last_line or line < 0) continue; if (line >= nlines) break; last_line = line; |
