Skip to content

Commit 95f4635

Browse files
update TODOs
1 parent 6ff551f commit 95f4635

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ or
1010

1111
`cargo run -- -u $(connection_url)`
1212

13-
where `connection_url` includes the username:password for accessing the database (ex. postgres://username:password@localhost:5432/postgres)
13+
where `connection_url` includes the username:password for accessing the database (ex. `postgres://username:password@localhost:5432/postgres`)
1414

1515
## known issues
1616
- for query results with many columns, the height of the rendered `Table` widget may be limited, as the maximum area of the underlying buffer is `u16::MAX` (65,535)
@@ -20,7 +20,8 @@ where `connection_url` includes the username:password for accessing the database
2020
- [x] cancellable async querying (spawn tokio task)
2121
- [x] menu list with tables and schemas (collapsable)
2222
- [x] tui-textarea for query editor
23-
- [ ] tui-textarea vim keybindings
23+
- [x] basic tui-textarea vim keybindings
24+
= [ ] table footer
2425
- [ ] table selection and yanking
2526
- [ ] keybindings hints at bottom
2627
- [ ] handle mouse events
@@ -31,3 +32,4 @@ where `connection_url` includes the username:password for accessing the database
3132
- [ ] loading animation
3233
- [ ] table styling
3334
- [ ] perf (limit rendering)
35+
- [ ] improved tui-textarea vim keybindings

src/vim.rs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,13 @@ impl Mode {
3939
}
4040

4141
pub fn cursor_style(&self) -> Style {
42-
let color = match self {
43-
Self::Normal => Color::Reset,
44-
Self::Insert => Color::LightBlue,
45-
Self::Visual => Color::LightYellow,
46-
Self::Replace => Color::LightGreen,
47-
Self::Operator(_) => Color::LightGreen,
48-
};
49-
Style::default().add_modifier(Modifier::REVERSED)
42+
match self {
43+
Self::Normal => Style::default().fg(Color::Reset).add_modifier(Modifier::REVERSED),
44+
Self::Insert => Style::default().fg(Color::LightBlue).add_modifier(Modifier::SLOW_BLINK | Modifier::REVERSED),
45+
Self::Visual => Style::default().fg(Color::LightYellow).add_modifier(Modifier::REVERSED),
46+
Self::Replace => Style::default().fg(Color::LightMagenta).add_modifier(Modifier::UNDERLINED | Modifier::REVERSED),
47+
Self::Operator(_) => Style::default().fg(Color::LightGreen).add_modifier(Modifier::REVERSED),
48+
}
5049
}
5150
}
5251

@@ -101,6 +100,7 @@ impl Vim {
101100
Input { key: Key::Char('e'), ctrl: false, .. } => textarea.move_cursor(CursorMove::WordForward),
102101
Input { key: Key::Char('b'), ctrl: false, .. } => textarea.move_cursor(CursorMove::WordBack),
103102
Input { key: Key::Char('^'), .. } => textarea.move_cursor(CursorMove::Head),
103+
Input { key: Key::Char('0'), .. } => textarea.move_cursor(CursorMove::Head),
104104
Input { key: Key::Char('$'), .. } => textarea.move_cursor(CursorMove::End),
105105
Input { key: Key::Char('D'), .. } => {
106106
textarea.delete_line_by_end();
@@ -245,13 +245,15 @@ impl Vim {
245245
},
246246
}
247247
},
248-
Mode::Replace => match input {
249-
Input { key: Key::Esc, .. } | Input { key: Key::Char('c'), ctrl: true, .. } => Transition::Mode(Mode::Normal),
250-
input => {
251-
textarea.delete_str(1);
252-
textarea.input(input);
253-
Transition::Mode(Mode::Normal)
254-
},
248+
Mode::Replace => {
249+
match input {
250+
Input { key: Key::Esc, .. } | Input { key: Key::Char('c'), ctrl: true, .. } => Transition::Mode(Mode::Normal),
251+
input => {
252+
textarea.delete_str(1);
253+
textarea.input(input);
254+
Transition::Mode(Mode::Normal)
255+
},
256+
}
255257
},
256258
}
257259
}

0 commit comments

Comments
 (0)