Wrapping up bedrock implementation
This commit is contained in:
@@ -11,8 +11,6 @@ use crate::util::bindings::{
|
||||
keybinding_name_to_keystroke, reset_keybinding_to_default, set_custom_keybinding,
|
||||
};
|
||||
use crate::workspace::WorkspaceAction;
|
||||
use lazy_static::lazy_static;
|
||||
use pathfinder_geometry::vector::vec2f;
|
||||
use galaxy_core::ui::theme::Fill;
|
||||
use galaxyui::elements::{Border, ChildView, Flex, ParentElement};
|
||||
use galaxyui::elements::{
|
||||
@@ -31,6 +29,8 @@ use galaxyui::{
|
||||
AppContext, SingletonEntity,
|
||||
};
|
||||
use galaxyui::{Entity, TypedActionView, View, ViewHandle};
|
||||
use lazy_static::lazy_static;
|
||||
use pathfinder_geometry::vector::vec2f;
|
||||
|
||||
use super::EditorElement;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
use crate::appearance::Appearance;
|
||||
use crate::ui_components::blended_colors;
|
||||
use crate::ui_components::icons::Icon;
|
||||
use pathfinder_geometry::vector::vec2f;
|
||||
use galaxy_core::ui::theme::Fill;
|
||||
use galaxyui::elements::{
|
||||
ChildAnchor, ConstrainedBox, Container, CornerRadius, Element, Hoverable, MouseStateHandle,
|
||||
@@ -13,6 +12,7 @@ use galaxyui::platform::Cursor;
|
||||
use galaxyui::ui_components::components::UiComponent;
|
||||
use galaxyui::{Entity, TypedActionView, View};
|
||||
use galaxyui::{SingletonEntity, ViewContext};
|
||||
use pathfinder_geometry::vector::vec2f;
|
||||
|
||||
use super::EditorElement;
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@ pub mod autosuggestion_ignore_view;
|
||||
mod soft_wrap;
|
||||
mod view;
|
||||
|
||||
pub use galaxyui::text::point::Point;
|
||||
/// Consumers of the editor should only interface with the view.
|
||||
/// They should _not_ be able to interface with the internal
|
||||
/// details of the editor (e.g. the [`Buffer`]).
|
||||
pub use view::*;
|
||||
pub use galaxyui::text::point::Point;
|
||||
|
||||
use std::{cmp, ops::Range};
|
||||
use galaxyui::AppContext;
|
||||
use std::{cmp, ops::Range};
|
||||
|
||||
pub fn init(app: &mut AppContext) {
|
||||
view::init(app);
|
||||
|
||||
@@ -17,12 +17,6 @@ use crate::editor::position_id_for_first_cursor;
|
||||
use crate::settings::CursorDisplayType;
|
||||
use crate::ui_components::blended_colors;
|
||||
use crate::ui_components::icons::Icon;
|
||||
use itertools::Itertools;
|
||||
use pathfinder_geometry::{
|
||||
rect::RectF,
|
||||
vector::{vec2f, Vector2F},
|
||||
};
|
||||
use vim::vim::{MotionType, VimMode};
|
||||
use galaxy_core::features::FeatureFlag;
|
||||
use galaxy_core::ui::appearance::DEFAULT_UI_FONT_SIZE;
|
||||
use galaxy_util::user_input::UserInput;
|
||||
@@ -33,17 +27,15 @@ use galaxyui::text_selection_utils::{
|
||||
};
|
||||
use galaxyui::ViewHandle;
|
||||
use galaxyui::{event::ModifiersState, text_layout::ComputeBaselinePositionArgs};
|
||||
use itertools::Itertools;
|
||||
use pathfinder_geometry::{
|
||||
rect::RectF,
|
||||
vector::{vec2f, Vector2F},
|
||||
};
|
||||
use vim::vim::{MotionType, VimMode};
|
||||
|
||||
use crate::editor::view::AutosuggestionLocation;
|
||||
use crate::themes::theme::Fill;
|
||||
use smallvec::SmallVec;
|
||||
use std::collections::HashMap;
|
||||
use std::{
|
||||
cmp, mem,
|
||||
ops::Range,
|
||||
sync::{Arc, Mutex},
|
||||
time::Duration,
|
||||
};
|
||||
use galaxyui::{
|
||||
elements::{
|
||||
AfterLayoutContext, CornerRadius, Element, Event, EventContext, LayoutContext,
|
||||
@@ -55,14 +47,22 @@ use galaxyui::{
|
||||
ui_components::components::UiComponent,
|
||||
AppContext, SingletonEntity, TaskId,
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
use std::collections::HashMap;
|
||||
use std::{
|
||||
cmp, mem,
|
||||
ops::Range,
|
||||
sync::{Arc, Mutex},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use galaxyui::elements::{
|
||||
ChildView, ConstrainedBox, Container, CrossAxisAlignment, Flex, ParentElement, Text,
|
||||
};
|
||||
use galaxyui::platform::keyboard::KeyCode;
|
||||
|
||||
use instant::Instant;
|
||||
use galaxyui::elements::{Radius, DEFAULT_UI_LINE_HEIGHT_RATIO};
|
||||
use instant::Instant;
|
||||
|
||||
// Similar to the terminal::model::ansi::CursorShape, this Editor Element has different cursor
|
||||
// shapes. However, this element doesn't implement all the same variants, so we don't share that
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use vim::vim::VimMode;
|
||||
use galaxy_core::features::FeatureFlag;
|
||||
use galaxyui::{keymap::Keystroke, platform::WindowStyle, App};
|
||||
use vim::vim::VimMode;
|
||||
|
||||
use crate::editor::{DisplayPoint, EditorOptions, EditorView};
|
||||
|
||||
|
||||
+17
-17
@@ -26,6 +26,12 @@ use crate::view_components::FeaturePopup;
|
||||
use base64::{engine::general_purpose, Engine as _};
|
||||
use element::CommandXRayMouseStateHandle;
|
||||
use figma_utils::is_figma_png;
|
||||
use galaxy_core::{safe_error, send_telemetry_from_ctx};
|
||||
use galaxy_util::{path::ShellFamily, user_input::UserInput};
|
||||
use galaxyui::platform::keyboard::KeyCode;
|
||||
use galaxyui::ui_components::button::ButtonTooltipPosition;
|
||||
use galaxyui::ui_components::components::{Coords, UiComponent, UiComponentStyles};
|
||||
use galaxyui::{elements, ViewHandle};
|
||||
use itertools::{Either, Itertools};
|
||||
use mime_guess::from_path;
|
||||
use model::{
|
||||
@@ -38,12 +44,6 @@ use pathfinder_color::ColorU;
|
||||
use settings::Setting as _;
|
||||
use snapshot::{EditorHeightShrinkDelay, ViewSnapshot};
|
||||
use vec1::{vec1, Vec1};
|
||||
use galaxy_core::{safe_error, send_telemetry_from_ctx};
|
||||
use galaxy_util::{path::ShellFamily, user_input::UserInput};
|
||||
use galaxyui::platform::keyboard::KeyCode;
|
||||
use galaxyui::ui_components::button::ButtonTooltipPosition;
|
||||
use galaxyui::ui_components::components::{Coords, UiComponent, UiComponentStyles};
|
||||
use galaxyui::{elements, ViewHandle};
|
||||
|
||||
use crate::ai::agent::ImageContext;
|
||||
use crate::ai::blocklist::{BlocklistAIContextModel, PendingAttachment, PendingFile};
|
||||
@@ -86,6 +86,7 @@ use crate::util::merge_ranges;
|
||||
use crate::{workspace::Workspace, BlocklistAIHistoryModel};
|
||||
use anyhow::Result;
|
||||
use core::f32;
|
||||
use galaxy_core::semantic_selection::SemanticSelection;
|
||||
use std::path::Path;
|
||||
use vim::vim::{
|
||||
BracketChar, CharacterMotion, Direction, FindCharMotion, FirstNonWhitespaceMotion,
|
||||
@@ -97,23 +98,12 @@ use vim::{
|
||||
vim_a_block, vim_a_paragraph, vim_a_quote, vim_a_word, vim_inner_block, vim_inner_paragraph,
|
||||
vim_inner_quote, vim_inner_word, vim_word_iterator_from_offset,
|
||||
};
|
||||
use galaxy_core::semantic_selection::SemanticSelection;
|
||||
|
||||
use num_traits::SaturatingSub;
|
||||
use parking_lot::Mutex;
|
||||
use pathfinder_geometry::vector::Vector2F;
|
||||
|
||||
use async_fs;
|
||||
use std::collections::HashMap;
|
||||
use std::{borrow::Cow, rc::Rc};
|
||||
use std::{
|
||||
cmp::{self, Ordering},
|
||||
fmt,
|
||||
ops::Range,
|
||||
sync::Arc,
|
||||
time::Duration,
|
||||
};
|
||||
use string_offset::{ByteOffset, CharOffset};
|
||||
use galaxy_completer::completer::Description;
|
||||
use galaxy_editor::editor::NavigationKey;
|
||||
use galaxyui::actions::StandardAction;
|
||||
@@ -139,6 +129,16 @@ use galaxyui::{
|
||||
};
|
||||
use galaxyui::{windowing, BlurContext, EntityId, FocusContext};
|
||||
use galaxyui::{CursorInfo, ModelContext, SingletonEntity, TypedActionView};
|
||||
use std::collections::HashMap;
|
||||
use std::{borrow::Cow, rc::Rc};
|
||||
use std::{
|
||||
cmp::{self, Ordering},
|
||||
fmt,
|
||||
ops::Range,
|
||||
sync::Arc,
|
||||
time::Duration,
|
||||
};
|
||||
use string_offset::{ByteOffset, CharOffset};
|
||||
|
||||
const CURSOR_BLINK_INTERVAL: Duration = Duration::from_millis(500);
|
||||
const DEFAULT_TAB_SIZE: usize = 4;
|
||||
|
||||
@@ -12,15 +12,15 @@ use crate::workspace::sync_inputs::SyncedInputState;
|
||||
use crate::workspace::ToastStack;
|
||||
use crate::workspaces::user_workspaces::UserWorkspaces;
|
||||
use anyhow::Error;
|
||||
use itertools::Itertools;
|
||||
use pathfinder_geometry::vector::vec2f;
|
||||
use settings::ToggleableSetting;
|
||||
use unindent::Unindent;
|
||||
use galaxyui::color::ColorU;
|
||||
use galaxyui::platform::WindowStyle;
|
||||
use galaxyui::text_layout::TextFrame;
|
||||
use galaxyui::windowing::WindowManager;
|
||||
use galaxyui::{AddSingletonModel, App, UpdateModel, UpdateView};
|
||||
use itertools::Itertools;
|
||||
use pathfinder_geometry::vector::vec2f;
|
||||
use settings::ToggleableSetting;
|
||||
use unindent::Unindent;
|
||||
|
||||
impl EditorView {
|
||||
fn selected_ranges(&self, app: &AppContext) -> Vec<Range<DisplayPoint>> {
|
||||
|
||||
@@ -25,6 +25,10 @@ use super::EditorSnapshot;
|
||||
use super::{selections::LocalSelections, LocalSelection};
|
||||
use crate::editor::{CursorColors, PlainTextEditorViewAction};
|
||||
use anyhow::{anyhow, Result};
|
||||
use galaxyui::color::ColorU;
|
||||
use galaxyui::text::{point::Point, words::is_default_word_boundary, BufferIndex, TextBuffer};
|
||||
use galaxyui::text_layout::TextStyle;
|
||||
use galaxyui::{Entity, ModelContext};
|
||||
use itertools::Itertools;
|
||||
use lazy_static::lazy_static;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -42,10 +46,6 @@ use sum_tree::{self, Cursor, FilterCursor, SeekBias, SumTree};
|
||||
use time::{Global, Lamport};
|
||||
use undo::{LocalUndoStack, UndoHistory};
|
||||
use vec1::{vec1, Vec1};
|
||||
use galaxyui::color::ColorU;
|
||||
use galaxyui::text::{point::Point, words::is_default_word_boundary, BufferIndex, TextBuffer};
|
||||
use galaxyui::text_layout::TextStyle;
|
||||
use galaxyui::{Entity, ModelContext};
|
||||
|
||||
#[cfg(test)]
|
||||
use rand::prelude::*;
|
||||
|
||||
@@ -9,13 +9,13 @@ use test::Network;
|
||||
use super::*;
|
||||
use enclose::enclose;
|
||||
use futures::StreamExt;
|
||||
use galaxyui::{color::ColorU, App, ModelHandle};
|
||||
use rand::prelude::StdRng;
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
collections::HashSet,
|
||||
pin::{pin, Pin},
|
||||
};
|
||||
use galaxyui::{color::ColorU, App, ModelHandle};
|
||||
|
||||
fn visible_text_styles(buffer: &Buffer) -> Vec<Option<TextStyle>> {
|
||||
buffer
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use super::{CharOffset, Point};
|
||||
use itertools::Either;
|
||||
use std::iter::Peekable;
|
||||
use galaxyui::text::{
|
||||
word_boundaries::WordBoundariesApproach, words::is_subword_boundary_char, TextBuffer,
|
||||
};
|
||||
use itertools::Either;
|
||||
use std::iter::Peekable;
|
||||
|
||||
pub struct SubwordBoundaries<'a, T: TextBuffer + ?Sized> {
|
||||
offset: CharOffset,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
use arrayvec::ArrayVec;
|
||||
use galaxyui::text::point::Point;
|
||||
use galaxyui::text_layout::TextStyle;
|
||||
use num_traits::SaturatingSub;
|
||||
use std::{
|
||||
cmp,
|
||||
@@ -8,8 +10,6 @@ use std::{
|
||||
};
|
||||
use string_offset::{ByteOffset, CharOffset};
|
||||
use sum_tree::{self, SeekBias, SumTree};
|
||||
use galaxyui::text::point::Point;
|
||||
use galaxyui::text_layout::TextStyle;
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
enum Run {
|
||||
|
||||
@@ -3,6 +3,8 @@ use super::buffer::StylizedChar;
|
||||
use super::{buffer, Anchor, Buffer, DisplayPoint, Edit, Point, ToCharOffset};
|
||||
use crate::util::extensions::SliceExt as _;
|
||||
use anyhow::{anyhow, Result};
|
||||
use galaxyui::text_layout::TextStyle;
|
||||
use galaxyui::{AppContext, ModelHandle};
|
||||
use std::{
|
||||
cmp::{self, Ordering},
|
||||
iter::Take,
|
||||
@@ -10,8 +12,6 @@ use std::{
|
||||
};
|
||||
use string_offset::CharOffset;
|
||||
use sum_tree::{self, Cursor, Dimension, SeekBias, SumTree};
|
||||
use galaxyui::text_layout::TextStyle;
|
||||
use galaxyui::{AppContext, ModelHandle};
|
||||
|
||||
pub struct FoldMap {
|
||||
buffer: ModelHandle<Buffer>,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use super::*;
|
||||
use crate::editor::tests::{sample_text, RandomCharIter};
|
||||
use crate::editor::EditOrigin;
|
||||
use tests::buffer::RangesWhenEditing;
|
||||
use galaxyui::App;
|
||||
use tests::buffer::RangesWhenEditing;
|
||||
|
||||
#[test]
|
||||
fn test_basic_folds() -> Result<()> {
|
||||
|
||||
@@ -5,11 +5,11 @@ use crate::editor::soft_wrap::{self, DisplayPointAndClampDirection, SoftWrapPoin
|
||||
use anyhow::{Context, Result};
|
||||
pub use fold_map::BufferRows;
|
||||
use fold_map::FoldMap;
|
||||
use galaxyui::text::point::Point;
|
||||
use galaxyui::{AppContext, Entity, ModelContext, ModelHandle};
|
||||
use std::cmp;
|
||||
use std::ops::Range;
|
||||
use string_offset::CharOffset;
|
||||
use galaxyui::text::point::Point;
|
||||
use galaxyui::{AppContext, Entity, ModelContext, ModelHandle};
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum Bias {
|
||||
|
||||
@@ -26,9 +26,6 @@ use std::{
|
||||
rc::Rc,
|
||||
};
|
||||
|
||||
use num_traits::SaturatingSub;
|
||||
use string_offset::{ByteOffset, CharOffset};
|
||||
use vec1::{vec1, Vec1};
|
||||
use galaxyui::{
|
||||
accessibility::{AccessibilityContent, WarpA11yRole},
|
||||
text_layout::TextStyle,
|
||||
@@ -38,6 +35,9 @@ use galaxyui::{
|
||||
text::{point::Point, word_boundaries::WordBoundariesPolicy, TextBuffer},
|
||||
SingletonEntity,
|
||||
};
|
||||
use num_traits::SaturatingSub;
|
||||
use string_offset::{ByteOffset, CharOffset};
|
||||
use vec1::{vec1, Vec1};
|
||||
|
||||
use crate::{editor::RangeExt, vim_registers::VimRegisters};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use string_offset::{ByteOffset, CharOffset};
|
||||
use galaxyui::{text_layout::TextStyle, App};
|
||||
use string_offset::{ByteOffset, CharOffset};
|
||||
|
||||
use crate::editor::{EditorSnapshot, PlainTextEditorViewAction, TextRun, ValidInputType};
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use std::{cmp::Ordering, mem, ops::Range};
|
||||
|
||||
use galaxyui::text::point::Point;
|
||||
use galaxyui::AppContext;
|
||||
use pathfinder_geometry::vector::Vector2F;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use string_offset::{ByteOffset, CharOffset};
|
||||
use vec1::Vec1;
|
||||
use galaxyui::text::point::Point;
|
||||
use galaxyui::AppContext;
|
||||
|
||||
use super::{
|
||||
buffer::{Anchor, Buffer, LamportValue, ToBufferOffset, ToCharOffset, ToPoint},
|
||||
|
||||
@@ -16,6 +16,8 @@ use pathfinder_geometry::vector::{vec2f, Vector2F};
|
||||
|
||||
use anyhow::Result;
|
||||
use core::f32;
|
||||
use galaxy_completer::completer::Description;
|
||||
use galaxyui::text::point::Point;
|
||||
use instant::Instant;
|
||||
use rayon::prelude::*;
|
||||
use std::borrow::Cow;
|
||||
@@ -26,8 +28,6 @@ use std::{
|
||||
ops::Range,
|
||||
sync::Arc,
|
||||
};
|
||||
use galaxy_completer::completer::Description;
|
||||
use galaxyui::text::point::Point;
|
||||
|
||||
use string_offset::ByteOffset;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use super::*;
|
||||
use crate::editor::EditorView;
|
||||
use galaxyui::platform::WindowStyle;
|
||||
use galaxyui::{App, ViewHandle};
|
||||
use itertools::Itertools;
|
||||
use std::collections::HashSet;
|
||||
use unindent::Unindent;
|
||||
use galaxyui::platform::WindowStyle;
|
||||
use galaxyui::{App, ViewHandle};
|
||||
|
||||
/// Helper function for testing vim mode commands.
|
||||
/// This creates an editor with the given content and enters Vim Normal mode,
|
||||
|
||||
@@ -11,8 +11,6 @@ use crate::ui_components::icons;
|
||||
use crate::view_components::{FeaturePopup, NewFeaturePopupLabel};
|
||||
use crate::workspace::ToastStack;
|
||||
use crate::workspaces::user_workspaces::UserWorkspaces;
|
||||
use settings::Setting as _;
|
||||
use voice_input::{StartListeningError, VoiceInput, VoiceSessionResult};
|
||||
use galaxy_core::send_telemetry_from_ctx;
|
||||
use galaxy_core::ui::theme::color::internal_colors;
|
||||
use galaxy_core::ui::theme::AnsiColorIdentifier;
|
||||
@@ -24,6 +22,8 @@ use galaxyui::ui_components::button::ButtonTooltipPosition;
|
||||
use galaxyui::ui_components::components::{Coords, UiComponent, UiComponentStyles};
|
||||
use galaxyui::ViewHandle;
|
||||
use galaxyui::{AppContext, Element, SingletonEntity, ViewContext};
|
||||
use settings::Setting as _;
|
||||
use voice_input::{StartListeningError, VoiceInput, VoiceSessionResult};
|
||||
|
||||
use super::VoiceTranscriber;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user