-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tab characters not shown in TUI #305
Comments
Thanks for opening the issue @osa1. To illustrate the problem, if I use
I get this: And it seems others using other clients see the indentation even when I use only tabs, but they didn't tell me which client they were using. @sarnold in the #tiny channel showed that
|
termbox's tab handling is fine. Here's an example: use term_input::{Event, Input, Key};
use termbox_simple::*;
use tokio::stream::StreamExt;
fn main() {
let mut tui = Termbox::init().unwrap();
draw(&mut tui);
let runtime = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap();
let local = tokio::task::LocalSet::new();
local.block_on(&runtime, async move {
let mut input = Input::new();
while let Some(mb_ev) = input.next().await {
match mb_ev {
Err(_) => {}
Ok(Event::Key(Key::Esc)) => {
return;
}
Ok(_) => {}
}
draw(&mut tui);
}
});
}
fn draw(tui: &mut Termbox) {
tui.clear();
tui.change_cell(0, 0, '\t', 0, 1);
tui.change_cell(1, 0, 'x', 0, 1);
tui.present();
} When I run this I see
so the tab is rendered as 8 spaces. |
This must be where we drop the tab character, as it's considered a "control" character: Lines 92 to 135 in e82046a
|
Fixed. Note that we don't handle entering wide characters (characters that take more than one row on screen, e.g. |
Tracked in #306. |
@Kabouik reported on IRC that tiny doesn't show tab characters. Haven't check the code yet but I wouldn't be surprised if we just completely ignore tab characters in termbox.
The text was updated successfully, but these errors were encountered: