cleanup
This commit is contained in:
parent
8604906d38
commit
bf58e82c80
16
Cargo.lock
generated
16
Cargo.lock
generated
@ -663,7 +663,7 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "eframe"
|
name = "eframe"
|
||||||
version = "0.18.0"
|
version = "0.18.0"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#20f3eea96218fe6a815d6734644c30a4caf9002b"
|
source = "git+https://github.com/Titaniumtown/egui.git#3d8de7653df58e0a4662b7c2c6c1e44a3b35f776"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"egui",
|
"egui",
|
||||||
@ -683,7 +683,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "egui"
|
name = "egui"
|
||||||
version = "0.18.1"
|
version = "0.18.1"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#20f3eea96218fe6a815d6734644c30a4caf9002b"
|
source = "git+https://github.com/Titaniumtown/egui.git#3d8de7653df58e0a4662b7c2c6c1e44a3b35f776"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
"epaint",
|
"epaint",
|
||||||
@ -694,7 +694,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "egui-winit"
|
name = "egui-winit"
|
||||||
version = "0.18.0"
|
version = "0.18.0"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#20f3eea96218fe6a815d6734644c30a4caf9002b"
|
source = "git+https://github.com/Titaniumtown/egui.git#3d8de7653df58e0a4662b7c2c6c1e44a3b35f776"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arboard",
|
"arboard",
|
||||||
"egui",
|
"egui",
|
||||||
@ -707,7 +707,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "egui_glow"
|
name = "egui_glow"
|
||||||
version = "0.18.0"
|
version = "0.18.0"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#20f3eea96218fe6a815d6734644c30a4caf9002b"
|
source = "git+https://github.com/Titaniumtown/egui.git#3d8de7653df58e0a4662b7c2c6c1e44a3b35f776"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"egui",
|
"egui",
|
||||||
@ -727,7 +727,7 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "emath"
|
name = "emath"
|
||||||
version = "0.18.0"
|
version = "0.18.0"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#20f3eea96218fe6a815d6734644c30a4caf9002b"
|
source = "git+https://github.com/Titaniumtown/egui.git#3d8de7653df58e0a4662b7c2c6c1e44a3b35f776"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
]
|
]
|
||||||
@ -735,7 +735,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "epaint"
|
name = "epaint"
|
||||||
version = "0.18.1"
|
version = "0.18.1"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#20f3eea96218fe6a815d6734644c30a4caf9002b"
|
source = "git+https://github.com/Titaniumtown/egui.git#3d8de7653df58e0a4662b7c2c6c1e44a3b35f776"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ab_glyph",
|
"ab_glyph",
|
||||||
"ahash",
|
"ahash",
|
||||||
@ -1803,9 +1803,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.37"
|
version = "1.0.38"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1"
|
checksum = "9027b48e9d4c9175fa2218adf3557f91c1137021739951d4932f5f8268ac48aa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use crate::consts::is_mobile;
|
use crate::consts::is_mobile;
|
||||||
use crate::function_entry::FunctionEntry;
|
use crate::function_entry::FunctionEntry;
|
||||||
use crate::widgets::{move_cursor_to_end, widgets_ontop, Movement};
|
use crate::widgets::{widgets_ontop, Movement};
|
||||||
use egui::{Button, Key, Modifiers, WidgetText};
|
use egui::{Button, Key, Modifiers, TextEdit, WidgetText};
|
||||||
use emath::vec2;
|
use emath::vec2;
|
||||||
use parsing::suggestions::Hint;
|
use parsing::suggestions::Hint;
|
||||||
use std::ops::BitXorAssign;
|
use std::ops::BitXorAssign;
|
||||||
@ -128,7 +128,11 @@ impl FunctionManager {
|
|||||||
|
|
||||||
// Push cursor to end if needed
|
// Push cursor to end if needed
|
||||||
if movement == Movement::Complete {
|
if movement == Movement::Complete {
|
||||||
move_cursor_to_end(ui.ctx(), te_id);
|
let mut state =
|
||||||
|
unsafe { TextEdit::load_state(ui.ctx(), te_id).unwrap_unchecked() };
|
||||||
|
let ccursor = egui::text::CCursor::new(function.autocomplete.string.len());
|
||||||
|
state.set_ccursor_range(Some(egui::text::CCursorRange::one(ccursor)));
|
||||||
|
TextEdit::store_state(ui.ctx(), te_id, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
use std::intrinsics::assume;
|
use std::intrinsics::assume;
|
||||||
|
|
||||||
use egui::{text::CCursor, text_edit::CursorRange, TextEdit};
|
|
||||||
use epaint::text::cursor::{Cursor, PCursor, RCursor};
|
|
||||||
use parsing::suggestions::{self, generate_hint, Hint};
|
use parsing::suggestions::{self, generate_hint, Hint};
|
||||||
|
|
||||||
#[derive(PartialEq, Debug)]
|
#[derive(PartialEq, Debug)]
|
||||||
@ -101,24 +99,6 @@ impl<'a> AutoComplete<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Moves cursor of TextEdit `te_id` to the end
|
|
||||||
pub fn move_cursor_to_end(ctx: &egui::Context, te_id: egui::Id) {
|
|
||||||
let mut state = unsafe { TextEdit::load_state(ctx, te_id).unwrap_unchecked() };
|
|
||||||
state.set_cursor_range(Some(CursorRange::one(Cursor {
|
|
||||||
ccursor: CCursor {
|
|
||||||
index: 0,
|
|
||||||
prefer_next_row: false,
|
|
||||||
},
|
|
||||||
rcursor: RCursor { row: 0, column: 0 },
|
|
||||||
pcursor: PCursor {
|
|
||||||
paragraph: 0,
|
|
||||||
offset: 10000,
|
|
||||||
prefer_next_row: false,
|
|
||||||
},
|
|
||||||
})));
|
|
||||||
TextEdit::store_state(ctx, te_id, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn widgets_ontop<R>(
|
pub fn widgets_ontop<R>(
|
||||||
ui: &egui::Ui, id: String, re: &egui::Response, y_offset: f32,
|
ui: &egui::Ui, id: String, re: &egui::Response, y_offset: f32,
|
||||||
add_contents: impl FnOnce(&mut egui::Ui) -> R,
|
add_contents: impl FnOnce(&mut egui::Ui) -> R,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user