mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-20 18:56:08 +03:00
terminal: soft-wrap inherits semantic prompt status of previous line
Fixes #1334
This commit is contained in:
@ -1025,6 +1025,10 @@ fn printWrap(self: *Terminal) !void {
|
|||||||
// Move to the next line
|
// Move to the next line
|
||||||
try self.index();
|
try self.index();
|
||||||
self.screen.cursor.x = self.scrolling_region.left;
|
self.screen.cursor.x = self.scrolling_region.left;
|
||||||
|
|
||||||
|
// New line must inherit semantic prompt of the old line
|
||||||
|
const new_row = self.screen.getRow(.{ .active = self.screen.cursor.y });
|
||||||
|
new_row.setSemanticPrompt(row.getSemanticPrompt());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clearWideSpacerHead(self: *Terminal) void {
|
fn clearWideSpacerHead(self: *Terminal) void {
|
||||||
@ -2507,6 +2511,23 @@ test "Terminal: soft wrap" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "Terminal: soft wrap with semantic prompt" {
|
||||||
|
var t = try init(testing.allocator, 3, 80);
|
||||||
|
defer t.deinit(testing.allocator);
|
||||||
|
|
||||||
|
t.markSemanticPrompt(.prompt);
|
||||||
|
for ("hello") |c| try t.print(c);
|
||||||
|
|
||||||
|
{
|
||||||
|
const row = t.screen.getRow(.{ .active = 0 });
|
||||||
|
try testing.expect(row.getSemanticPrompt() == .prompt);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const row = t.screen.getRow(.{ .active = 1 });
|
||||||
|
try testing.expect(row.getSemanticPrompt() == .prompt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
test "Terminal: print writes to bottom if scrolled" {
|
test "Terminal: print writes to bottom if scrolled" {
|
||||||
var t = try init(testing.allocator, 5, 2);
|
var t = try init(testing.allocator, 5, 2);
|
||||||
defer t.deinit(testing.allocator);
|
defer t.deinit(testing.allocator);
|
||||||
|
Reference in New Issue
Block a user