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 {
text_rope: Rope::from_str(lines_str),
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 {
text_rope: Rope::from_str(lines_str),
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.
Nice collection of research on innovative editors, [link](https://futureofcoding.org/catalog/).
### Package-specific editor integrations
(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))
* [Self](https://selflanguage.org/) programming language
* [Primitive](https://primitive.io/) code exploration in Virtual Reality
* [Luna](https://www.luna-lang.org/) language for interactive data processing and visualization
### 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)
* [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
@ -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.
* 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.
* 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

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();
// This arena is never cleared and should only be used for allocations that occur rarely
let arena = Bump::new();
let mut rects_arena = Bump::new();
// Render loop
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(
&app_model.ed_model_opt,
&arena,
&rects_arena,
&mut encoder,
&frame.view,
&gpu_device,

View File

@ -216,7 +216,7 @@ pub mod test_selection {
TextBuffer {
text_rope: Rope::from_str(lines_str),
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 text_rope: Rope,
pub path_str: String,
pub mem_arena: Bump,
pub arena: Bump,
}
impl TextBuffer {
@ -65,7 +65,7 @@ impl TextBuffer {
} else {
// happens very rarely
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)
}
}
@ -92,7 +92,7 @@ impl TextBuffer {
} else {
// happens very rarely
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)
}
} else {
@ -144,12 +144,12 @@ impl TextBuffer {
pub fn from_path(path: &Path) -> EdResult<TextBuffer> {
let text_rope = rope_from_path(path)?;
let path_str = path_to_string(path);
let mem_arena = Bump::new();
let arena = Bump::new();
Ok(TextBuffer {
text_rope,
path_str,
mem_arena,
arena,
})
}