mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-21 15:59:20 +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 =
|
let text_and_rects_res =
|
||||||
super::render_ast::expr2_to_wgpu(
|
super::render_ast::expr2_to_wgpu(
|
||||||
|
&mut ed_model.markup_root,
|
||||||
&render_ast_arena,
|
&render_ast_arena,
|
||||||
&mut ed_model.module.env,
|
&mut ed_model.module.env,
|
||||||
&ed_model.module.ast_root,
|
&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 {
|
match text_and_rects_res {
|
||||||
Ok((text_section, rects)) => {
|
Ok((text_section, rects)) => {
|
||||||
|
|
||||||
glyph_brush.queue(text_section);
|
glyph_brush.queue(text_section);
|
||||||
|
|
||||||
match draw_all_rects(
|
match draw_all_rects(
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
use super::app_model;
|
|
||||||
use super::app_model::AppModel;
|
use super::app_model::AppModel;
|
||||||
use crate::editor::ed_error::EdResult;
|
use crate::editor::ed_error::EdResult;
|
||||||
use crate::ui::text::{
|
|
||||||
lines::{MutSelectableLines, SelectableLines},
|
|
||||||
text_pos::TextPos,
|
|
||||||
};
|
|
||||||
use crate::ui::ui_error::UIResult;
|
use crate::ui::ui_error::UIResult;
|
||||||
use crate::window::keyboard_input::from_winit;
|
use crate::window::keyboard_input::from_winit;
|
||||||
use winit::event::{ModifiersState, VirtualKeyCode};
|
use winit::event::{ModifiersState, VirtualKeyCode};
|
||||||
@ -41,10 +36,10 @@ pub fn handle_cut(app_model: &mut AppModel) -> EdResult<()> {
|
|||||||
|
|
||||||
pub fn pass_keydown_to_focused(
|
pub fn pass_keydown_to_focused(
|
||||||
modifiers_winit: &ModifiersState,
|
modifiers_winit: &ModifiersState,
|
||||||
virtual_keycode: VirtualKeyCode,
|
_virtual_keycode: VirtualKeyCode,
|
||||||
app_model: &mut AppModel,
|
app_model: &mut AppModel,
|
||||||
) -> UIResult<()> {
|
) -> 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 let Some(ref mut ed_model) = app_model.ed_model_opt {
|
||||||
if ed_model.has_focus {
|
if ed_model.has_focus {
|
||||||
@ -55,7 +50,7 @@ pub fn pass_keydown_to_focused(
|
|||||||
Ok(())
|
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 let Some(ref mut ed_model) = app_model.ed_model_opt {
|
||||||
if ed_model.has_focus {
|
if ed_model.has_focus {
|
||||||
unimplemented!("TODO");
|
unimplemented!("TODO");
|
||||||
|
@ -4,23 +4,16 @@ use crate::editor::ed_error::EdError::ParseError;
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use crate::lang::expr::{Env, str_to_expr2};
|
use crate::lang::expr::{Env, str_to_expr2};
|
||||||
use crate::lang::{
|
use crate::lang::{
|
||||||
pool::{Pool, NodeId},
|
|
||||||
scope::Scope,
|
|
||||||
ast::Expr2,
|
ast::Expr2,
|
||||||
expr::Output,
|
|
||||||
};
|
};
|
||||||
use bumpalo::Bump;
|
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;
|
use crate::editor::markup::MarkupNode;
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct EdModel<'a> {
|
pub struct EdModel<'a> {
|
||||||
pub module: EdModule<'a>,
|
pub module: EdModule<'a>,
|
||||||
markup_root: MarkupNode,
|
pub markup_root: MarkupNode,
|
||||||
pub glyph_dim_rect_opt: Option<Rect>,
|
pub glyph_dim_rect_opt: Option<Rect>,
|
||||||
pub has_focus: bool,
|
pub has_focus: bool,
|
||||||
carets: Vec<&'a MarkupNode>,
|
carets: Vec<&'a MarkupNode>,
|
||||||
|
@ -19,6 +19,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub fn expr2_to_wgpu<'a>(
|
pub fn expr2_to_wgpu<'a>(
|
||||||
|
markup_root: &'a mut MarkupNode,
|
||||||
arena: &'a Bump,
|
arena: &'a Bump,
|
||||||
env: &mut Env<'a>,
|
env: &mut Env<'a>,
|
||||||
expr2: &Expr2,
|
expr2: &Expr2,
|
||||||
@ -27,9 +28,9 @@ pub fn expr2_to_wgpu<'a>(
|
|||||||
config: &Config,
|
config: &Config,
|
||||||
glyph_dim_rect: Rect,
|
glyph_dim_rect: Rect,
|
||||||
) -> EdResult<(wgpu_glyph::Section<'a>, Vec<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>(
|
pub fn build_code_graphics<'a>(
|
||||||
@ -102,7 +103,7 @@ fn markup_to_wgpu_helper<'a>(
|
|||||||
MarkupNode::Hole { ast_node_id: _, attributes: _} =>
|
MarkupNode::Hole { ast_node_id: _, attributes: _} =>
|
||||||
{
|
{
|
||||||
let hole_placeholder = " ";
|
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_color(colors::to_slice(colors::WHITE))
|
||||||
.with_scale(font_size);
|
.with_scale(font_size);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user