Skip to content

Commit 665ae2b

Browse files
display some table metadata
1 parent 17942db commit 665ae2b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ where `connection_url` includes the username:password for accessing the database
2323
- [x] basic tui-textarea vim keybindings
2424
- [x] handle custom types / enums
2525
- [ ] display rows affected
26-
- [ ] table footer
2726
- [ ] table selection and yanking
2827
- [ ] keybindings hints at bottom
2928
- [ ] handle mouse events

src/components/data.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,18 @@ impl<'a> Component for Data<'a> {
166166
fn draw(&mut self, f: &mut Frame<'_>, area: Rect, app_state: &AppState) -> Result<()> {
167167
let focused = app_state.focus == Focus::Data;
168168

169-
let block = Block::default().title("results").borders(Borders::ALL).border_style(if focused {
169+
let mut block = Block::default().borders(Borders::ALL).border_style(if focused {
170170
Style::new().green()
171171
} else {
172172
Style::new().dim()
173173
});
174174

175+
if let DataState::HasResults(rows) = &self.data_state {
176+
block = block.title(format!("results ({} rows)", rows.len()));
177+
} else {
178+
block = block.title("results");
179+
}
180+
175181
match &self.data_state {
176182
DataState::NoResults => {
177183
f.render_widget(Paragraph::new("no results").wrap(Wrap { trim: false }).block(block), area);

0 commit comments

Comments
 (0)