mirror of
https://github.com/veeso/termscp.git
synced 2026-06-08 14:18:41 +02:00
Use highlight symbol instead of an additional span
This commit is contained in:
@@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
Released on 13/04/2021
|
Released on 13/04/2021
|
||||||
|
|
||||||
|
- Enhancements:
|
||||||
|
- Use highlight symbol for logbox of `tui-rs` instead of adding a `Span`
|
||||||
- Bugfix:
|
- Bugfix:
|
||||||
- removed `eprintln!` in ftp transfer causing UI to break in Windows
|
- removed `eprintln!` in ftp transfer causing UI to break in Windows
|
||||||
|
|
||||||
|
|||||||
@@ -144,8 +144,7 @@ impl Component for LogBox {
|
|||||||
None => Vec::new(),
|
None => Vec::new(),
|
||||||
Some(table) => table
|
Some(table) => table
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.map(|row| {
|
||||||
.map(|(idx, row)| {
|
|
||||||
let mut columns: VecDeque<Span> = row
|
let mut columns: VecDeque<Span> = row
|
||||||
.iter()
|
.iter()
|
||||||
.map(|col| {
|
.map(|col| {
|
||||||
@@ -161,15 +160,7 @@ impl Component for LogBox {
|
|||||||
// Let's convert column spans into Spans rows NOTE: -4 because first line is always made by 5 columns; but there's always 1
|
// Let's convert column spans into Spans rows NOTE: -4 because first line is always made by 5 columns; but there's always 1
|
||||||
let mut rows: Vec<Spans> = Vec::with_capacity(columns.len() - 4);
|
let mut rows: Vec<Spans> = Vec::with_capacity(columns.len() - 4);
|
||||||
// Get first row
|
// Get first row
|
||||||
let mut first_row: Vec<Span> = vec![Span::styled(
|
let mut first_row: Vec<Span> = Vec::with_capacity(5);
|
||||||
match self.states.list_index == idx {
|
|
||||||
true => "> ",
|
|
||||||
false => " ",
|
|
||||||
},
|
|
||||||
Style::default()
|
|
||||||
.fg(self.props.foreground)
|
|
||||||
.bg(self.props.background),
|
|
||||||
)];
|
|
||||||
for _ in 0..5 {
|
for _ in 0..5 {
|
||||||
if let Some(col) = columns.pop_front() {
|
if let Some(col) = columns.pop_front() {
|
||||||
first_row.push(col);
|
first_row.push(col);
|
||||||
@@ -204,6 +195,7 @@ impl Component for LogBox {
|
|||||||
.title(title),
|
.title(title),
|
||||||
)
|
)
|
||||||
.start_corner(Corner::BottomLeft)
|
.start_corner(Corner::BottomLeft)
|
||||||
|
.highlight_symbol(">> ")
|
||||||
.highlight_style(Style::default().add_modifier(self.props.get_modifiers()));
|
.highlight_style(Style::default().add_modifier(self.props.get_modifiers()));
|
||||||
let mut state: ListState = ListState::default();
|
let mut state: ListState = ListState::default();
|
||||||
state.select(Some(self.states.list_index));
|
state.select(Some(self.states.list_index));
|
||||||
|
|||||||
Reference in New Issue
Block a user