Wrapping up bedrock implementation

This commit is contained in:
Ryan Ward
2026-05-13 10:04:59 -05:00
parent ed53aa99eb
commit cee61e2af0
1144 changed files with 2954 additions and 2660 deletions
+1 -1
View File
@@ -1,11 +1,11 @@
use std::fs;
use criterion::{Criterion, criterion_group, criterion_main};
use rand::{SeedableRng, rngs::StdRng};
use galaxy_editor::content::{
buffer::Buffer, selection_model::BufferSelectionModel, text::IndentBehavior,
};
use galaxyui::{App, ModelHandle};
use rand::{SeedableRng, rngs::StdRng};
const EDIT_SAMPLE_SIZE: usize = 10;
const MAX_EDIT_REPLACEMENT_LENGTH: usize = 20;
+1 -1
View File
@@ -1,7 +1,7 @@
use std::cmp::Ordering;
use sum_tree::SumTree;
use galaxyui::App;
use sum_tree::SumTree;
use super::{AnchorSide, Anchors};
+3 -3
View File
@@ -1,4 +1,5 @@
use core::fmt;
use galaxy_util::content_version::ContentVersion;
use itertools::{Either, Itertools};
use line_ending::LineEnding;
use markdown_parser::{
@@ -17,7 +18,6 @@ use std::{
sync::Arc,
};
use vec1::{Vec1, vec1};
use galaxy_util::content_version::ContentVersion;
use super::{
anchor::{Anchor, AnchorSide, Anchors},
@@ -51,14 +51,14 @@ use crate::{
render::model::{EmbeddedItem, RenderedSelection, RenderedSelectionBias, RenderedSelectionSet},
};
use enum_iterator::all;
use string_offset::{ByteOffset, CharOffset};
use sum_tree::{SeekBias, SumTree};
use galaxyui::{AppContext, Entity, ModelContext};
use galaxyui::{EntityId, ModelHandle, elements::ListIndentLevel};
use galaxyui::{
fonts::Weight,
text::{TextBuffer, char_slice, point::Point},
};
use string_offset::{ByteOffset, CharOffset};
use sum_tree::{SeekBias, SumTree};
/// Format of the passed in text.
#[derive(Clone, Debug, Copy)]
+3 -3
View File
@@ -2,6 +2,7 @@ use std::ops::Range;
use std::sync::Arc;
use std::sync::atomic::{AtomicU8, Ordering};
use galaxyui::{App, AppContext, ModelContext, ModelHandle, ReadModel};
use line_ending::LineEnding;
use markdown_parser::{
FormattedIndentTextInline, FormattedText, FormattedTextFragment, FormattedTextLine, parse_html,
@@ -12,7 +13,6 @@ use rand::SeedableRng;
use rand::rngs::StdRng;
use serde_yaml::{Mapping, Value};
use vec1::{Vec1, vec1};
use galaxyui::{App, AppContext, ModelContext, ModelHandle, ReadModel};
use crate::content::buffer::{
AutoScrollBehavior, BufferEditAction, BufferSelectAction, EditOrigin, EmbeddedItemConversion,
@@ -37,10 +37,10 @@ use crate::render::model::{
EmbeddedItem, EmbeddedItemHTMLRepresentation, EmbeddedItemRichFormat, LaidOutEmbeddedItem,
RenderedSelectionSet,
};
use string_offset::ByteOffset;
use string_offset::CharOffset;
use galaxyui::elements::ListIndentLevel;
use galaxyui::text::point::Point;
use string_offset::ByteOffset;
use string_offset::CharOffset;
use crate::content::buffer::{Buffer, StyledBufferRun};
+1 -1
View File
@@ -19,11 +19,11 @@ use crate::content::{
},
};
use enum_iterator::all;
use galaxyui::elements::ListIndentLevel;
use markdown_parser::{FormattedText, FormattedTextFragment, FormattedTextLine};
use std::ops::Range;
use string_offset::CharOffset;
use sum_tree::SumTree;
use galaxyui::elements::ListIndentLevel;
#[derive(Debug, Clone)]
pub struct CoreEditorAction {
+8 -8
View File
@@ -7,13 +7,6 @@ use std::{
};
use anyhow::{Result, anyhow};
use itertools::Itertools;
use markdown_parser::{Hyperlink, TableAlignment};
use num_traits::SaturatingSub;
use rangemap::RangeSet;
use rayon::iter::{IndexedParallelIterator, IntoParallelIterator, ParallelIterator};
use urlocator::{UrlLocation, UrlLocator};
use vec1::Vec1;
use galaxy_core::{features::FeatureFlag, ui::theme::Fill as ThemeFill};
use galaxyui::{
AppContext,
@@ -23,6 +16,13 @@ use galaxyui::{
text_layout::{StyleAndFont, TextAlignment},
units::{IntoPixels, Pixels},
};
use itertools::Itertools;
use markdown_parser::{Hyperlink, TableAlignment};
use num_traits::SaturatingSub;
use rangemap::RangeSet;
use rayon::iter::{IndexedParallelIterator, IntoParallelIterator, ParallelIterator};
use urlocator::{UrlLocation, UrlLocator};
use vec1::Vec1;
use crate::{
parallel_util::Last,
@@ -38,8 +38,8 @@ use crate::{
},
},
};
use string_offset::{ByteOffset, CharOffset};
use galaxyui::text::char_slice;
use string_offset::{ByteOffset, CharOffset};
use super::{
buffer::{StyledBufferBlock, StyledBufferRun, StyledTextBlock},
+2 -2
View File
@@ -13,8 +13,6 @@ use crate::{
model::{BlockItem, test_utils::TEST_STYLES},
},
};
use std::path::Path;
use string_offset::CharOffset;
use galaxy_core::features::FeatureFlag;
use galaxyui::{
App, SingletonEntity,
@@ -23,6 +21,8 @@ use galaxyui::{
image_cache::ImageType,
text_layout::{LayoutCache, StyleAndFont, TextStyle},
};
use std::path::Path;
use string_offset::CharOffset;
#[test]
fn test_highlight_urls() {
+1 -1
View File
@@ -1,10 +1,10 @@
use std::{iter, pin::pin, sync::Once};
use futures_lite::future;
use galaxyui::App;
use itertools::Itertools;
use rangemap::RangeSet;
use sum_tree::SumTree;
use galaxyui::App;
use crate::content::{
buffer::Buffer,
@@ -1,9 +1,9 @@
use std::collections::HashMap;
use std::ops::Range;
use galaxyui::{AppContext, Entity, ModelContext, ModelHandle};
use rangemap::RangeSet;
use string_offset::CharOffset;
use galaxyui::{AppContext, Entity, ModelContext, ModelHandle};
use crate::content::edit::EditDelta;
use crate::content::selection_model::BufferSelectionModel;
+3 -3
View File
@@ -1,4 +1,6 @@
use anyhow::{Context, Result};
use galaxyui::text::point::Point;
use galaxyui::{AppContext, ModelContext, ModelHandle};
use html5ever::serialize;
use html5ever::{
QualName,
@@ -15,11 +17,9 @@ use std::collections::VecDeque;
use std::fmt::Write;
use std::iter;
use std::{io, ops::Range};
use galaxyui::text::point::Point;
use galaxyui::{AppContext, ModelContext, ModelHandle};
use string_offset::CharOffset;
use galaxyui::elements::{ListIndentLevel, ListNumbering};
use string_offset::CharOffset;
use crate::content::anchor::AnchorSide;
use crate::content::selection_model::BufferSelectionModel;
+1 -1
View File
@@ -1,10 +1,10 @@
use std::sync::Arc;
use galaxyui::{App, ReadModel};
use markdown_parser::{compute_formatted_text_delta, parse_markdown};
use serde_yaml::Value;
use string_offset::CharOffset;
use vec1::Vec1;
use galaxyui::{App, ReadModel};
use crate::content::{
buffer::{
+1 -1
View File
@@ -4,13 +4,13 @@ use std::{
};
use bytes::Bytes;
use mermaid_to_svg::MermaidTheme;
use galaxyui::{
AppContext, SingletonEntity,
assets::asset_cache::{AssetCache, AssetSource, AssetState, AsyncAssetId, AsyncAssetType},
image_cache::ImageType,
units::{IntoPixels, Pixels},
};
use mermaid_to_svg::MermaidTheme;
use crate::render::{
layout::TextLayout,
+1 -1
View File
@@ -6,8 +6,8 @@ use crate::content::{
selection_model::BufferSelectionModel,
text::{BlockType, BufferBlockStyle, IndentBehavior, TextStyles},
};
use string_offset::CharOffset;
use galaxyui::App;
use string_offset::CharOffset;
#[test]
fn test_no_blocks() {
+1 -1
View File
@@ -3,8 +3,8 @@
//! [`TextBuffer`] API.
use anyhow::anyhow;
use string_offset::CharOffset;
use galaxyui::text::{TextBuffer, point::Point, word_boundaries::WordBoundariesPolicy};
use string_offset::CharOffset;
use super::{
buffer::{Buffer, ToBufferCharOffset, ToBufferPoint},
@@ -1,7 +1,7 @@
use galaxy_core::features::FeatureFlag;
use itertools::Itertools;
use markdown_parser::parse_markdown;
use string_offset::CharOffset;
use galaxy_core::features::FeatureFlag;
use crate::content::{
buffer::{Buffer, EditOrigin},
+1 -1
View File
@@ -1,9 +1,9 @@
use std::ops::Range;
use galaxyui::{AppContext, Entity, ModelHandle};
use itertools::Itertools;
use string_offset::CharOffset;
use vec1::{Vec1, vec1};
use galaxyui::{AppContext, Entity, ModelHandle};
use crate::content::{
anchor::{Anchor, AnchorSide, AnchorUpdate, Anchors},
+8 -8
View File
@@ -4,6 +4,14 @@ use crate::render::model::{
};
use arrayvec::ArrayString;
use enum_iterator::Sequence;
use galaxy_core::features::FeatureFlag;
use galaxyui::elements::ListIndentLevel;
use galaxyui::text::BlockHeaderSize as HeaderSize;
use galaxyui::text::point::Point;
use galaxyui::{
AppContext,
fonts::{Properties, Style, Weight},
};
use lazy_static::lazy_static;
pub use markdown_parser::markdown_parser::TABLE_BLOCK_MARKDOWN_LANG;
use markdown_parser::{
@@ -30,14 +38,6 @@ use std::{
};
use string_offset::{ByteOffset, CharOffset, impl_offset};
use sum_tree::{Cursor, SeekBias, SumTree};
use galaxy_core::features::FeatureFlag;
use galaxyui::elements::ListIndentLevel;
use galaxyui::text::BlockHeaderSize as HeaderSize;
use galaxyui::text::point::Point;
use galaxyui::{
AppContext,
fonts::{Properties, Style, Weight},
};
use super::{buffer::Buffer, core::CursorType, markdown::MarkdownStyle};
+2 -2
View File
@@ -1,8 +1,8 @@
use markdown_parser::CodeBlockText;
use galaxyui::fonts::Weight;
use markdown_parser::CodeBlockText;
use markdown_parser::FormattedTable;
use galaxy_core::features::FeatureFlag;
use markdown_parser::FormattedTable;
use super::{
BufferBlockItem, BufferTextStyle, CodeBlockType, MarkdownStyle, TextStyles,
+1 -1
View File
@@ -1,7 +1,7 @@
use std::{collections::VecDeque, time::Duration};
use instant::Instant;
use galaxy_util::content_version::ContentVersion;
use instant::Instant;
use crate::render::model::RenderedSelectionSet;
@@ -4,8 +4,8 @@ use crate::content::{
BlockHeaderSize, BufferBlockItem, BufferBlockStyle, BufferText, BufferTextStyle, MarkerDir,
},
};
use sum_tree::SumTree;
use galaxyui::elements::ListIndentLevel;
use sum_tree::SumTree;
#[test]
#[should_panic(
+3 -3
View File
@@ -3,13 +3,13 @@
use std::{any::Any, cell::Ref, ops::Range};
use num_traits::SaturatingSub;
use pathfinder_color::ColorU;
use rangemap::{RangeMap, RangeSet};
use galaxyui::{
Action, AppContext, Element, TypedActionView, View, elements::Border,
text_layout::PaintStyleOverride,
};
use num_traits::SaturatingSub;
use pathfinder_color::ColorU;
use rangemap::{RangeMap, RangeSet};
use crate::{content::version::BufferVersion, render::element::RichTextAction};
use string_offset::CharOffset;
+4 -4
View File
@@ -1,11 +1,11 @@
use std::ops::Range;
use itertools::{Either, Itertools};
use line_ending::LineEnding;
use vec1::{Vec1, vec1};
use galaxyui::{
AppContext, Entity, ModelAsRef, ModelContext, ModelHandle, clipboard::ClipboardContent,
};
use itertools::{Either, Itertools};
use line_ending::LineEnding;
use vec1::{Vec1, vec1};
use crate::{
content::{
@@ -21,8 +21,8 @@ use crate::{
render::model::RenderState,
selection::{SelectionMode, SelectionModel, TextDirection, TextUnit},
};
use string_offset::{ByteOffset, CharOffset};
use galaxyui::elements::ListIndentLevel;
use string_offset::{ByteOffset, CharOffset};
/// A wrapper for a buffer that provides access to its internal update_content method.
/// It's important this is only returned from `CoreEditorModel::update_content` method
@@ -154,7 +154,9 @@ impl RenderableBlock for RenderableBrokenEmbedding {
);
}
ctx.paint.scene.start_layer(galaxyui::ClipBounds::ActiveLayer);
ctx.paint
.scene
.start_layer(galaxyui::ClipBounds::ActiveLayer);
self.row
.paint(ctx.content_to_screen(content_origin), ctx.paint, app);
ctx.paint.scene.stop_layer();
+12 -12
View File
@@ -1,16 +1,4 @@
use float_cmp::ApproxEq;
use instant::Instant;
use parking_lot::Mutex;
use std::{
fmt,
sync::{
Arc,
atomic::{AtomicBool, Ordering},
},
time::Duration,
};
use temporary_block::RenderableTemporaryBlock;
use vim::vim::VimMode;
use galaxy_core::ui::theme::Fill as ThemeFill;
use galaxyui::{
AfterLayoutContext, AppContext, Element, Event, EventContext, LayoutContext, ModelHandle,
@@ -28,6 +16,18 @@ use galaxyui::{
platform::Cursor,
units::{IntoPixels, Pixels},
};
use instant::Instant;
use parking_lot::Mutex;
use std::{
fmt,
sync::{
Arc,
atomic::{AtomicBool, Ordering},
},
time::Duration,
};
use temporary_block::RenderableTemporaryBlock;
use vim::vim::VimMode;
use super::model::{
BlockItem, ElementUpdate, HitTestOptions, Location, RenderState, RichTextStyles, UNIT_MARGIN,
@@ -48,7 +48,12 @@ impl RenderableBlock for RenderableRunnableCommand {
&self.viewport_item
}
fn layout(&mut self, _model: &RenderState, ctx: &mut galaxyui::LayoutContext, app: &AppContext) {
fn layout(
&mut self,
_model: &RenderState,
ctx: &mut galaxyui::LayoutContext,
app: &AppContext,
) {
self.footer.layout(
SizeConstraint::strict(vec2f(
self.viewport_item.content_size.x(),
@@ -87,7 +92,9 @@ impl RenderableBlock for RenderableRunnableCommand {
// Place the button at a higher z-index for event handling. See the comment on
// `RichTextElement::content_z_index` for context.
ctx.paint.scene.start_layer(galaxyui::ClipBounds::ActiveLayer);
ctx.paint
.scene
.start_layer(galaxyui::ClipBounds::ActiveLayer);
// Position the block footer right below the content area, flush with its right-hand edge.
// This gives the footer some padding relative to the visible area with a background.
+2 -2
View File
@@ -1,5 +1,3 @@
use std::ops::Range;
use string_offset::CharOffset;
use galaxyui::{
AppContext, ClipBounds, Event, EventContext,
elements::{
@@ -14,6 +12,8 @@ use galaxyui::{
},
units::{IntoPixels, Pixels},
};
use std::ops::Range;
use string_offset::CharOffset;
use crate::render::model::table_offset_map::CellAtOffset;
use crate::{
@@ -1,6 +1,3 @@
use pathfinder_color::ColorU;
use std::{cell::Cell, sync::Arc};
use string_offset::CharOffset;
use galaxyui::{
elements::{Axis, scroll_delta_for_pointer_movement},
fonts::FamilyId,
@@ -8,6 +5,9 @@ use galaxyui::{
text_layout::TextFrame,
units::{IntoPixels, Pixels},
};
use pathfinder_color::ColorU;
use std::{cell::Cell, sync::Arc};
use string_offset::CharOffset;
use crate::{
content::text::{FormattedTable, table_cell_offset_maps},
@@ -4,7 +4,6 @@ use crate::{
extract_block,
render::model::{BlockItem, RenderState, RichTextStyles, bounds, viewport::ViewportItem},
};
use pathfinder_color::ColorU;
use galaxyui::elements::ListIndentLevel;
use galaxyui::{
AppContext, Element, SizeConstraint, WeakViewHandle,
@@ -15,6 +14,7 @@ use galaxyui::{
geometry::vector::vec2f,
platform::Cursor,
};
use pathfinder_color::ColorU;
use super::{
RenderableBlock, RichTextAction,
+1 -1
View File
@@ -1,8 +1,8 @@
//! Hit-testing implementation for the rendering model.
use galaxyui::units::{IntoPixels, Pixels};
use num_traits::SaturatingSub;
use sum_tree::SeekBias;
use galaxyui::units::{IntoPixels, Pixels};
use string_offset::CharOffset;
@@ -15,11 +15,11 @@ use pathfinder_color::ColorU;
use std::{cell::Cell, sync::Arc};
use string_offset::CharOffset;
use sum_tree::SumTree;
use galaxyui::assets::asset_cache::AssetSource;
use galaxyui::fonts::FamilyId;
use galaxyui::text_layout::{CaretPosition, TextFrame};
use galaxyui::units::IntoPixels;
use sum_tree::SumTree;
fn test_table_layout() -> LaidOutTable {
let source = "aaa\tbbb\nccc\tddd\n";
+10 -10
View File
@@ -12,15 +12,6 @@ use parking_lot::Mutex;
use rangemap::RangeSet;
use float_cmp::ApproxEq;
use itertools::Itertools;
use markdown_parser::TableAlignment;
use num_traits::SaturatingSub;
use ordered_float::OrderedFloat;
use serde::{Deserialize, Serialize};
use serde_yaml::Mapping;
use sum_tree::{SeekBias, SumTree};
use vec1::Vec1;
use vim::vim::{MotionType, VimMode};
use galaxy_core::{
channel::ChannelState,
ui::{Icon, theme::Fill as ThemeFill},
@@ -44,6 +35,15 @@ use galaxyui::{
},
units::{IntoPixels, Pixels},
};
use itertools::Itertools;
use markdown_parser::TableAlignment;
use num_traits::SaturatingSub;
use ordered_float::OrderedFloat;
use serde::{Deserialize, Serialize};
use serde_yaml::Mapping;
use sum_tree::{SeekBias, SumTree};
use vec1::Vec1;
use vim::vim::{MotionType, VimMode};
pub use self::location::{HitTestOptions, Location};
pub use self::offset_map::{OffsetMap, SelectableTextRun};
@@ -68,8 +68,8 @@ use crate::{
editor::EmbeddedItemModel,
render::model::debug::Describe,
};
use string_offset::{CharOffset, impl_offset};
use galaxyui::elements::ListIndentLevel;
use string_offset::{CharOffset, impl_offset};
use super::{
BLOCK_FOOTER_HEIGHT,
+5 -5
View File
@@ -1,7 +1,3 @@
use rangemap::RangeSet;
use std::{cell::Cell, sync::Arc};
use sum_tree::SumTree;
use vec1::{Vec1, vec1};
use galaxyui::assets::asset_cache::AssetSource;
use galaxyui::{
color::ColorU,
@@ -10,6 +6,10 @@ use galaxyui::{
text_layout::TextFrame,
units::{IntoPixels, Pixels},
};
use rangemap::RangeSet;
use std::{cell::Cell, sync::Arc};
use sum_tree::SumTree;
use vec1::{Vec1, vec1};
use super::{
BlockItem, BlockLocation, COMMAND_SPACING, CellLayout, DEFAULT_BLOCK_SPACINGS,
@@ -32,9 +32,9 @@ use crate::{
test_utils::{TEST_STYLES, laid_out_paragraph, mock_paragraph},
},
};
use galaxyui::elements::ListIndentLevel;
use markdown_parser::{FormattedTextStyles, Hyperlink};
use string_offset::CharOffset;
use galaxyui::elements::ListIndentLevel;
#[test]
fn test_height() {
+1 -1
View File
@@ -3,12 +3,12 @@
use std::sync::Arc;
use sum_tree::{Cursor, Dimension};
use galaxyui::{
geometry::vector::Vector2F,
text_layout::Line,
units::{IntoPixels, Pixels},
};
use sum_tree::{Cursor, Dimension};
use crate::render::layout::line_height;
use string_offset::CharOffset;
+1 -1
View File
@@ -5,7 +5,6 @@ use std::{mem, sync::Arc};
use vec1::{Vec1, vec1};
use crate::content::text::BufferBlockStyle;
use ordered_float::OrderedFloat;
use galaxyui::elements::ListIndentLevel;
use galaxyui::{
color::ColorU,
@@ -15,6 +14,7 @@ use galaxyui::{
text_layout::{CaretPosition, Glyph, Line, Run, TextFrame},
units::{IntoPixels, Pixels},
};
use ordered_float::OrderedFloat;
use super::{
BlockItem, BrokenLinkStyle, CheckBoxStyle, DEFAULT_BLOCK_SPACINGS, HorizontalRuleStyle,
+1 -1
View File
@@ -1,5 +1,4 @@
use float_cmp::ApproxEq;
use sum_tree::{SeekBias, SumTree};
use galaxyui::{
SizeConstraint,
geometry::{
@@ -8,6 +7,7 @@ use galaxyui::{
},
units::{IntoPixels, Pixels},
};
use sum_tree::{SeekBias, SumTree};
use crate::render::element::RenderContext;
use string_offset::CharOffset;
+2 -2
View File
@@ -1,10 +1,10 @@
use std::ops::Range;
use galaxy_core::ui::theme::Fill;
use galaxyui::{Entity, ModelContext, ModelHandle, r#async::SpawnedFutureHandle};
use itertools::Itertools;
use lazy_static::lazy_static;
use pathfinder_color::ColorU;
use galaxy_core::ui::theme::Fill;
use galaxyui::{Entity, ModelContext, ModelHandle, r#async::SpawnedFutureHandle};
use crate::{
content::{
+2 -2
View File
@@ -1,7 +1,7 @@
use galaxyui::{AppContext, Entity, ModelAsRef, ModelContext, ModelHandle, units::Pixels};
use num_traits::SaturatingSub;
use std::ops::Range;
use vec1::Vec1;
use galaxyui::{AppContext, Entity, ModelAsRef, ModelContext, ModelHandle, units::Pixels};
use crate::{
content::{
@@ -15,8 +15,8 @@ use crate::{
},
render::model::{RenderState, SoftWrapPoint},
};
use string_offset::CharOffset;
use galaxyui::text::{TextBuffer, point::Point, word_boundaries::WordBoundariesPolicy};
use string_offset::CharOffset;
#[cfg(test)]
#[path = "selection_tests.rs"]
+3 -3
View File
@@ -1,10 +1,10 @@
use std::sync::Arc;
use galaxy_core::features::FeatureFlag;
use galaxyui::{App, ModelAsRef, units::IntoPixels};
use serde_yaml::Value;
use sum_tree::SumTree;
use vec1::vec1;
use galaxy_core::features::FeatureFlag;
use galaxyui::{App, ModelAsRef, units::IntoPixels};
use crate::{
content::{
@@ -21,9 +21,9 @@ use crate::{
},
selection::SelectionMode,
};
use string_offset::CharOffset;
use galaxyui::assets::asset_cache::AssetSource;
use galaxyui::text::word_boundaries::WordBoundariesPolicy;
use string_offset::CharOffset;
use super::{SelectionModel, TextDirection, TextUnit};