Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "egui_code_editor"
authors = ["Roman Chumak <p4ymak@yandex.ru>"]
version = "0.2.21"
version = "0.2.22"
edition = "2024"
license = "MIT"
repository = "https://github.com/p4ymak/egui_code_editor"
Expand All @@ -11,7 +11,7 @@ categories = ["gui", "text-editors"]
keywords = ["egui", "GUI", "editor", "syntax", "highlighting"]

[dependencies]
egui = { version = "0.33", optional = true }
egui = { version = "0.34", optional = true }
serde = { version = "1", optional = true}

[lib]
Expand All @@ -33,5 +33,5 @@ name = "tui"
test = true

[dev-dependencies]
eframe = "0.33"
eframe = "0.34"
colorful = "0.3"
12 changes: 6 additions & 6 deletions examples/demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ impl CodeEditorDemo {
}
}
impl eframe::App for CodeEditorDemo {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
egui::SidePanel::left("theme_picker").show(ctx, |ui| {
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
egui::Panel::left("theme_picker").show_inside(ui, |ui| {
ui.heading("Theme");
egui::ScrollArea::both().show(ui, |ui| {
for theme in THEMES.iter() {
Expand All @@ -176,16 +176,16 @@ impl eframe::App for CodeEditorDemo {
.clicked()
{
if theme.is_dark() {
ctx.set_visuals(egui::Visuals::dark());
ui.set_visuals(egui::Visuals::dark());
} else {
ctx.set_visuals(egui::Visuals::light());
ui.set_visuals(egui::Visuals::light());
}
};
}
});
});

egui::SidePanel::right("syntax_picker").show(ctx, |ui| {
egui::Panel::right("syntax_picker").show_inside(ui, |ui| {
ui.horizontal(|h| {
h.heading("Syntax");
h.checkbox(&mut self.example, "Example");
Expand All @@ -207,7 +207,7 @@ impl eframe::App for CodeEditorDemo {
});
});

egui::CentralPanel::default().show(ctx, |ui| {
egui::CentralPanel::default().show_inside(ui, |ui| {
ui.horizontal(|h| {
h.label("Numbering Shift");
h.add(egui::DragValue::new(&mut self.shift));
Expand Down
5 changes: 2 additions & 3 deletions src/completer/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
mod trie;

use std::collections::BTreeSet;

use crate::{ColorTheme, Syntax, Token, TokenType, format_token};
use egui::{
Event, Frame, Modifiers, Sense, Stroke, TextBuffer, text_edit::TextEditOutput,
text_selection::text_cursor_state::ccursor_previous_word,
};
use std::collections::BTreeSet;
use trie::Trie;

impl From<&Syntax> for Trie {
Expand Down Expand Up @@ -194,7 +193,7 @@ impl Completer {
cursor_rect,
editor_output.response.layer_id,
)
.frame(Frame::popup(&ctx.style()).fill(theme.bg()))
.frame(Frame::popup(&ctx.global_style()).fill(theme.bg()))
.sense(Sense::empty())
.show(|ui| {
ui.response().sense = Sense::empty();
Expand Down
7 changes: 6 additions & 1 deletion src/highlighting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,10 @@ pub type HighlightCache = egui::util::cache::FrameCache<LayoutJob, Token>;

#[cfg(feature = "egui")]
pub fn highlight<T: Editor>(ctx: &egui::Context, cache: &T, text: &str) -> LayoutJob {
ctx.memory_mut(|mem| mem.caches.cache::<HighlightCache>().get((cache, text)))
ctx.memory_mut(|mem| {
mem.caches
.cache::<HighlightCache>()
.get((cache, text))
.to_owned()
})
}
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ impl CodeEditor {
.id_source(format!("{}_numlines", self.id))
.font(egui::TextStyle::Monospace)
.interactive(false)
.frame(false)
.frame(egui::Frame::NONE)
.desired_rows(self.rows)
.desired_width(width)
.layouter(&mut layouter),
Expand Down Expand Up @@ -361,7 +361,7 @@ impl CodeEditor {
.id_source(&self.id)
.lock_focus(true)
.desired_rows(self.rows)
.frame(true)
.frame(egui::Frame::NONE)
.desired_width(self.desired_width)
.layouter(&mut layouter)
.show(ui);
Expand Down
Loading