Change ifs to exhaustive switches

This commit is contained in:
Daniel Patterson
2025-01-26 15:22:01 +00:00
parent 645b4b0031
commit 4b8010a6f4

View File

@ -2596,6 +2596,15 @@ pub fn selectOutput(self: *Screen, pin: Pin) ?Selection {
while (it.next()) |p| { while (it.next()) |p| {
it_prev = p; it_prev = p;
const row = p.rowAndCell().row; const row = p.rowAndCell().row;
switch (row.semantic_prompt) {
.command => break,
.unknown,
.prompt,
.prompt_continuation,
.input,
=> {},
}
if (row.semantic_prompt == .command) { if (row.semantic_prompt == .command) {
break; break;
} }
@ -2606,8 +2615,14 @@ pub fn selectOutput(self: *Screen, pin: Pin) ?Selection {
// yield the previous row. // yield the previous row.
while (it.next()) |p| { while (it.next()) |p| {
const row = p.rowAndCell().row; const row = p.rowAndCell().row;
if (row.semantic_prompt != .command) { switch (row.semantic_prompt) {
break :boundary it_prev; .command => {},
.unknown,
.prompt,
.prompt_continuation,
.input,
=> break :boundary it_prev,
} }
it_prev = p; it_prev = p;
} }