mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 16:26:08 +03:00
exit early when cursor is on a prompt line
This commit is contained in:
@ -1624,6 +1624,14 @@ pub fn selectOutput(self: *Screen, pt: point.ScreenPoint) ?Selection {
|
|||||||
// Impossible to select anything outside of the area we've written.
|
// Impossible to select anything outside of the area we've written.
|
||||||
const y_max = self.rowsWritten() - 1;
|
const y_max = self.rowsWritten() - 1;
|
||||||
if (pt.y > y_max) return null;
|
if (pt.y > y_max) return null;
|
||||||
|
const point_row = self.getRow(.{ .screen = pt.y });
|
||||||
|
switch (point_row.getSemanticPrompt()) {
|
||||||
|
.input, .prompt_continuation, .prompt => {
|
||||||
|
// Cursor on a prompt line, selection impossible
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
else => {},
|
||||||
|
}
|
||||||
|
|
||||||
// Go forwards to find our end boundary
|
// Go forwards to find our end boundary
|
||||||
// We are looking for input start / prompt markers
|
// We are looking for input start / prompt markers
|
||||||
@ -1632,10 +1640,6 @@ pub fn selectOutput(self: *Screen, pt: point.ScreenPoint) ?Selection {
|
|||||||
const row = self.getRow(.{ .screen = y });
|
const row = self.getRow(.{ .screen = y });
|
||||||
switch (row.getSemanticPrompt()) {
|
switch (row.getSemanticPrompt()) {
|
||||||
.input, .prompt_continuation, .prompt => {
|
.input, .prompt_continuation, .prompt => {
|
||||||
if (y == pt.y) {
|
|
||||||
// Cursor on a prompt line, selection impossible
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const prev_row = self.getRow(.{ .screen = y - 1 });
|
const prev_row = self.getRow(.{ .screen = y - 1 });
|
||||||
break :boundary .{ .x = prev_row.lenCells(), .y = y - 1 };
|
break :boundary .{ .x = prev_row.lenCells(), .y = y - 1 };
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user