Skip to content
This repository has been archived by the owner on Aug 6, 2023. It is now read-only.

Empty lines (containing "") are hidden in List output #680

Closed
fritzrehde opened this issue Nov 23, 2022 · 1 comment
Closed

Empty lines (containing "") are hidden in List output #680

fritzrehde opened this issue Nov 23, 2022 · 1 comment
Labels

Comments

@fritzrehde
Copy link

Description

I am building an alternative to the watch command watchbind.
I am using the widget List with Listitems.
I am wondering why the example code

	let items = vec![
		ListItem::new("line one"),
		ListItem::new(""),
		ListItem::new("line four"),
	];
	let list = List::new(items)
		.style(Style::default().fg(Color::White))
		.highlight_style(Style::default().fg(Color::Black).bg(Color::White));
	f.render_stateful_widget(list, f.size(), &mut events.state);

does not render the second line, but the state obviously knows about it because I can scroll normally with j and k (which I programmed).

To Reproduce

Expected behavior

All lines should be visible in the output, even the empty lines.

Screenshots

2022-11-23-23:54:08
On the left side is the output of watchbind -- git -h, on the right side git -h. As you can see, the empty lines are omitted on the left, which uses the tui List widget.

Environment

  • OS: Linux
  • Terminal Emulator: kitty
  • Crate version: 0.19
  • Backend: crossterm

Additional context

@fritzrehde fritzrehde added the bug label Nov 23, 2022
@fritzrehde
Copy link
Author

I have switched to Table with Rows over List and now all Lines are displayed correctly. It seems like List just ignored empty lines.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants