summaryrefslogtreecommitdiff
path: root/src/File.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/File.zig')
-rw-r--r--src/File.zig14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/File.zig b/src/File.zig
index 22e3c434..262f3ebb 100644
--- a/src/File.zig
+++ b/src/File.zig
@@ -378,7 +378,7 @@ pub fn gutterWidth(pane: *const Pane) u16 {
/// Convert between rendered cells and UTF-8 byte columns. Tag rows always
/// need grapheme conversion; file body rows additionally skip the gutter.
pub fn renderedLineByteCol(pane: *const Pane, row: i32, line_text: []const u8, display_col: usize) usize {
- if (row < pardes.BOX_H) return rawAtDisplay(line_text, display_col);
+ if (row < pane.tag_rows) return rawAtDisplay(line_text, display_col);
if (pane.file == null) return rawAtDisplay(line_text, display_col);
const prefix = @min(@as(usize, gutterWidth(pane)), line_text.len);
if (display_col <= prefix) return display_col;
@@ -386,7 +386,7 @@ pub fn renderedLineByteCol(pane: *const Pane, row: i32, line_text: []const u8, d
}
pub fn renderedLineDisplayCol(pane: *const Pane, row: i32, line_text: []const u8, byte_col: usize) usize {
- if (row < pardes.BOX_H) return rawDisplayCol(line_text, byte_col);
+ if (row < pane.tag_rows) return rawDisplayCol(line_text, byte_col);
if (pane.file == null) return rawDisplayCol(line_text, byte_col);
const prefix = @min(@as(usize, gutterWidth(pane)), line_text.len);
if (byte_col <= prefix) return byte_col;
@@ -1133,7 +1133,7 @@ pub fn drawGutter(p: *Pardes, pane: *Pane, r: pardes.Rect, tx: u16, tw: u16, bod
const typing_body = pane.focus == .body and (pane.prompt == .none or pane.prompt == .del_side);
const cur_line: i32 = if (active and typing_body) gcrow else std.math.minInt(i32);
// the body's first row, the way renderPane derives it (Tagbottom)
- const body_y = p.bodyTop(r);
+ const body_y = p.bodyTop(pane, r);
const context_bg = p.theme().tag_bg;
for (0..@min(pane.context_rows, body_h)) |context_row| {
for (0..tw) |col| {
@@ -1187,7 +1187,7 @@ pub fn recolorSyntax(p: *Pardes, pane: *Pane, f: *State, r: pardes.Rect, tx: u16
// indexed start, same as bodyText — an empty tail simply paints nothing
var flines = std.mem.splitScalar(u8, f.content[lineStart(p.gpa, f, f.scroll)..], '\n');
const total = nlines(p.gpa, f);
- const body_y = p.bodyTop(r);
+ const body_y = p.bodyTop(pane, r);
var vr: u16 = 0;
while (vr < body_h) : (vr += 1) {
var base: usize = undefined;
@@ -1263,7 +1263,7 @@ pub fn drawWrapMarkers(
pane_bg: pardes.Color,
) void {
if (tw <= gutterWidth(pane) + 1) return;
- const body_y = p.bodyTop(r);
+ const body_y = p.bodyTop(pane, r);
const marker_fg = p.chromeTheme().lineno;
var row: u16 = 0;
while (row + 1 < pane.wrap_n and row + 1 < body_h) : (row += 1) {
@@ -1287,9 +1287,9 @@ pub fn paintWordSelection(
const tx = r.x + config.GUTTER;
const tw = r.w - config.GUTTER;
const prefix_width = gutterWidth(pane);
- const body_y = p.bodyTop(r);
+ const body_y = p.bodyTop(pane, r);
var vr: i32 = 0;
- while (vr + @as(i32, pardes.BOX_H) < @as(i32, r.h)) : (vr += 1) {
+ while (vr + @as(i32, pane.tag_rows) < @as(i32, r.h)) : (vr += 1) {
const here = pane.wrapAt(vr);
if (here.line != row) continue;
var hi = word_hi;