last speck of dust

This commit is contained in:
Penwing 2024-01-25 20:54:54 +01:00
parent 4320990497
commit 0c466a322e
2 changed files with 166 additions and 167 deletions

View file

@ -303,11 +303,8 @@ impl CodeEditor {
{ {
if let Some(range) = last_cursor { if let Some(range) = last_cursor {
if range.primary.index != range.secondary.index { if range.primary.index != range.secondary.index {
(*text, extend) = self.add_start_of_line( (*text, extend) =
*range, self.add_start_of_line(*range, previous_text.clone(), "\t");
previous_text.clone(),
"\t",
);
get_new_cursor = false; get_new_cursor = false;
} }
} }
@ -337,8 +334,7 @@ impl CodeEditor {
} else if let Some(cursor_range) = *last_cursor { } else if let Some(cursor_range) = *last_cursor {
let mut start = let mut start =
min(cursor_range.primary.index, cursor_range.secondary.index); min(cursor_range.primary.index, cursor_range.secondary.index);
let end = let end = max(cursor_range.primary.index, cursor_range.secondary.index);
max(cursor_range.primary.index, cursor_range.secondary.index);
let extended = match end as isize + extend { let extended = match end as isize + extend {
// Check for overflow or negative result // Check for overflow or negative result
value if value < 0 => 0, value if value < 0 => 0,

View file

@ -49,7 +49,10 @@ fn main() -> Result<(), eframe::Error> {
let app_state: tools::AppState = if Path::new(SAVE_PATH).exists() { let app_state: tools::AppState = if Path::new(SAVE_PATH).exists() {
tools::load_state(SAVE_PATH).expect("Failed to load the save") tools::load_state(SAVE_PATH).expect("Failed to load the save")
} else { } else {
tools::AppState {tabs: vec![], theme: 0,} tools::AppState {
tabs: vec![],
theme: 0,
}
}; };
eframe::run_native( eframe::run_native(