mirror of
https://github.com/zellij-org/zellij.git
synced 2024-11-23 19:10:09 +03:00
Update deps and add a build script
This commit is contained in:
parent
a57eadee8c
commit
75136a613d
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
target/
|
||||
Cargo.lock
|
||||
Cargo.lock
|
||||
*.yaml
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "module"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
authors = ["Brooks J Rady <b.j.rady@gmail.com>"]
|
||||
edition = "2018"
|
||||
description = "A simplified ranger clone written as a mosaic tile"
|
||||
@ -9,5 +9,8 @@ license = "MIT"
|
||||
|
||||
[dependencies]
|
||||
colored = "2"
|
||||
mosaic-tile = "0.1"
|
||||
pretty-bytes = "0.2"
|
||||
mosaic-tile = "0.2"
|
||||
pretty-bytes = "0.2"
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
6
build-optimised.sh
Executable file
6
build-optimised.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Build a release WASM from Rust with lto on
|
||||
cargo build --release
|
||||
# Further optimise for speed (and size)
|
||||
wasm-opt -O target/wasm32-wasi/release/module.wasm -o target/strider.wasm
|
14
src/main.rs
14
src/main.rs
@ -13,7 +13,7 @@ impl MosaicTile for State {
|
||||
}
|
||||
|
||||
fn draw(&mut self, rows: usize, cols: usize) {
|
||||
for i in 0..rows - 1 {
|
||||
for i in 0..rows {
|
||||
if self.selected() < self.scroll() {
|
||||
*self.scroll_mut() = self.selected();
|
||||
}
|
||||
@ -39,23 +39,23 @@ impl MosaicTile for State {
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_key(&mut self, key: KeyEvent) {
|
||||
match key.code {
|
||||
KeyCode::Up => {
|
||||
fn handle_key(&mut self, key: Key) {
|
||||
match key {
|
||||
Key::Up => {
|
||||
*self.selected_mut() = self.selected().saturating_sub(1);
|
||||
}
|
||||
KeyCode::Down => {
|
||||
Key::Down => {
|
||||
let next = self.selected().saturating_add(1);
|
||||
*self.selected_mut() = min(self.files.len() - 1, next);
|
||||
}
|
||||
KeyCode::Right | KeyCode::Enter => match self.files[self.selected()].clone() {
|
||||
Key::Right | Key::Char('\n') => match self.files[self.selected()].clone() {
|
||||
FsEntry::Dir(p, _) => {
|
||||
self.path = p;
|
||||
refresh_directory(self);
|
||||
}
|
||||
FsEntry::File(p, _) => open_file(&p),
|
||||
},
|
||||
KeyCode::Left => {
|
||||
Key::Left => {
|
||||
self.path.pop();
|
||||
refresh_directory(self);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user