Remove lazy_static dep.
This commit is contained in:
parent
d7e9e3085f
commit
b97eb0603b
7 changed files with 74 additions and 60 deletions
16
src/tab.rs
16
src/tab.rs
|
|
@ -47,14 +47,18 @@ impl EditorTab {
|
|||
|
||||
let mut buffer = Buffer::new_empty(config.metrics());
|
||||
buffer.set_text(
|
||||
&mut FONT_SYSTEM.lock().unwrap(),
|
||||
&mut FONT_SYSTEM.get().unwrap().lock().unwrap(),
|
||||
"",
|
||||
attrs,
|
||||
Shaping::Advanced,
|
||||
);
|
||||
|
||||
let editor =
|
||||
SyntaxEditor::new(Arc::new(buffer), &SYNTAX_SYSTEM, config.syntax_theme()).unwrap();
|
||||
let editor = SyntaxEditor::new(
|
||||
Arc::new(buffer),
|
||||
SYNTAX_SYSTEM.get().unwrap(),
|
||||
config.syntax_theme(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let mut tab = Self {
|
||||
path_opt: None,
|
||||
|
|
@ -71,7 +75,7 @@ impl EditorTab {
|
|||
|
||||
pub fn set_config(&mut self, config: &Config) {
|
||||
let mut editor = self.editor.lock().unwrap();
|
||||
let mut font_system = FONT_SYSTEM.lock().unwrap();
|
||||
let mut font_system = FONT_SYSTEM.get().unwrap().lock().unwrap();
|
||||
let mut editor = editor.borrow_with(&mut font_system);
|
||||
editor.set_auto_indent(config.auto_indent);
|
||||
editor.set_passthrough(!config.vim_bindings);
|
||||
|
|
@ -89,7 +93,7 @@ impl EditorTab {
|
|||
|
||||
pub fn open(&mut self, path: PathBuf) {
|
||||
let mut editor = self.editor.lock().unwrap();
|
||||
let mut font_system = FONT_SYSTEM.lock().unwrap();
|
||||
let mut font_system = FONT_SYSTEM.get().unwrap().lock().unwrap();
|
||||
let mut editor = editor.borrow_with(&mut font_system);
|
||||
match editor.load_text(&path, self.attrs) {
|
||||
Ok(()) => {
|
||||
|
|
@ -111,7 +115,7 @@ impl EditorTab {
|
|||
|
||||
pub fn reload(&mut self) {
|
||||
let mut editor = self.editor.lock().unwrap();
|
||||
let mut font_system = FONT_SYSTEM.lock().unwrap();
|
||||
let mut font_system = FONT_SYSTEM.get().unwrap().lock().unwrap();
|
||||
let mut editor = editor.borrow_with(&mut font_system);
|
||||
if let Some(path) = &self.path_opt {
|
||||
// Save scroll
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue