first pass of merging in warp (doesn't build)
This commit is contained in:
@@ -3,29 +3,25 @@ use std::sync::Arc;
|
||||
use galaxy_core::features::FeatureFlag;
|
||||
use galaxyui::{App, ModelAsRef, units::IntoPixels};
|
||||
use serde_yaml::Value;
|
||||
use string_offset::CharOffset;
|
||||
use sum_tree::SumTree;
|
||||
use vec1::vec1;
|
||||
|
||||
use crate::{
|
||||
content::{
|
||||
buffer::{
|
||||
AutoScrollBehavior, Buffer, BufferEditAction, BufferSelectAction, EditOrigin,
|
||||
InitialBufferState, SelectionOffsets, tests::TestEmbeddedItem,
|
||||
},
|
||||
selection_model::BufferSelectionModel,
|
||||
text::{BufferBlockStyle, IndentBehavior, IndentUnit},
|
||||
},
|
||||
render::model::{
|
||||
BlockItem, COMMAND_SPACING, ImageBlockConfig, RenderState,
|
||||
test_utils::{TEST_STYLES, laid_out_paragraph},
|
||||
},
|
||||
selection::SelectionMode,
|
||||
};
|
||||
use galaxyui::assets::asset_cache::AssetSource;
|
||||
use galaxyui::text::word_boundaries::WordBoundariesPolicy;
|
||||
use string_offset::CharOffset;
|
||||
use galaxyui_core::assets::asset_cache::AssetSource;
|
||||
use galaxyui_core::text::word_boundaries::WordBoundariesPolicy;
|
||||
use galaxyui_core::units::IntoPixels;
|
||||
use galaxyui_core::{App, ModelAsRef};
|
||||
|
||||
use super::{SelectionModel, TextDirection, TextUnit};
|
||||
use crate::content::buffer::tests::TestEmbeddedItem;
|
||||
use crate::content::buffer::{
|
||||
AutoScrollBehavior, Buffer, BufferEditAction, BufferSelectAction, EditOrigin,
|
||||
InitialBufferState, SelectionOffsets,
|
||||
};
|
||||
use crate::content::selection_model::BufferSelectionModel;
|
||||
use crate::content::text::{BufferBlockStyle, IndentBehavior, IndentUnit};
|
||||
use crate::render::model::test_utils::{TEST_STYLES, laid_out_paragraph};
|
||||
use crate::render::model::{BlockItem, COMMAND_SPACING, ColumnUnit, ImageBlockConfig, RenderState};
|
||||
use crate::selection::SelectionMode;
|
||||
|
||||
impl SelectionModel {
|
||||
/// The cursor location.
|
||||
@@ -37,7 +33,9 @@ impl SelectionModel {
|
||||
}
|
||||
}
|
||||
|
||||
fn selection_model_with_rendered_mermaid(app: &mut App) -> galaxyui::ModelHandle<SelectionModel> {
|
||||
fn selection_model_with_rendered_mermaid(
|
||||
app: &mut App,
|
||||
) -> galaxyui_core::ModelHandle<SelectionModel> {
|
||||
app.add_model(|ctx| {
|
||||
let buffer = ctx.add_model(|_| Buffer::new(Box::new(|_, _| IndentBehavior::Ignore)));
|
||||
let buffer_selection = ctx.add_model(|_| BufferSelectionModel::new(buffer.clone()));
|
||||
@@ -243,14 +241,14 @@ fn test_horizontal_movement_resets_goal_column() {
|
||||
|
||||
// Moving via the high-level navigation APIs should reset the goal column.
|
||||
selection.update(&mut app, |selection, ctx| {
|
||||
selection.goal_xs = Some(vec1::vec1![12.34.into_pixels()]);
|
||||
selection.goal_xs = Some(vec1::vec1![ColumnUnit::Pixels(12.34.into_pixels())]);
|
||||
selection.move_selection(TextDirection::Forwards, TextUnit::LineBoundary, ctx);
|
||||
assert_eq!(selection.goal_xs, None);
|
||||
});
|
||||
|
||||
// Moving via a buffer-level action should as well (as long as it's via the selection model).
|
||||
selection.update(&mut app, |selection, ctx| {
|
||||
selection.goal_xs = Some(vec1::vec1![12.34.into_pixels()]);
|
||||
selection.goal_xs = Some(vec1::vec1![ColumnUnit::Pixels(12.34.into_pixels())]);
|
||||
selection.update_selection(
|
||||
BufferSelectAction::MoveLeft,
|
||||
AutoScrollBehavior::Selection,
|
||||
@@ -261,7 +259,7 @@ fn test_horizontal_movement_resets_goal_column() {
|
||||
|
||||
// Editing resets the goal too.
|
||||
selection.update(&mut app, |selection, ctx| {
|
||||
selection.goal_xs = Some(vec1::vec1![12.34.into_pixels()]);
|
||||
selection.goal_xs = Some(vec1::vec1![ColumnUnit::Pixels(12.34.into_pixels())]);
|
||||
selection.content.update(ctx, |buffer, ctx| {
|
||||
buffer.update_content(
|
||||
BufferEditAction::Insert {
|
||||
|
||||
Reference in New Issue
Block a user