Skip to content

Commit

Permalink
Characters can be escaped with '\'
Browse files Browse the repository at this point in the history
Fix #24
  • Loading branch information
Canop committed Feb 15, 2021
1 parent e80759c commit 185b15a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<a name="v0.10.0"></a>
### v0.10.0 - 2021-02-15
- Style characters can now be escaped with a '\' - Fix #24

<a name="v0.9.7"></a>
### v0.9.7 - 2021-02-10
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "termimad"
version = "0.9.7"
version = "0.10.0"
authors = ["dystroy <denys.seguret@gmail.com>"]
repository = "https://github.com/Canop/termimad"
description = "Markdown Renderer for the Terminal"
Expand All @@ -12,8 +12,8 @@ readme = "README.md"

[dependencies]
lazy_static = "1.4"
minimad = "0.6.9"
crossterm = "0.17.7"
minimad = "0.7.0"
crossterm = "0.19.0"
crossbeam = "0.8"
thiserror = "1.0"
unicode-width = "0.1.8"
Expand Down
29 changes: 20 additions & 9 deletions src/events/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use {
crossterm::{
self,
event::{
KeyCode, KeyModifiers,
KeyCode, KeyModifiers, MouseEventKind,
},
},
};
Expand Down Expand Up @@ -44,21 +44,32 @@ impl Event {
}
Some(Event::Key(key))
}
crossterm::event::Event::Mouse(crossterm::event::MouseEvent::Up(button, x, y, modifiers)) => {
crossterm::event::Event::Resize(w, h) => {
Some(Event::Resize(w, h))
}
crossterm::event::Event::Mouse(
crossterm::event::MouseEvent {
kind: MouseEventKind::Up(button),
column,
row,
modifiers,
}
) => {
use crossterm::event::MouseButton::*;
match button {
Left => Some(Event::Click(x, y, modifiers)),
Right => Some(Event::RightClick(x, y, modifiers)),
Left => Some(Event::Click(column, row, modifiers)),
Right => Some(Event::RightClick(column, row, modifiers)),
_ => None
}
}
crossterm::event::Event::Resize(w, h) => {
Some(Event::Resize(w, h))
}
crossterm::event::Event::Mouse(crossterm::event::MouseEvent::ScrollUp(..)) => {
crossterm::event::Event::Mouse(
crossterm::event::MouseEvent { kind: MouseEventKind::ScrollUp, .. }
) => {
Some(Event::Wheel(-1))
}
crossterm::event::Event::Mouse(crossterm::event::MouseEvent::ScrollDown(..)) => {
crossterm::event::Event::Mouse(
crossterm::event::MouseEvent { kind: MouseEventKind::ScrollDown, .. }
) => {
Some(Event::Wheel(1))
}
_ => None,
Expand Down

0 comments on commit 185b15a

Please sign in to comment.