Skip to content

Commit

Permalink
bump floem
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhou121 committed Aug 6, 2024
1 parent 3a78eaa commit 8661de6
Show file tree
Hide file tree
Showing 17 changed files with 130 additions and 219 deletions.
283 changes: 99 additions & 184 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ lapce-core = { path = "./lapce-core" }
lapce-rpc = { path = "./lapce-rpc" }
lapce-proxy = { path = "./lapce-proxy" }

floem = { git = "https://github.com/lapce/floem", rev = "720e360500582704303c812c1ed78c98048b5428", features = ["editor", "serde", "default-image-formats", "rfd-async-std"] }
floem = { git = "https://github.com/lapce/floem", rev = "48d2b6eb22a02a100d67868052ecc35fa3c42e10", features = ["editor", "serde", "default-image-formats", "rfd-async-std"] }
# floem = { path = "../floem", features = ["editor", "serde", "default-image-formats", "rfd-async-std"] }
floem-editor-core = { git = "https://github.com/lapce/floem", rev = "720e360500582704303c812c1ed78c98048b5428", features = ["serde"] }
floem-editor-core = { git = "https://github.com/lapce/floem", rev = "48d2b6eb22a02a100d67868052ecc35fa3c42e10", features = ["serde"] }
# floem-editor-core = { path = "../floem/editor-core/", features = ["serde"] }

[patch.crates-io]
Expand Down
2 changes: 1 addition & 1 deletion lapce-app/benches/visual_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use std::{cell::RefCell, collections::HashMap, rc::Rc, sync::Arc};

