mod(node2buffer): correct handling of code's and ``block``'s entries
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 33s
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 33s
This commit is contained in:
@@ -30,8 +30,7 @@ pub fn toBuffer(
|
||||
style.fg = .{ .index = 2 };
|
||||
},
|
||||
.block => {
|
||||
// TODO: what should I do with blocks?
|
||||
style.fg = .{ .index = 7 };
|
||||
style.dim = true;
|
||||
next_start = node.token.start;
|
||||
},
|
||||
.code => {
|
||||
@@ -55,7 +54,14 @@ pub fn toBuffer(
|
||||
.text => break :value input[node.token.start..node.token.end],
|
||||
.link => break :value input[node.token.start + 1 .. node.token.start + 1 + node.title.?.len],
|
||||
// TODO: use corresponding link contents to create 'real' links using escape sequences
|
||||
.bold_close, .italic_close, .block_close, .code_close, .title_close, .href_close => {
|
||||
.code_close => {
|
||||
if (next_start) |s| {
|
||||
next_start = null;
|
||||
break :value input[s + 1 .. node.token.end - 1];
|
||||
}
|
||||
break :value "";
|
||||
},
|
||||
.bold_close, .italic_close, .block_close, .title_close, .href_close => {
|
||||
if (next_start) |s| {
|
||||
next_start = null;
|
||||
break :value input[s..node.token.end];
|
||||
@@ -139,7 +145,7 @@ pub fn toBuffer(
|
||||
});
|
||||
}
|
||||
},
|
||||
.block_close, .code_close => {
|
||||
.block_close => {
|
||||
// generate a `block` i.e.
|
||||
// 01 | ...
|
||||
// 02 | ...
|
||||
@@ -163,30 +169,30 @@ pub fn toBuffer(
|
||||
for (1..rows + 1) |r| {
|
||||
try array.append(.{
|
||||
.char = .{ .grapheme = " " },
|
||||
.style = .{ .dim = true },
|
||||
.style = .{ .fg = .{ .index = 0 } },
|
||||
});
|
||||
try array.append(.{
|
||||
.char = .{ .grapheme = " " },
|
||||
.style = .{ .dim = true },
|
||||
.style = .{ .fg = .{ .index = 0 } },
|
||||
});
|
||||
for (1..pad + 1) |i| {
|
||||
const digit = vaxis.widgets.LineNumbers.extractDigit(r, pad - i);
|
||||
try array.append(.{
|
||||
.char = .{ .grapheme = digits[digit .. digit + 1] },
|
||||
.style = .{ .dim = true },
|
||||
.style = .{ .fg = .{ .index = 0 } },
|
||||
});
|
||||
}
|
||||
try array.append(.{
|
||||
.char = .{ .grapheme = " " },
|
||||
.style = .{ .dim = true },
|
||||
.style = .{ .fg = .{ .index = 0 } },
|
||||
});
|
||||
try array.append(.{
|
||||
.char = .{ .grapheme = "│" },
|
||||
.style = .{ .dim = true },
|
||||
.style = .{ .fg = .{ .index = 0 } },
|
||||
});
|
||||
try array.append(.{
|
||||
.char = .{ .grapheme = " " },
|
||||
.style = .{ .dim = true },
|
||||
.style = .{ .fg = .{ .index = 0 } },
|
||||
});
|
||||
for (c..content.len) |c_i| {
|
||||
try array.append(.{
|
||||
@@ -221,7 +227,6 @@ pub fn toBuffer(
|
||||
style.fg = .default;
|
||||
},
|
||||
.block_close => {
|
||||
// TODO: what should I do with blocks?
|
||||
style.fg = .default;
|
||||
},
|
||||
.code_close => {
|
||||
|
||||
Reference in New Issue
Block a user