Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/bin/edit/draw_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ pub fn draw_handle_save(ctx: &mut Context, state: &mut State) {
pub fn draw_handle_wants_close(ctx: &mut Context, state: &mut State) {
let Some(doc) = state.documents.active() else {
state.wants_close = false;
state.wants_exit = true;
return;
};

Expand Down
11 changes: 7 additions & 4 deletions src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ impl ButtonStyle {
pub fn accelerator(self, char: char) -> Self {
Self { accelerator: Some(char), ..self }
}
/// Draw a checkbox prefix: `[ Example Button]`
/// Draw a checkbox prefix: `[🗹 Example Button]`
pub fn checked(self, checked: bool) -> Self {
Self { checked: Some(checked), ..self }
}
Expand Down Expand Up @@ -2289,7 +2289,8 @@ impl<'a> Context<'a, '_> {
let trackable = track_rect.height() - tc.thumb_height;
let delta_y = mouse.y - self.tui.mouse_down_position.y;
tc.scroll_offset.y = tc.scroll_offset_y_drag_start
+ (delta_y as f64 / trackable as f64 * scrollable_height as f64) as CoordType;
+ (delta_y as i64 * scrollable_height as i64 / trackable as i64)
as CoordType;
Comment on lines +2292 to +2293

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in #315, I'd like to use floats here once everything uses floats. I think that makes sense long-term. For now, I'd like to stick with i64 for intermediate results for consistency.

}
}
}
Expand Down Expand Up @@ -2816,7 +2817,9 @@ impl<'a> Context<'a, '_> {
let delta_y =
self.tui.mouse_position.y - self.tui.mouse_down_position.y;
sc.scroll_offset.y = sc.scroll_offset_y_drag_start
+ (delta_y as f64 / trackable as f64 * scrollable_height as f64) as CoordType;
+ (delta_y as i64 * scrollable_height as i64
/ trackable as i64)
as CoordType;
}

self.set_input_consumed();
Expand Down Expand Up @@ -3205,7 +3208,7 @@ impl<'a> Context<'a, '_> {
self.styled_label_add_text("[");
}
if let Some(checked) = style.checked {
self.styled_label_add_text(if checked { " " } else { " " });
self.styled_label_add_text(if checked { "🗹 " } else { " " });
}
// Label text
match style.accelerator {
Expand Down