mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
render multiple lines
This commit is contained in:
@ -231,6 +231,9 @@ pub fn updateCells(self: *Grid, term: Terminal) !void {
|
|||||||
|
|
||||||
for (term.screen.items) |line, y| {
|
for (term.screen.items) |line, y| {
|
||||||
for (line.items) |cell, x| {
|
for (line.items) |cell, x| {
|
||||||
|
// It can be zero if the cell is empty
|
||||||
|
if (cell.empty()) continue;
|
||||||
|
|
||||||
// Get our glyph
|
// Get our glyph
|
||||||
const glyph = try self.font_atlas.addGlyph(self.alloc, cell.char);
|
const glyph = try self.font_atlas.addGlyph(self.alloc, cell.char);
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ pub fn create(alloc: Allocator) !*Window {
|
|||||||
// Create our terminal
|
// Create our terminal
|
||||||
var term = Terminal.init(grid.size.columns, grid.size.rows);
|
var term = Terminal.init(grid.size.columns, grid.size.rows);
|
||||||
errdefer term.deinit(alloc);
|
errdefer term.deinit(alloc);
|
||||||
try term.append(alloc, "hello!");
|
try term.append(alloc, "hello!\r\nworld!");
|
||||||
|
|
||||||
self.* = .{
|
self.* = .{
|
||||||
.window = window,
|
.window = window,
|
||||||
|
@ -32,6 +32,11 @@ const Cell = struct {
|
|||||||
char: u32,
|
char: u32,
|
||||||
|
|
||||||
// TODO(mitchellh): this is where we'll track fg/bg and other attrs.
|
// TODO(mitchellh): this is where we'll track fg/bg and other attrs.
|
||||||
|
|
||||||
|
/// True if the cell should be skipped for drawing
|
||||||
|
pub fn empty(self: Cell) bool {
|
||||||
|
return self.char == 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Cursor represents the cursor state.
|
/// Cursor represents the cursor state.
|
||||||
|
Reference in New Issue
Block a user