Better click behaviour
This commit is contained in:
parent
30fea7233d
commit
f2a9876b81
3 changed files with 15 additions and 10 deletions
|
|
@ -14,10 +14,10 @@
|
||||||
- [x] Search in buffer switcher
|
- [x] Search in buffer switcher
|
||||||
- [x] File saving
|
- [x] File saving
|
||||||
- [x] Syntax highlighting
|
- [x] Syntax highlighting
|
||||||
|
- [x] Project search
|
||||||
|
- [x] Auto-indent (and related features)
|
||||||
|
- [x] Undo/redo
|
||||||
|
|
||||||
## Todo
|
## Todo
|
||||||
|
|
||||||
- [ ] Replace
|
- [ ] Replace
|
||||||
- [ ] Project search
|
|
||||||
- [ ] Auto-indent (and related features)
|
|
||||||
- [ ] Undo/redo
|
|
||||||
|
|
@ -88,7 +88,7 @@ impl Default for Theme {
|
||||||
option_new: Color::AnsiValue(148),
|
option_new: Color::AnsiValue(148),
|
||||||
|
|
||||||
hl_token_whitespace: Color::Reset,
|
hl_token_whitespace: Color::Reset,
|
||||||
hl_token_ident: Color::AnsiValue(7),
|
hl_token_ident: Color::AnsiValue(15),
|
||||||
hl_token_keyword: Color::AnsiValue(112),
|
hl_token_keyword: Color::AnsiValue(112),
|
||||||
hl_token_number: Color::AnsiValue(45),
|
hl_token_number: Color::AnsiValue(45),
|
||||||
hl_token_type: Color::AnsiValue(210),
|
hl_token_type: Color::AnsiValue(210),
|
||||||
|
|
|
||||||
|
|
@ -131,11 +131,16 @@ impl Input {
|
||||||
Ok(Resp::handled(None))
|
Ok(Resp::handled(None))
|
||||||
}
|
}
|
||||||
Some(Action::Mouse(MouseAction::Click, pos, false)) => {
|
Some(Action::Mouse(MouseAction::Click, pos, false)) => {
|
||||||
buffer.goto_cursor(
|
let pos = [self.focus[0] + pos[0], self.focus[1] + pos[1]];
|
||||||
cursor_id,
|
// If we're already in the right place, select the token instead
|
||||||
[self.focus[0] + pos[0], self.focus[1] + pos[1]],
|
if let Some(cursor) = buffer.cursors.get(cursor_id)
|
||||||
true,
|
&& cursor.selection().is_none()
|
||||||
);
|
&& buffer.text.to_coord(cursor.pos) == pos
|
||||||
|
{
|
||||||
|
buffer.select_token_cursor(cursor_id);
|
||||||
|
} else {
|
||||||
|
buffer.goto_cursor(cursor_id, pos, true);
|
||||||
|
}
|
||||||
Ok(Resp::handled(None))
|
Ok(Resp::handled(None))
|
||||||
}
|
}
|
||||||
Some(
|
Some(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue