mirror of
https://github.com/nushell/nushell
synced 2025-01-14 22:24:54 +00:00
Add tab support to textview
This commit is contained in:
parent
5d47ad386e
commit
8db21ddf99
1 changed files with 19 additions and 7 deletions
|
@ -54,6 +54,17 @@ fn paint_textview(
|
||||||
match command {
|
match command {
|
||||||
DrawCommand::DrawString(style, string) => {
|
DrawCommand::DrawString(style, string) => {
|
||||||
for chr in string.chars() {
|
for chr in string.chars() {
|
||||||
|
if chr == '\t' {
|
||||||
|
for _ in 0..8 {
|
||||||
|
frame_buffer.push((
|
||||||
|
' ',
|
||||||
|
style.foreground.r,
|
||||||
|
style.foreground.g,
|
||||||
|
style.foreground.b,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
pos += 8;
|
||||||
|
} else {
|
||||||
frame_buffer.push((
|
frame_buffer.push((
|
||||||
chr,
|
chr,
|
||||||
style.foreground.r,
|
style.foreground.r,
|
||||||
|
@ -63,6 +74,7 @@ fn paint_textview(
|
||||||
pos += 1;
|
pos += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
DrawCommand::NextLine => {
|
DrawCommand::NextLine => {
|
||||||
for _ in 0..(width - pos % width) {
|
for _ in 0..(width - pos % width) {
|
||||||
frame_buffer.push((' ', 0, 0, 0));
|
frame_buffer.push((' ', 0, 0, 0));
|
||||||
|
|
Loading…
Reference in a new issue