Merge branch 'trunk' into add_lifetime_to_text

This commit is contained in:
Lucas 2021-02-09 21:17:44 -05:00 committed by GitHub
commit 0bb92f7952
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 9 deletions

View file

@ -32,7 +32,7 @@ fn text_buffer_from_str(lines_str: &str) -> TextBuffer {
TextBuffer { TextBuffer {
text_rope: Rope::from_str(lines_str), text_rope: Rope::from_str(lines_str),
path_str: "".to_owned(), path_str: "".to_owned(),
mem_arena: Bump::new(), arena: Bump::new(),
} }
} }

View file

@ -33,7 +33,7 @@ fn text_buffer_from_str(lines_str: &str) -> TextBuffer {
TextBuffer { TextBuffer {
text_rope: Rope::from_str(lines_str), text_rope: Rope::from_str(lines_str),
path_str: "".to_owned(), path_str: "".to_owned(),
mem_arena: bumpalo::Bump::new(), arena: bumpalo::Bump::new(),
} }
} }

View file

@ -8,6 +8,8 @@ Here are some ideas and interesting resources for the editor. Feel free to make
These are potentially inspirational resources for the editor's design. These are potentially inspirational resources for the editor's design.
Nice collection of research on innovative editors, [link](https://futureofcoding.org/catalog/).
### Package-specific editor integrations ### Package-specific editor integrations
(Or possibly module-specific integrations, type-specific integrations, etc.) (Or possibly module-specific integrations, type-specific integrations, etc.)
@ -28,6 +30,7 @@ These are potentially inspirational resources for the editor's design.
* [Xi](https://xi-editor.io/) modern text editor with concurrent editing (related to [Druid](https://github.com/linebender/druid)) * [Xi](https://xi-editor.io/) modern text editor with concurrent editing (related to [Druid](https://github.com/linebender/druid))
* [Self](https://selflanguage.org/) programming language * [Self](https://selflanguage.org/) programming language
* [Primitive](https://primitive.io/) code exploration in Virtual Reality * [Primitive](https://primitive.io/) code exploration in Virtual Reality
* [Luna](https://www.luna-lang.org/) language for interactive data processing and visualization
### Debugging ### Debugging
@ -51,6 +54,8 @@ These are potentially inspirational resources for the editor's design.
* [Blueprints](https://docs.unrealengine.com/en-US/Engine/Blueprints/index.html) visual scripting (not suggesting visual scripting for Roc) * [Blueprints](https://docs.unrealengine.com/en-US/Engine/Blueprints/index.html) visual scripting (not suggesting visual scripting for Roc)
* [Live Programing](https://www.microsoft.com/en-us/research/project/live-programming/?from=http%3A%2F%2Fresearch.microsoft.com%2Fen-us%2Fprojects%2Fliveprogramming%2Ftypography.aspx#!publications) by [Microsoft Research] it contains many interesting research papers. * [Live Programing](https://www.microsoft.com/en-us/research/project/live-programming/?from=http%3A%2F%2Fresearch.microsoft.com%2Fen-us%2Fprojects%2Fliveprogramming%2Ftypography.aspx#!publications) by [Microsoft Research] it contains many interesting research papers.
* [Math Inspector](https://mathinspector.com/), [github](https://github.com/MathInspector/MathInspector)
* [Lamdu](http://www.lamdu.org/) live functional programming.
### Productivity features ### Productivity features
@ -63,6 +68,7 @@ These are potentially inspirational resources for the editor's design.
* Suggest automatically creating a function if the compiler says it does not exist. * Suggest automatically creating a function if the compiler says it does not exist.
* Integrated search: * Integrated search:
* Searchbar for examples/docs. With permission search strings could be shared with the platform/package authors so they know exactly what their users are struggling with. * Searchbar for examples/docs. With permission search strings could be shared with the platform/package authors so they know exactly what their users are struggling with.
* Webcam based eye tracking for quick selection. Could be used to select from autocomplete options instead of having to use arrows.
### Non-Code Related Inspiration ### Non-Code Related Inspiration

View file

@ -167,8 +167,11 @@ fn run_event_loop(file_path_opt: Option<&Path>) -> Result<(), Box<dyn Error>> {
let mut keyboard_modifiers = ModifiersState::empty(); let mut keyboard_modifiers = ModifiersState::empty();
// This arena is never cleared and should only be used for allocations that occur rarely
let arena = Bump::new(); let arena = Bump::new();
let mut rects_arena = Bump::new();
// Render loop // Render loop
window.request_redraw(); window.request_redraw();
@ -317,9 +320,11 @@ fn run_event_loop(file_path_opt: Option<&Path>) -> Result<(), Box<dyn Error>> {
); );
} }
rects_arena.reset();
match draw_all_rects( match draw_all_rects(
&app_model.ed_model_opt, &app_model.ed_model_opt,
&arena, &rects_arena,
&mut encoder, &mut encoder,
&frame.view, &frame.view,
&gpu_device, &gpu_device,

View file

@ -216,7 +216,7 @@ pub mod test_selection {
TextBuffer { TextBuffer {
text_rope: Rope::from_str(lines_str), text_rope: Rope::from_str(lines_str),
path_str: "".to_owned(), path_str: "".to_owned(),
mem_arena: bumpalo::Bump::new(), arena: bumpalo::Bump::new(),
} }
} }

View file

@ -17,7 +17,7 @@ use std::path::Path;
pub struct TextBuffer { pub struct TextBuffer {
pub text_rope: Rope, pub text_rope: Rope,
pub path_str: String, pub path_str: String,
pub mem_arena: Bump, pub arena: Bump,
} }
impl TextBuffer { impl TextBuffer {
@ -65,7 +65,7 @@ impl TextBuffer {
} else { } else {
// happens very rarely // happens very rarely
let line_str = rope_slice.chunks().collect::<String>(); let line_str = rope_slice.chunks().collect::<String>();
let arena_str_ref = self.mem_arena.alloc(line_str); let arena_str_ref = self.arena.alloc(line_str);
Ok(arena_str_ref) Ok(arena_str_ref)
} }
} }
@ -92,7 +92,7 @@ impl TextBuffer {
} else { } else {
// happens very rarely // happens very rarely
let line_str = rope_slice.chunks().collect::<String>(); let line_str = rope_slice.chunks().collect::<String>();
let arena_str_ref = self.mem_arena.alloc(line_str); let arena_str_ref = self.arena.alloc(line_str);
Some(arena_str_ref) Some(arena_str_ref)
} }
} else { } else {
@ -144,12 +144,12 @@ impl TextBuffer {
pub fn from_path(path: &Path) -> EdResult<TextBuffer> { pub fn from_path(path: &Path) -> EdResult<TextBuffer> {
let text_rope = rope_from_path(path)?; let text_rope = rope_from_path(path)?;
let path_str = path_to_string(path); let path_str = path_to_string(path);
let mem_arena = Bump::new(); let arena = Bump::new();
Ok(TextBuffer { Ok(TextBuffer {
text_rope, text_rope,
path_str, path_str,
mem_arena, arena,
}) })
} }