mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-18 13:30:29 +00:00
PR review
This commit is contained in:
@@ -17,7 +17,7 @@ pub fn neverExtendBg(
|
||||
// powerline) that looks bad when extended.
|
||||
switch (row.semantic_prompt) {
|
||||
.prompt, .prompt_continuation => return true,
|
||||
.no_prompt => {},
|
||||
.none => {},
|
||||
}
|
||||
|
||||
for (0.., cells) |x, *cell| {
|
||||
|
||||
@@ -1229,7 +1229,7 @@ const ReflowCursor = struct {
|
||||
|
||||
// If the row has a semantic prompt then the blank row is meaningful
|
||||
// so we just consider pretend the first cell of the row isn't empty.
|
||||
if (cols_len == 0 and src_row.semantic_prompt != .no_prompt) cols_len = 1;
|
||||
if (cols_len == 0 and src_row.semantic_prompt != .none) cols_len = 1;
|
||||
}
|
||||
|
||||
// Handle tracked pin adjustments.
|
||||
@@ -1973,7 +1973,7 @@ const ReflowCursor = struct {
|
||||
|
||||
// If the row has a semantic prompt then the blank row is meaningful
|
||||
// so we always return all but one so that the row is drawn.
|
||||
if (self.page_row.semantic_prompt != .no_prompt) return len - 1;
|
||||
if (self.page_row.semantic_prompt != .none) return len - 1;
|
||||
|
||||
return len;
|
||||
}
|
||||
@@ -4405,7 +4405,7 @@ pub const PromptIterator = struct {
|
||||
const rac = p.rowAndCell();
|
||||
switch (rac.row.semantic_prompt) {
|
||||
// This row isn't a prompt. Keep looking.
|
||||
.no_prompt => if (at_limit) break,
|
||||
.none => if (at_limit) break,
|
||||
|
||||
// This is a prompt line or continuation line. In either
|
||||
// case we consider the first line the prompt, and then
|
||||
@@ -4427,7 +4427,7 @@ pub const PromptIterator = struct {
|
||||
if (limit.eql(next_pin)) break;
|
||||
},
|
||||
|
||||
.prompt, .no_prompt => {
|
||||
.prompt, .none => {
|
||||
self.current = next_pin;
|
||||
return p.left(p.x);
|
||||
},
|
||||
@@ -4458,7 +4458,7 @@ pub const PromptIterator = struct {
|
||||
const rac = p.rowAndCell();
|
||||
switch (rac.row.semantic_prompt) {
|
||||
// This row isn't a prompt. Keep looking.
|
||||
.no_prompt => if (at_limit) break,
|
||||
.none => if (at_limit) break,
|
||||
|
||||
// This is a prompt line.
|
||||
.prompt => {
|
||||
@@ -4485,7 +4485,7 @@ pub const PromptIterator = struct {
|
||||
|
||||
switch (prior.rowAndCell().row.semantic_prompt) {
|
||||
// No prompt. That means our last pin is good!
|
||||
.no_prompt => {
|
||||
.none => {
|
||||
self.current = prior;
|
||||
return end_pin.left(end_pin.x);
|
||||
},
|
||||
|
||||
@@ -1683,7 +1683,7 @@ pub inline fn resize(
|
||||
// If our cursor is on a prompt line, then we clear the prompt so
|
||||
// the shell can redraw it. This works with OSC133 semantic prompts.
|
||||
if (opts.prompt_redraw and
|
||||
self.cursor.page_row.semantic_prompt != .no_prompt)
|
||||
self.cursor.page_row.semantic_prompt != .none)
|
||||
prompt: {
|
||||
const start = start: {
|
||||
var it = self.cursor.page_pin.promptIterator(
|
||||
@@ -2922,7 +2922,7 @@ pub fn promptPath(
|
||||
// highlightSemanticContent asserts the starting point is a prompt.
|
||||
switch (from.rowAndCell().row.semantic_prompt) {
|
||||
.prompt, .prompt_continuation => {},
|
||||
.no_prompt => return .{ .x = 0, .y = 0 },
|
||||
.none => return .{ .x = 0, .y = 0 },
|
||||
}
|
||||
|
||||
// Get our prompt bounds assuming "from" is at a prompt.
|
||||
@@ -6088,7 +6088,7 @@ test "Screen: resize more cols no reflow preserves semantic prompt" {
|
||||
// Our one row should still be a semantic prompt, the others should not.
|
||||
{
|
||||
const list_cell = s.pages.getCell(.{ .active = .{ .x = 0, .y = 0 } }).?;
|
||||
try testing.expect(list_cell.row.semantic_prompt == .no_prompt);
|
||||
try testing.expect(list_cell.row.semantic_prompt == .none);
|
||||
}
|
||||
{
|
||||
const list_cell = s.pages.getCell(.{ .active = .{ .x = 0, .y = 1 } }).?;
|
||||
@@ -6096,7 +6096,7 @@ test "Screen: resize more cols no reflow preserves semantic prompt" {
|
||||
}
|
||||
{
|
||||
const list_cell = s.pages.getCell(.{ .active = .{ .x = 0, .y = 2 } }).?;
|
||||
try testing.expect(list_cell.row.semantic_prompt == .no_prompt);
|
||||
try testing.expect(list_cell.row.semantic_prompt == .none);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1200,7 +1200,7 @@ pub fn cursorIsAtPrompt(self: *Terminal) bool {
|
||||
|
||||
// If our page row is a prompt then we're always at a prompt
|
||||
const cursor: *const Screen.Cursor = &self.screens.active.cursor;
|
||||
if (cursor.page_row.semantic_prompt != .no_prompt) return true;
|
||||
if (cursor.page_row.semantic_prompt != .none) return true;
|
||||
|
||||
// Otherwise, determine our cursor state
|
||||
return switch (cursor.semantic_content) {
|
||||
@@ -2355,7 +2355,7 @@ pub fn eraseDisplay(
|
||||
|
||||
// If we have command output, then we're most certainly not
|
||||
// at a prompt.
|
||||
.no_prompt => break :at_prompt,
|
||||
.none => break :at_prompt,
|
||||
}
|
||||
} else break :at_prompt;
|
||||
|
||||
@@ -11323,7 +11323,7 @@ test "Terminal: semantic prompt" {
|
||||
try testing.expectEqual(.output, cell.semantic_content);
|
||||
|
||||
const row = list_cell.row;
|
||||
try testing.expectEqual(.no_prompt, row.semantic_prompt);
|
||||
try testing.expectEqual(.none, row.semantic_prompt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1907,7 +1907,7 @@ pub const Row = packed struct(u64) {
|
||||
/// This may contain false positives but never false negatives. If
|
||||
/// this is set, you should still check individual cells to see if they
|
||||
/// have prompt semantics.
|
||||
semantic_prompt: SemanticPrompt = .no_prompt,
|
||||
semantic_prompt: SemanticPrompt = .none,
|
||||
|
||||
/// True if this row contains a virtual placeholder for the Kitty
|
||||
/// graphics protocol. (U+10EEEE)
|
||||
@@ -1934,11 +1934,16 @@ pub const Row = packed struct(u64) {
|
||||
/// The semantic prompt state of the row. See `semantic_prompt`.
|
||||
pub const SemanticPrompt = enum(u2) {
|
||||
/// No prompt cells in this row.
|
||||
no_prompt = 0,
|
||||
/// Prompt cells exist in this row.
|
||||
none = 0,
|
||||
/// Prompt cells exist in this row and this is a primary prompt
|
||||
/// line. A primary prompt line is one that is not a continuation
|
||||
/// and is the beginning of a prompt.
|
||||
prompt = 1,
|
||||
/// Prompt cells exist in this row that had k=c set (continuation)
|
||||
/// line. This is used as a way to
|
||||
/// line. This is used as a way to detect when a line should
|
||||
/// be considered part of some prior prompt. If no prior prompt
|
||||
/// is found, the last (most historical) prompt continuation line is
|
||||
/// considered the prompt.
|
||||
prompt_continuation = 2,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user