diff --git a/editor/src/editor/main.rs b/editor/src/editor/main.rs index ff9363e4d3..62b032a9df 100644 --- a/editor/src/editor/main.rs +++ b/editor/src/editor/main.rs @@ -275,6 +275,7 @@ fn run_event_loop(file_path_opt: Option<&Path>) -> Result<(), Box> { let text_and_rects_res = super::render_ast::expr2_to_wgpu( + &mut ed_model.markup_root, &render_ast_arena, &mut ed_model.module.env, &ed_model.module.ast_root, @@ -286,6 +287,7 @@ fn run_event_loop(file_path_opt: Option<&Path>) -> Result<(), Box> { match text_and_rects_res { Ok((text_section, rects)) => { + glyph_brush.queue(text_section); match draw_all_rects( diff --git a/editor/src/editor/mvc/app_update.rs b/editor/src/editor/mvc/app_update.rs index fcde16f199..a0c3702f2d 100644 --- a/editor/src/editor/mvc/app_update.rs +++ b/editor/src/editor/mvc/app_update.rs @@ -1,10 +1,5 @@ -use super::app_model; use super::app_model::AppModel; use crate::editor::ed_error::EdResult; -use crate::ui::text::{ - lines::{MutSelectableLines, SelectableLines}, - text_pos::TextPos, -}; use crate::ui::ui_error::UIResult; use crate::window::keyboard_input::from_winit; use winit::event::{ModifiersState, VirtualKeyCode}; @@ -41,10 +36,10 @@ pub fn handle_cut(app_model: &mut AppModel) -> EdResult<()> { pub fn pass_keydown_to_focused( modifiers_winit: &ModifiersState, - virtual_keycode: VirtualKeyCode, + _virtual_keycode: VirtualKeyCode, app_model: &mut AppModel, ) -> UIResult<()> { - let modifiers = from_winit(modifiers_winit); + let _modifiers = from_winit(modifiers_winit); if let Some(ref mut ed_model) = app_model.ed_model_opt { if ed_model.has_focus { @@ -55,7 +50,7 @@ pub fn pass_keydown_to_focused( Ok(()) } -pub fn handle_new_char(received_char: &char, app_model: &mut AppModel) -> EdResult<()> { +pub fn handle_new_char(_received_char: &char, app_model: &mut AppModel) -> EdResult<()> { if let Some(ref mut ed_model) = app_model.ed_model_opt { if ed_model.has_focus { unimplemented!("TODO"); diff --git a/editor/src/editor/mvc/ed_model.rs b/editor/src/editor/mvc/ed_model.rs index 907c5197be..0c911fb752 100644 --- a/editor/src/editor/mvc/ed_model.rs +++ b/editor/src/editor/mvc/ed_model.rs @@ -4,23 +4,16 @@ use crate::editor::ed_error::EdError::ParseError; use std::path::Path; use crate::lang::expr::{Env, str_to_expr2}; use crate::lang::{ - pool::{Pool, NodeId}, - scope::Scope, ast::Expr2, - expr::Output, }; use bumpalo::Bump; -use roc_module::symbol::{IdentIds, ModuleIds}; -use roc_region::all::Region; -use roc_types::subs::VarStore; -use std::collections::HashSet; use crate::editor::markup::MarkupNode; #[derive(Debug)] pub struct EdModel<'a> { pub module: EdModule<'a>, - markup_root: MarkupNode, + pub markup_root: MarkupNode, pub glyph_dim_rect_opt: Option, pub has_focus: bool, carets: Vec<&'a MarkupNode>, diff --git a/editor/src/editor/render_ast.rs b/editor/src/editor/render_ast.rs index 2a251cfaa7..6f7a4d1360 100644 --- a/editor/src/editor/render_ast.rs +++ b/editor/src/editor/render_ast.rs @@ -19,6 +19,7 @@ use crate::{ }; pub fn expr2_to_wgpu<'a>( + markup_root: &'a mut MarkupNode, arena: &'a Bump, env: &mut Env<'a>, expr2: &Expr2, @@ -27,9 +28,9 @@ pub fn expr2_to_wgpu<'a>( config: &Config, glyph_dim_rect: Rect, ) -> EdResult<(wgpu_glyph::Section<'a>, Vec)> { - let markup = expr2_to_markup(arena, env, expr2); + *markup_root = expr2_to_markup(arena, env, expr2); - build_code_graphics(&markup, size, position, config, glyph_dim_rect) + build_code_graphics(markup_root, size, position, config, glyph_dim_rect) } pub fn build_code_graphics<'a>( @@ -102,7 +103,7 @@ fn markup_to_wgpu_helper<'a>( MarkupNode::Hole { ast_node_id: _, attributes: _} => { let hole_placeholder = " "; - let glyph_text = wgpu_glyph::Text::new(" ") + let glyph_text = wgpu_glyph::Text::new(hole_placeholder) .with_color(colors::to_slice(colors::WHITE)) .with_scale(font_size);