mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-11 05:34:11 +03:00
resolved some errors+warnings, stuck on borrowed data escapes closure
This commit is contained in:
parent
288061744f
commit
fdfdd80735
@ -275,6 +275,7 @@ fn run_event_loop(file_path_opt: Option<&Path>) -> Result<(), Box<dyn Error>> {
|
||||
|
||||
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<dyn Error>> {
|
||||
|
||||
match text_and_rects_res {
|
||||
Ok((text_section, rects)) => {
|
||||
|
||||
glyph_brush.queue(text_section);
|
||||
|
||||
match draw_all_rects(
|
||||
|
@ -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");
|
||||
|
@ -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<Rect>,
|
||||
pub has_focus: bool,
|
||||
carets: Vec<&'a MarkupNode>,
|
||||
|
@ -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<Rect>)> {
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user