use criterion::{black_box, criterion_group, criterion_main, Criterion};
use floem::{
cosmic_text::{Attrs, AttrsList, FamilyOwned, TextLayout, Wrap},
reactive::Scope,
text::{Attrs, AttrsList, FamilyOwned, TextLayout, Wrap},
views::editor::{
layout::TextLayoutLine,
phantom_text::PhantomTextLine,
Expand Down
12 changes: 6 additions & 6 deletions lapce-app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use clap::Parser;
use crossbeam_channel::Sender;
use floem::{
action::show_context_menu,
cosmic_text::{Style as FontStyle, Weight},
event::{Event, EventListener, EventPropagation},
ext_event::{create_ext_action, create_signal_from_channel},
menu::{Menu, MenuItem},
Expand All @@ -34,6 +33,7 @@ use floem::{
style_helpers::{self, auto, fr},
Line,
},
text::{Style as FontStyle, Weight},
unit::PxPctAuto,
views::{
clip, container, drag_resize_window_area, drag_window_area, dyn_stack,
Expand Down Expand Up @@ -3594,7 +3594,7 @@ pub fn launch() {

#[cfg(feature = "vendored-fonts")]
{
use floem::cosmic_text::{fontdb::Source, FONT_SYSTEM};
use floem::text::{fontdb::Source, FONT_SYSTEM};

const FONT_DEJAVU_SANS_REGULAR: &[u8] = include_bytes!(concat!(
env!("CARGO_MANIFEST_DIR"),
Expand All @@ -3606,12 +3606,12 @@ pub fn launch() {
));

FONT_SYSTEM
.db()
.write()
.lock()
.db_mut()
.load_font_source(Source::Binary(Arc::new(FONT_DEJAVU_SANS_REGULAR)));
FONT_SYSTEM
.db()
.write()
.lock()
.db_mut()
.load_font_source(Source::Binary(Arc::new(
FONT_DEJAVU_SANS_MONO_REGULAR,
)));
Expand Down
2 changes: 1 addition & 1 deletion lapce-app/src/config/ui.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use floem::cosmic_text::FamilyOwned;
use floem::text::FamilyOwned;
use serde::{Deserialize, Serialize};
use structdesc::FieldNames;

Expand Down
20 changes: 10 additions & 10 deletions lapce-app/src/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ use std::{

use floem::{
action::exec_after,
cosmic_text::{Attrs, AttrsList, FamilyOwned, TextLayout},
ext_event::create_ext_action,
keyboard::Modifiers,
peniko::Color,
reactive::{batch, ReadSignal, RwSignal, Scope},
text::{Attrs, AttrsList, FamilyOwned, TextLayout},
views::editor::{
actions::CommonAction,
command::{Command, CommandExecuted},
Expand Down Expand Up @@ -1813,23 +1813,23 @@ impl Styling for DocStyling {
&self,
_: EditorId,
_line: usize,
) -> std::borrow::Cow<[floem::cosmic_text::FamilyOwned]> {
) -> std::borrow::Cow<[floem::text::FamilyOwned]> {
// TODO: cache this
Cow::Owned(self.config.with_untracked(|config| {
FamilyOwned::parse_list(&config.editor.font_family).collect()
}))
}

fn weight(&self, _: EditorId, _line: usize) -> floem::cosmic_text::Weight {
floem::cosmic_text::Weight::NORMAL
fn weight(&self, _: EditorId, _line: usize) -> floem::text::Weight {
floem::text::Weight::NORMAL
}

fn italic_style(&self, _: EditorId, _line: usize) -> floem::cosmic_text::Style {
floem::cosmic_text::Style::Normal
fn italic_style(&self, _: EditorId, _line: usize) -> floem::text::Style {
floem::text::Style::Normal
}

fn stretch(&self, _: EditorId, _line: usize) -> floem::cosmic_text::Stretch {
floem::cosmic_text::Stretch::Normal
fn stretch(&self, _: EditorId, _line: usize) -> floem::text::Stretch {
floem::text::Stretch::Normal
}

fn indent_line(&self, _: EditorId, line: usize, line_content: &str) -> usize {
Expand Down Expand Up @@ -2093,8 +2093,8 @@ fn extra_styles_for_range(
return None;
}

let height = (run.glyph_ascent + run.glyph_descent) as f64;
let y = run.line_y as f64 - run.glyph_ascent as f64;
let height = (run.max_ascent + run.max_descent) as f64;
let y = run.line_y as f64 - run.max_ascent as f64;

Some(LineExtraStyle {
x,
Expand Down
2 changes: 1 addition & 1 deletion lapce-app/src/editor/gutter.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use floem::{
context::PaintCx,
cosmic_text::{Attrs, AttrsList, FamilyOwned, TextLayout},
peniko::kurbo::{Point, Rect, Size},
text::{Attrs, AttrsList, FamilyOwned, TextLayout},
Renderer, View, ViewId,
};
use lapce_core::{buffer::rope_text::RopeText, mode::Mode};
Expand Down
2 changes: 1 addition & 1 deletion lapce-app/src/file_explorer/view.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::{path::Path, rc::Rc, sync::Arc};

use floem::{
cosmic_text::Style as FontStyle,
event::{Event, EventListener},
peniko::Color,
reactive::{create_rw_signal, ReadSignal, RwSignal},
style::{AlignItems, CursorStyle, Position, Style},
text::Style as FontStyle,
views::{
container, dyn_stack, label, scroll, stack, svg, virtual_stack, Container,
Decorators, VirtualDirection, VirtualItemSize,
Expand Down
2 changes: 1 addition & 1 deletion lapce-app/src/focus_text.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use floem::{
cosmic_text::{Attrs, AttrsList, FamilyOwned, TextLayout, Weight},
peniko::{
kurbo::{Point, Rect},
Color,
Expand All @@ -8,6 +7,7 @@ use floem::{
reactive::create_effect,
style::{FontFamily, FontSize, LineHeight, Style, TextColor},
taffy::prelude::NodeId,
text::{Attrs, AttrsList, FamilyOwned, TextLayout, Weight},
Renderer, View, ViewId,
};

Expand Down
2 changes: 1 addition & 1 deletion lapce-app/src/markdown.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use floem::cosmic_text::{
use floem::text::{
Attrs, AttrsList, FamilyOwned, LineHeightValue, Style, TextLayout, Weight,
};
use lapce_core::{language::LapceLanguage, syntax::Syntax};
Expand Down
2 changes: 1 addition & 1 deletion lapce-app/src/panel/debug_view.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::{rc::Rc, sync::Arc};

use floem::{
cosmic_text::Style as FontStyle,
event::EventListener,
peniko::Color,
reactive::{create_rw_signal, ReadSignal, RwSignal},
style::CursorStyle,
text::Style as FontStyle,
views::{
container, dyn_stack, label, scroll, stack, svg, text, virtual_stack,
Decorators, VirtualDirection, VirtualItemSize,
Expand Down
2 changes: 1 addition & 1 deletion lapce-app/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::{collections::BTreeMap, rc::Rc, sync::Arc, time::Duration};

use floem::{
action::{add_overlay, exec_after, remove_overlay, TimerToken},
cosmic_text::{Attrs, AttrsList, FamilyOwned, TextLayout},
event::EventListener,
keyboard::Modifiers,
peniko::kurbo::{Point, Rect, Size},
Expand All @@ -11,6 +10,7 @@ use floem::{
Scope,
},
style::CursorStyle,
text::{Attrs, AttrsList, FamilyOwned, TextLayout},
views::{
container, dyn_stack, empty, label,
scroll::{scroll, PropagatePointerWheel},
Expand Down
2 changes: 1 addition & 1 deletion lapce-app/src/terminal/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ use alacritty_terminal::{
};
use floem::{
context::{EventCx, PaintCx},
cosmic_text::{Attrs, AttrsList, FamilyOwned, TextLayout, Weight},
event::{Event, EventPropagation},
peniko::{
kurbo::{Point, Rect, Size},
Color,
},
pointer::PointerInputEvent,
reactive::{create_effect, ReadSignal, RwSignal},
text::{Attrs, AttrsList, FamilyOwned, TextLayout, Weight},
views::editor::{core::register::Clipboard, text::SystemClipboard},
Renderer, View, ViewId,
};
Expand Down
2 changes: 1 addition & 1 deletion lapce-app/src/text_area.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use floem::{
cosmic_text::{Attrs, AttrsList, LineHeightValue, TextLayout},
peniko::kurbo::Rect,
reactive::{create_effect, create_rw_signal},
text::{Attrs, AttrsList, LineHeightValue, TextLayout},
views::{container, label, rich_text, scroll, stack, Decorators},
View,
};
Expand Down
2 changes: 1 addition & 1 deletion lapce-app/src/text_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::{rc::Rc, sync::Arc};
use floem::{
action::{set_ime_allowed, set_ime_cursor_area},
context::EventCx,
cosmic_text::{Attrs, AttrsList, FamilyOwned, TextLayout},
event::{Event, EventListener, EventPropagation},
peniko::{
kurbo::{Line, Point, Rect, Size, Vec2},
Expand All @@ -19,6 +18,7 @@ use floem::{
PaddingLeft, Style, TextColor,
},
taffy::prelude::NodeId,
text::{Attrs, AttrsList, FamilyOwned, TextLayout},
unit::PxPct,
views::Decorators,
Renderer, View, ViewId,
Expand Down
2 changes: 1 addition & 1 deletion lapce-app/src/window_tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ use std::{
use crossbeam_channel::Sender;
use floem::{
action::{open_file, remove_overlay, TimerToken},
cosmic_text::{Attrs, AttrsList, FamilyOwned, LineHeightValue, TextLayout},
ext_event::{create_ext_action, create_signal_from_channel},
file::FileDialogOptions,
keyboard::Modifiers,
kurbo::Size,
peniko::kurbo::{Point, Rect, Vec2},
reactive::{use_context, Memo, ReadSignal, RwSignal, Scope, WriteSignal},
text::{Attrs, AttrsList, FamilyOwned, LineHeightValue, TextLayout},
ViewId,
};
use indexmap::IndexMap;
Expand Down
6 changes: 1 addition & 5 deletions lapce-core/src/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ const LANGUAGES: &[SyntaxProperties] = &[
},
SyntaxProperties {
id: LapceLanguage::Go,
indent: Indent::space(4),
indent: Indent::tab(),
files: &[],
extensions: &["go"],
comment: comment_properties!("//"),
Expand Down Expand Up @@ -1677,10 +1677,6 @@ const LANGUAGES: &[SyntaxProperties] = &[
impl LapceLanguage {
const HIGHLIGHTS_INJECTIONS_FILE_NAME: &'static str = "injections.scm";
const HIGHLIGHTS_QUERIES_FILE_NAME: &'static str = "highlights.scm";
#[cfg(unix)]
const SYSTEM_GRAMMARS_DIRECTORY: &'static str = "/usr/lib";
#[cfg(unix)]
const SYSTEM_QUERIES_DIRECTORY: &'static str = "/usr/share/tree-sitter/grammars";

pub fn from_path(path: &Path) -> LapceLanguage {
Self::from_path_raw(path).unwrap_or(LapceLanguage::PlainText)
Expand Down

0 comments on commit 8661de6

Please sign in to comment.