| ... | @@ -908,13 +908,13 @@ fn computeNode( | ... | @@ -908,13 +908,13 @@ fn computeNode( |
| 908 | global_progress.newline_count += 1; | 908 | global_progress.newline_count += 1; |
| 909 | } | 909 | } |
| 910 | | 910 | |
| 911 | if (global_progress.newline_count < global_progress.rows) { | 911 | if (global_progress.withinRowLimit()) { |
| 912 | if (children[@intFromEnum(node_index)].child.unwrap()) |child| { | 912 | if (children[@intFromEnum(node_index)].child.unwrap()) |child| { |
| 913 | i = computeNode(buf, i, serialized, children, child); | 913 | i = computeNode(buf, i, serialized, children, child); |
| 914 | } | 914 | } |
| 915 | } | 915 | } |
| 916 | | 916 | |
| 917 | if (global_progress.newline_count < global_progress.rows) { | 917 | if (global_progress.withinRowLimit()) { |
| 918 | if (children[@intFromEnum(node_index)].sibling.unwrap()) |sibling| { | 918 | if (children[@intFromEnum(node_index)].sibling.unwrap()) |sibling| { |
| 919 | i = computeNode(buf, i, serialized, children, sibling); | 919 | i = computeNode(buf, i, serialized, children, sibling); |
| 920 | } | 920 | } |
| ... | @@ -923,6 +923,11 @@ fn computeNode( | ... | @@ -923,6 +923,11 @@ fn computeNode( |
| 923 | return i; | 923 | return i; |
| 924 | } | 924 | } |
| 925 | | 925 | |
| | 926 | fn withinRowLimit(p: *Progress) bool { |
| | 927 | // The +1 here is so that the PS1 is not scrolled off the top of the terminal. |
| | 928 | return p.newline_count + 1 < p.rows; |
| | 929 | } |
| | 930 | |
| 926 | fn write(buf: []const u8) void { | 931 | fn write(buf: []const u8) void { |
| 927 | const tty = global_progress.terminal orelse return; | 932 | const tty = global_progress.terminal orelse return; |
| 928 | tty.writeAll(buf) catch { | 933 | tty.writeAll(buf) catch { |