hello, i am trying to switch with keys between tabs and j + k up/down within list widget, it works fine but when i switch between tabs it keeps some of the old characters of the list from a different tab
i attached photos of what happens when rendering and switching between tabs
(backend crossterm)
.
i also tried using the clear widget before calling frame. render_widget / render_stateful
here is my implementation:
tabs:
fn render(
frame: &mut Frame,
list_state: &mut ListState,
filter_input: &mut tui_input::TuiInput,
nextkey: Option<KeyEvent>,
) {
..
let main_chunks = Layout::default()
.direction(Direction::Vertical)
.constraints([
Constraint::Length(1), // Header text
Constraint::Min(1), // Main Body (List + Table)
Constraint::Length(2), // Application metadata footer
])
.split(frame.size());
// --- STEP 2: Body (Horizontal Split) ---
let body_chunks = Layout::default()
.direction(Direction::Horizontal)
.constraints([
Constraint::Ratio(1, 4), // Services List
Constraint::Ratio(3, 4), // Logs Table (and its headers)
])
.split(main_chunks[1]);
...
render_buffer_tabs(frame, body_chunks[1], nextkey);
if (filter_input.render_input(servicechunk[1], frame, nextkey)) {
list_state.select(Some(0 as usize));
}
}
fn render_buffer_tabs(frame: &mut Frame, area: Rect, nextkey: Option) {
let tab_chunks = Layout::default().direction(Direction::Vertical).constraints([Constraint::Length(1),Constraint::Min(0),]).split(area);
let mut buffers = get_buffers().lock().unwrap();
let tab_titles: Vec<String> = buffers
.iter()
.map(|b| format!("📝{}", b.unit.clone()))
.collect();
let tabs = Tabs::new(tab_titles)
.highlight_style(Style::new().fg(SEETui::FOCUSED_COLOR).bold())
.select(SELECTED_BUFFER.load(Ordering::SeqCst))
.divider("|")
.padding(" ", " ");
frame.render_widget(tabs, tab_chunks[0]);
}
list:
fn render(&mut self, area: Rect, frame: &mut Frame, key: Option<KeyEvent>) {
...
let main_chunks = Layout::default()
.direction(Direction::Vertical)
.constraints([
Constraint::Min(3),
...
])
.split(area);
...
self.render_logs(frame, main_chunks[0]);
}
pub fn render_logs(&mut self, frame: &mut Frame, area: Rect) {
if self.pull_data() {
self.lstate.select_last();
}
let cool_block = Block::default()
.borders(Borders::ALL)
.padding(Padding::new(0, 1, 0, 0))
.bg(Color::Rgb(20, 20, 25))
.border_type(BorderType::Rounded)
.border_style(if self.inputstate == InputMode::SelectLog {
SEETui::FOCUSED_COLOR
} else {
SEETui::UNFOCUSED_COLOR
});
let list = List::new(self.log_data.clone())
.block(cool_block)
.highlight_symbol(">>")
.bg(Color::Rgb(20, 20, 25))
.highlight_style(Style::new().white().bg(SEETui::FOCUSED_COLOR));
frame.render_stateful_widget(list, area, &mut self.lstate);
}

