Skip to content

Commit

Permalink
add sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
TBS1996 committed May 4, 2023
1 parent 26531a3 commit 839f5e3
Show file tree
Hide file tree
Showing 6 changed files with 220 additions and 16 deletions.
210 changes: 205 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ csv = "1.1.6"
epub = "1.2.4"
minidom = "0.15.0"
color-eyre = "0.6.2"
sentry = "0.31.0"


[dependencies.crossterm]
version = "0.25.0"
Expand Down
7 changes: 2 additions & 5 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,7 @@ impl TabsState {
}

fn keyhandler(&mut self, appdata: &AppData, key: MyKey) {
match key {
//MyKey::Nav(dir) => self.tabs[self.index].navigate(dir),
key => self.tabs[self.index].main_keyhandler(appdata, key),
}
self.tabs[self.index].main_keyhandler(appdata, key);
}
fn render(&mut self, f: &mut Frame<MyType>, appdata: &AppData, area: Rect) {
let mut navbar = vec![];
Expand Down Expand Up @@ -364,7 +361,7 @@ pub trait Tab {
}
return;
}
if let MyKey::KeyPress(pos) = key.clone() {
if let MyKey::KeyPress(pos) = key {
self.get_view().cursor = pos;
}
let cursor = self.get_cursor().clone();
Expand Down
9 changes: 7 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ pub type MyType = CrosstermBackend<std::io::Stdout>;
fn main() -> Result<()> {
env::set_var("RUST_BACKTRACE", "1");

let _guard = sentry::init(("https://9be966e9a25345528b66889e96ba8e4f@o4505092893573120.ingest.sentry.io/4505125412077568", sentry::ClientOptions {
release: sentry::release_name!(),
..Default::default()
}));

let paths = SpekiPaths::new(&home::home_dir().unwrap());
let is_new_db = init_db(&paths.database).unwrap();

Expand Down Expand Up @@ -165,13 +170,13 @@ impl MyKey {
if let Key(key) = event {
let modifiers = key.modifiers;

if modifiers == event::KeyModifiers::ALT || modifiers == event::KeyModifiers::META {
if modifiers == event::KeyModifiers::ALT || modifiers == event::KeyModifiers::SHIFT {
match key.code {
KeyCode::Char('h') | KeyCode::Left => return Some(MyKey::Nav(NavDir::Left)),
KeyCode::Char('j') | KeyCode::Down => return Some(MyKey::Nav(NavDir::Down)),
KeyCode::Char('k') | KeyCode::Up => return Some(MyKey::Nav(NavDir::Up)),
KeyCode::Char('l') | KeyCode::Right => return Some(MyKey::Nav(NavDir::Right)),
KeyCode::Char(c) => return Some(MyKey::Alt(c)),
KeyCode::Char(c) => return Some(MyKey::Alt(c.to_ascii_lowercase())),
_ => {}
}
}
Expand Down
Loading

0 comments on commit 839f5e3

Please sign in to comment.