diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2020-12-14 21:39:10 -0500 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2020-12-14 21:39:10 -0500 |
commit | 2b29f8485e95fd3cda434ed472992fff2ee8e7a0 (patch) | |
tree | b5adc9ab32c74597a163cf3efc49f6522932c5f8 /src/ui/widgets/tui_dirlist.rs | |
parent | cfaff5760fbf4f5d5d2261e2c02bd06d7e4dc824 (diff) |
selected item now highlights entire row instead of just filename
Diffstat (limited to 'src/ui/widgets/tui_dirlist.rs')
-rw-r--r-- | src/ui/widgets/tui_dirlist.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ui/widgets/tui_dirlist.rs b/src/ui/widgets/tui_dirlist.rs index 60b7374..afa3258 100644 --- a/src/ui/widgets/tui_dirlist.rs +++ b/src/ui/widgets/tui_dirlist.rs @@ -40,6 +40,8 @@ impl<'a> Widget for TuiDirList<'a> { let screen_index = curr_index % area.height as usize; let area_width = area.width as usize - 1; + let space_fill = " ".repeat(area_width); + for (i, entry) in self .dirlist .iter() @@ -51,7 +53,9 @@ impl<'a> Widget for TuiDirList<'a> { let name_width = name.width(); let style = if i == screen_index { - entry.get_style().add_modifier(Modifier::REVERSED) + let s = entry.get_style().add_modifier(Modifier::REVERSED); + buf.set_string(x, y + i as u16, space_fill.as_str(), s); + s } else { entry.get_style() }; |