Merge pull request #537 from jonathandturner/tabs_in_textview

Add tab support to textview
This commit is contained in:
Jonathan Turner 2019-08-30 16:20:40 +12:00 committed by GitHub
commit 3fba30f2dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,13 +54,25 @@ fn paint_textview(
match command {
DrawCommand::DrawString(style, string) => {
for chr in string.chars() {
frame_buffer.push((
chr,
style.foreground.r,
style.foreground.g,
style.foreground.b,
));
pos += 1;
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((
chr,
style.foreground.r,
style.foreground.g,
style.foreground.b,
));
pos += 1;
}
}
}
DrawCommand::NextLine => {