Another round of polishing (#101)

* Implement basic refactorings

* Simplify some match statements

* Rename `ix` to `index`

If we're not going with a single letter name,
then a full word makes more sense.

* Rename `as_hex` to `to_hex`

`as_` implies lossless reinterpretation
while the function does a conversion that loses information

* Replace `for_each` with for loops

for loops are a lot easier to read and maintain.

* factor out x and y coords in Line::render

this is arguably more ergonomic

* Remove redundant `format!(format_args!())`
This commit is contained in:
T0mstone
2021-05-07 02:47:38 -07:00
committed by Keavon Chambers
parent c9fea54ec5
commit 47458115b8
12 changed files with 65 additions and 73 deletions
+2
View File
@@ -7,6 +7,7 @@ use wasm_bindgen::prelude::*;
fn convert_error(err: editor_core::EditorError) -> JsValue {
Error::new(&err.to_string()).into()
}
mod mouse_state {
pub(super) type MouseKeys = u8;
use editor_core::events::{self, Event, MouseState, ViewportPosition};
@@ -35,6 +36,7 @@ mod mouse_state {
}
}
}
/// Modify the currently selected tool in the document state store
#[wasm_bindgen]
pub fn select_tool(tool: String) -> Result<(), JsValue> {