`ColorImage` fields are now private. Use `resolution()`, `pixels()`,
`pixels_mut()`, and `source_size()` instead.
Also renames `size` to `resolution` in several texture-related APIs
(`ImageData`, `TextureHandle`, `TextureMeta`, `TextureAtlas`,
`Fonts::font_image_resolution`).
`ColorImage::new` now panics if `width * height != pixels.len()`.
## Motivation
A) Make `ColorImage` always valid
B) Stop confusing using the confusing word `size` where `resolution` is
better
* Related: #5233, upstream
https://github.com/linebender/parley/issues/644
* [ ] I have followed the instructions in the PR template
On Windows with a non-Chinese locale, fontique's Han fallback is a
single Japanese font (Yu Gothic UI), which lacks many Simplified Chinese
characters like 这 and 还. These rendered as tofu even with Microsoft
YaHei installed.
The example text from the added demo without the fix fails to show some
glyphs:
<img width="582" height="146" alt="image"
src="https://github.com/user-attachments/assets/1f37a778-6d67-431f-9aad-c7bd23e0e360"
/>
`SystemFontProvider` now tries the other Han locales
(Simplified/Traditional Chinese, Japanese, Korean) when the font for the
preferred locale can't render a char.
Simplified Chinese is looked up as `zh-SG` instead of `zh-CN`: fontique
treats `zh-CN` as the default Han locale and caches the result of the
locale-less Han lookup (which every `Query::set_fallbacks` makes) as
that default. So `zh-CN` lookups often returned the Japanese font,
depending on which scripts were looked up first. A TODO points at
linebender/parley#689, which should make this workaround unnecessary.
Also adds a collapsed "System font fallback" section to the Misc Demos
window to check the fallback by eye.
## Testing
Verified on Windows 11 (de-DE): all samples in Misc Demos → System font
fallback render, and `cargo test -p egui_system_fonts --
--include-ignored` passes.
**Still needs testing on macOS and Linux**: open Misc Demos → System
font fallback in `egui_demo_app` and run the ignored tests above. Both
platforms also pick a single fallback font per script in fontique, so
they could have the same problem in milder form, e.g. a Japanese-locale
Mac, or a Linux system with only a Japanese CJK font.
The Misc Demos snapshot was updated on Windows; if CI disagrees,
`./scripts/update_snapshots_from_ci.sh` should fix it.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
`CCursor::new` was a bit of a foot-gun: it had no docstring, and it's
easy to accidentally pass it a byte offset instead of a character
offset.
* Document that `CCursor::new` takes a character offset, NOT a byte
offset
* Add `CCursor::end_of_str(text)`: a cursor after the last character of
`text` (i.e. `text.chars().count()`)
* Add `CCursorRange::select_all_str(text)`: select all of `text`
* Use these in `DragValue` and the `TextEdit` demo
🤖 Generated with [Claude Code](https://claude.com/claude-code)
The non-`syntect` fallback highlighter in `egui_extras` now supports SQL
(`"sql"`):
* `-- line comments`
* `'single-quoted'` strings
* Case-insensitive keywords (`SELECT`, `select`, …)
Also: `_` is now treated as part of a word for all languages, so
identifiers like `order_id` (SQL) or `self_ref` (Rust) no longer get a
keyword highlighted inside them.
Snapshot test in `egui_demo_lib/tests/misc.rs` renders SQL with both
backends (`sql_fallback_*` / `sql_syntect_*`). Note: CI runs
`--all-features`, so only the syntect snapshots are checked there; the
fallback ones are checked by `cargo test -p egui_demo_lib`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
`CollapsingHeader::custom(ui, id_salt, add_header, add_body)` is a
convenience wrapper around `CollapsingState::show_header(…).body(…)`,
letting you put arbitrary widgets (checkboxes, buttons, …) in the header
of a collapsing section without manually managing a `CollapsingState`.
The "Custom Collapsing Header" demo in the misc demo window now uses it.
* [x] I have followed the instructions in the PR template
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Closes <https://github.com/emilk/egui/issues/7650>
[ X] I have followed the instructions in the PR template
Previously submitted as <https://github.com/emilk/egui/pull/7666> but
replaced to clean up the git history.
This feature allows building image viewers and similar applications
using a `Scene` container where the desired mouse wheel input without a
modifier is to zoom rather than scroll/pan.
Alternatives considered:
Swap zoom and scroll variables used in `Scene`
- Would cause touch input zoom to scroll/pan instead which would be
inconsistent with standard user interface interaction
- This also means there is no simple way to swap zoom and vertical
scroll modifiers for this use case e.g. ctrl+mousewheel pans vertically
while mousewheel alone zooms.
- What is implemented results in ctrl-mousewheel and mousewheel only
being identical inputs.
Modify `ctx.option.zoom_modifier`
- Doesn't work because `Modifiers:NONE` never matches to anything (and
therefore disables mouse wheel zoom globally).
- Refactoring this to provide a different option per container is a
large amount of work and does not seem to be a use case that is likely
to be used outside of `Scene`
The logic used inside `Scene` to achieve this is fairly simple and only
adds one extra dependency on `input_options.scroll_zoom_speed` to ensure
that the zoom speed setting change is consistent across the application.
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
* [x] I have followed the instructions in the PR template
Compiler optimization will replace these later on, but when building
without optimization they will (most often) stay divisions and divisions
are clearly slower than multiplications.
Note that the `/ 2.5` replacement is not bit-exact (since 0.4 cannot be
represented exactly, but 2.5 can), but my guess is that the
approximation is good enough. The others should be bit-exact.
(Division by 2 for unsigned numbers will be replaced to >>1 earlier in
the compile chain, so no point in doing the same there.)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Broken out of #8617.
* `TextEdit::margin` now makes room for the stroke inside the margin
(like the theme does), so the stroke width changing on hover/focus no
longer causes a layout shift.
* `TextEdit::clip_text(false)` now expands the widget to make all text
visible, as documented, instead of being capped at `desired_width`.
* The default `TextEdit` inner margin is now `spacing.button_padding`,
and the theme gives `TextEdit` the same min height (`interact_size.y`)
as a `Button`, so they always have the exact same height (previously off
by 1px).
Tests added to `test_widget_heights.rs`: text edit included in the
matching-heights test (now run for several `interact_size.y` values),
size stable on hover/focus (with and without custom margin), and
unclipped text edit grows to fit text.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Add `BandShape` to epaint, supporting and varying width band along some
direction.
This can be useful in egui_plot, e.g. for filling the area under a
curve, or for visualizing a audio waveform, for instance.
The band has feathering for the fill, plus an optional stroke that is
just drawn on top of the fill.
This solves a small subset of non-convex polygons (since the general
solution is quite difficult, at least if you want feathered edges).
<img width="493" height="180" alt="Screenshot 2026-09-01 at 20 56 33"
src="https://github.com/user-attachments/assets/f79ae9bc-3512-4c87-b166-d1240a8dd3e4"
/>
Includes an interactive waveform demo and alpha screenshot coverage.
Related work:
- https://github.com/emilk/egui/issues/513
- https://github.com/emilk/egui_plot/pull/260
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
[performance] Avoid cross-viewport GalleyCache eviction
This changes `Fonts` to keep `GalleyCache` entries partitioned by
viewport.
Previously, multiple viewports shared one galley cache. Since each
viewport flushes the cache at the start of its pass, root and child
viewports could repeatedly evict each other's text layouts.
As viewport text workload grows, this can force repeated layout of large
text contents and cause severe performance degradation, with the frame
rate dropping below 10 FPS in some cases.
Font data and the texture atlas remain shared. Only layout caches are
separated by an opaque viewport namespace.
* Closes#5249
* Related #5836
* Related #7885
* Related #8284
* Closes#8419
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
A font family with no font at all used to lay out to an *empty galley*:
the run had no face to shape with, so it was dropped.
`Galley::clamp_cursor` on that empty galley returns 0, so a `TextEdit`
lost its cursor the frame after typing — text stayed, cursor jumped to
0, and e.g. completion popups never opened. Found in rerun's tests after
dropping `default_fonts`, where nothing installed a font for the bare
kittest harness.
### Changes
* epaint: a family without fonts now lays out **one synthetic tofu box
per grapheme cluster**, with metrics derived from the font size.
`glyphs.len() == char_count` and non-zero row heights hold even with no
font.
* epaint: new `MissingGlyphPolicy { Tofu, Panic }` on `Fonts`, consulted
only after every font, `FontProvider` and `GlyphRasterizer` had its
turn. Control characters (`\t`, `\n`, …) never panic, since fonts have
no glyphs for them. The panic names the character, the family and the
installed fonts.
* egui: `Context::set_missing_glyph_policy` / `missing_glyph_policy`.
* egui_kittest: **panics on a missing glyph by default**, since tofu in
a snapshot is easy to miss. Opt out with
`HarnessBuilder::allow_missing_glyphs()`. One demo test needed it (the
emoji completion popup lists emoji the bundled fonts lack).
Top: with fonts, U+10FFFD drawn with Ubuntu's `.notdef`. Bottom: the
same UI with `FontDefinitions::empty()`, all synthetic tofu (3× zoom):
<picture>
<img
src="https://static.rerun.io/tofu_cmp/1c2a567a1f53c301897e716452974a0b6fbc8e12/full.png"
alt="">
<source media="(max-width: 480px)"
srcset="https://static.rerun.io/tofu_cmp/1c2a567a1f53c301897e716452974a0b6fbc8e12/480w.png">
<source media="(max-width: 768px)"
srcset="https://static.rerun.io/tofu_cmp/1c2a567a1f53c301897e716452974a0b6fbc8e12/768w.png">
</picture>
Written by Claude (LLM) together with @emilk.
* [x] I have followed the instructions in the PR template
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* Stacked on #8581
**⚠️ Breaking ⚠️**
`egui_kittest` that every input widget (button, checkbox, slider, combo
box, text field, …) has an accessible name.
Opt out with `HarnessBuilder::with_accessibility_check(false)`, or run
it by hand with `Harness::check_accessibility`.
Running it over egui's own tests found real gaps, fixed here:
* An empty label (`checkbox(&mut b, "")`) took precedence over
`labelled_by`; now it is not set at all.
* `DragValue` is named after its prefix or suffix (it used to clear the
name).
* The color button has a name, with the color as its value.
* `TextEdit` lost its placeholder on frames where the selection changed.
* `Margin`, `CornerRadius` and the font-size slider name their inputs.
* The demos and kittest tests name their remaining inputs.
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* Closes#2744.
Adds `RangeSlider`: two handles selecting a sub-range, an editable value
at each end, and the accent fill between them.
Three commits:
**1. Move `Slider`'s geometry, painting and interaction into a private
`slider_core`.** No new `Visuals` field. The one rendering change: the
trailing fill is clamped to the rail, which moves it by under a pixel
for narrow rect handles.
**2. Add `RangeSlider` on top of it.** Rail, handles, hover growth,
`HandleShape` and the fill are the same code `Slider` runs, so the two
do not look different.
** 3. Added per-handle keyboard and screen-reader support. Each handle
is its own focus stop, so Tab reaches either end and the arrow keys move
the focused one. Each handle reports itself to AccessKit bounded by its
neighbour rather than by the end of the rail.
A separate widget rather than a mode on `Slider`, because none of this
means anything with one handle:
- the grabbed handle is remembered for the whole drag, so dragging one
handle past the other does not hand the pointer to its neighbour
- when the handles coincide, the side the pointer is on decides which
one moves
- `min_separation` sets how close they may come
One change: `paint_fill` takes a `Rangef` instead of a handle centre.
API changes from the review follow-ups:
- `Slider::prefix`/`suffix` take `impl IntoAtoms`, like `DragValue`, so
images and styled text work. Plain `char` or number arguments no longer
do.
- A prefix goes in front of any prefix already set, and a suffix after
any suffix already set, on `DragValue`, `Slider`, `RangeSlider`, and
`TextEdit`. `Slider` and `TextEdit` used to replace.
- `ValueFormat`, `SliderSpec`, and `DragValueSettings` are public, with
`format()`, `spec()`, and `drag_value()` builders on both sliders.
- `DragValue::atoms()` returns `Atoms` by value.
Snapshots: the new gallery row changes `widget_gallery_*` and
`demos/Scene` (the Scene demo embeds a Widget Gallery). `RangeSlider` is
also added to `test_widgets.rs`, which adds two new snapshots.
Written with Claude (llm), I (gavrelina) have reviewed the code myself
(I did!).
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
`Ui::id` was easy to confuse with `Ui::unique_id`. It is the id of the
_scope_ the `Ui` belongs to: stable across frames, shared by sibling
`Ui`s, and the base for widget state ids. `Ui::unique_id` is unique per
`Ui` but unstable.
This renames `Ui::id` to `Ui::scope_id` (old name deprecated) and
rewrites both docstrings to say so.
Follow-up to discussion in:
* https://github.com/emilk/egui/pull/8534#discussion_r3969041538
* [x] I have followed the instructions in the PR template
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
New widget `egui::CompletionPopup`: a code completion popup over a
`TextEdit`. ↑/↓ selects, Enter or Tab accepts, Escape closes, click
accepts. Keyboard focus never leaves the text field. The caller supplies
suggestions for the word under the cursor:
```rust
CompletionPopup::new(id).show(ui, TextEdit::singleline(&mut text), |query| suggest(query));
```
New example `code_completion` shows slash-command completion, with
headless `egui_kittest` tests for the arrow/Enter/Tab/Escape behavior,
including a multiline chat composer.
Builds on:
* https://github.com/emilk/egui/pull/8530
Note on Escape: egui surrenders focus on Escape in `Memory::begin_pass`,
before any widget runs. So an app that wants "Escape does X while the
text field is focused" must set `TextEdit::event_filter(EventFilter {
escape: true, .. })`, or the handler never sees the field focused. The
popup does this for you while it is open.

* Related: <https://github.com/emilk/egui/issues/122>
* [x] I have followed the instructions in the PR template
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Eguis built in widgets should work right even if there are no
default/system fonts. This renders the submenubutton triangle with
epaint so it will always look right and isn't system-font dependent.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
`Id::new` and `From<&str> for Id` etc are foot-guns: they hide the fact
that an `Id` MUST be globally unique (well, at least unique within your
app).
So this PR removes both and replaces them with `Id::unique`, which is
very explicit.
In places where non-uniqueness is desired, you can use `IdSalt`, which
has the convenient `From<&str>`.
Most changes are in tests.
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
Migration guide for the changelog:
`ViewportCommand::Screenshot` was changed to be callback based.
Previously you needed to iter the input events to check for the
screenshot (but didn't need interior mutability):
```rs
[derive(Default)]
struct MyApp {
screenshot: Option<Arc<egui::ColorImage>>,
}
impl eframe::App for MyApp {
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
if ui.button("Screenshot").clicked() {
ui.send_viewport_cmd(ViewportCommand::Screenshot(UserData::default()));
}
let image = ui.input(|i| {
i.events
.iter()
.filter_map(|e| {
if let egui::Event::Screenshot { image, .. } = e {
Some(Arc::clone(image))
} else {
None
}
})
.next_back()
});
if let Some(image) = image {
self.screenshot = Some(image);
}
}
}
```
Now you need to use a mutex, channel, or some other sync primitive to
get the result:
```rs
#[derive(Default)]
struct MyApp {
screenshot: Arc<Mutex<Option<Arc<egui::ColorImage>>>>,
}
impl eframe::App for MyApp {
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
if ui.button("Screenshot").clicked() {
let ctx = ui.ctx().clone();
let screenshot_mutex = self.screenshot.clone();
ui.request_screenshot(move |screenshot| {
screenshot_mutex.lock().replace(screenshot);
ctx.request_repaint();
});
}
}
}
```
----
This implements a callback-based screenshot api for egui
Upsides over `ViewportCommand::Screenshot`:
- More convenient api: `ctx.request_screenshot(|screnshot| ...)` (and no
need to downcast UserData)
- Reading screenshot data doesn't require rendering another frame
- Should allow us to add recording as a plugin without special hooks in
egui_kittest (otherwise capturing the last frame would have required
custom hooks in kittest)
- This was also a problem in
[kittest_inspector](https://github.com/rerun-io/kittest_inspector): When
streaming a real app, the frame seen was always a couple frames behind
when the app was idle
Closes#8478.
Editing the alpha `DragValue` rebuilt the full HSVA color from the
displayed RGBA values, which could re-quantize RGB. This tracks RGB and
alpha edits separately so alpha-only edits preserve RGB.
Adds regression coverage for gamma-byte and linear numeric color spaces.
- [x] I have followed the instructions in the PR template
`Font<'a>` was a hand-rolled split borrow of every field of `FontsImpl`,
and it grew a new `&'a mut` for each new feature. `text_layout` now
calls `FontsImpl` directly (`resolve_face`, `glyph_info`,
`allocate_glyph`, `rasterize_cluster`, …) with a cheap `FamilyKey` index
instead of re-hashing the `FontFamily` per glyph.
`font.rs` is renamed to `font_face.rs`, since only `FontFace` is left in
it. `FontsView::characters` replaces `f.fonts.font(family).characters()`
in the font book demo.
`FontsImpl` and `epaint::text::layout` are now crate-private: nothing
outside `epaint` used them, and `Fonts` / `FontsView` cover the public
API. The `fonts` fields of `Fonts` and `FontsView` are private too. The
benchmark that used `layout` directly now calls the new
`Fonts::layout_uncached`.
* [x] I have followed the instructions in the PR template
PR chain, in order:
* #8490
* #8500
* #8501
* #8502
* #8503
* #8504
* #8491
* #8492
* #8493
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This happens because `bg_stroke`'s width isn't constant.
| Before | After |
|--------|--------|
| <img width="320" height="320" alt="before"
src="https://github.com/user-attachments/assets/0101e5fb-0781-4867-9891-c91d49dbb969"
/> | <img width="320" height="320" alt="after"
src="https://github.com/user-attachments/assets/4223218a-2f5f-4542-9fe2-67be5799ca81"
/> |
---
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* Keep PR description short and to the point! No long LLM slop.
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until a human has reviewed it
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
* [x] I have followed the instructions in the PR template
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
`constrain_to` overrides `constrain`, so I adjusted it to call
`constrain_to` before `constrain`.
* [x] I have followed the instructions in the PR template
Signed-off-by: limo520 <247564335@qq.com>
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
# What it does
Addition of a new system of theme plugins which allow the user to use
different rules engine to compute the style for the available
specialised widget style.
# How to use
Create a engine implementing the trait `ThemePlugin` and `ThemeStyle<S:
StyleStruct>` and implement the necessary methods, then register this
way (example for `ButtonStyle`):
```ui.add_theme::<ButtonStyle>(&mycustomengine);```
Now all button will call the `ThemeStyle<ButtonStyle>` method to compute the correct style and later use the cached value to avoid the costly computation.
If no valid `ThemeStyle<S>` or engine is available then it fallback to the default style.
* Closes part of <https://github.com/emilk/egui/issues/3284>
* [x] I have followed the instructions in the PR template
---------
Co-authored-by: adrien <221212@umons.ac.be>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
Instead of opting in to pedantic lints one by one, enable the whole
group and opt out of the noisy ones.
64% of the pedantic lints were already listed individually. This deletes
90 explicit lint lines, enables 51 pedantic lints we never listed, and
picks up new pedantic lints for free. Each opt-out carries its hit
count, so the cost of turning one back on is visible.
`restriction` and `nursery` stay opt-in per lint.
Stacked on top of #8430, which fixes the one real bug the new lints
found.
* [x] I have followed the instructions in the PR template
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
A fully collapsed `show_collapsible` panel now leaves a thin grab handle
at its fixed edge, invisible until hovered. Dragging it out past
`min_size` (or double-clicking it) reopens the panel. Opt out with
`panel.drag_to_open(false)`.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Change the feature name from syntax_highlighting to syntect.
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
* [x] I have followed the instructions in the PR template
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* Closes https://github.com/emilk/egui/issues/5605
It has been zero by default for a few months now, and I do not wish to
support it. It was always an ugly hack, and it is no longer needed.
We had a ton of issues around `TexturesDelta` that weren't properly
applied because we early-out of some function:
* https://github.com/emilk/egui/pull/8313
* https://github.com/emilk/egui/pull/8250
* https://github.com/emilk/egui/pull/8279
This PR changes texture updates, so that we always store them after
taking them out of `FullOutput` and keep the delta around until it's
actually applied (by passing &mut refs and draining instead of
iterating). So even if we add a new early return somewhere, that can't
break texture updates.
It also optimizes `TexturesDelta::append` by dropping any previous
deltas if there's a new `whole` delta or a `free`.
It also adds a debug assert that any `TexturesDelta` is empty when
dropped, as an additional safeguard in case the bug sneaks back in.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
The Debug-formatting of `Id` in debug-builds now contain the full
lineage:
```rs
#[test]
fn with_chain() {
let id = Id::new("a").with("b").with("c").with(7_i32);
assert_eq!(
format!("{id:?}"),
r#"Id::new("a").with("b").with("c").with(7)"#
);
}
```
## Related
* https://github.com/emilk/egui/pull/5851
* https://github.com/emilk/egui/pull/7988
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
* [x] I have followed the instructions in the PR template
At low apha values, premultiplied colors lose precision.
This PR makes the color picker use unmultiplied colors internally.
Before:
https://github.com/user-attachments/assets/4617a355-daa9-4911-86e6-518ac6867014
After:
https://github.com/user-attachments/assets/d9681b01-50d8-418e-b5a5-79b4bd1bbddf
The three methods for showing a `Panel` are now:
* `panel.show`: always show the panel.
* `panel.show_collapsible`: show or hide the panel, with a slide
animation in between.
* `Panel::show_switched`: animate between two different panels: a
thin/collapsed one and a thick/expanded one.
* Closes https://github.com/emilk/egui/pull/7254
You can now drag-to-close a panel. Also drag-to-expand panels.
This is a breaking change: the animated panel functions now take a
`open: &mut bool` instead of `open: bool`.
This is only enabled for resizable panels
## Related
* https://github.com/emilk/egui/pull/5851
* https://github.com/emilk/egui/pull/7988
## What
We want to make it easier to understand the lineage of a `Id` (which is
the parent `Id`, and the parent of that, etc?)
As a first step of that, we want to clarify the different between a
globally unique `Id`, and an `IdSalt`
I also introduced the `AsId` and `AsIdSalt` traits, which are
implemented of anything that implements `Hash` and `Debug`. The `Debug`
half of that is unused here, but will later be used in `Debug` builds to
produce a proper tree.
* Part of https://github.com/emilk/egui/issues/8180
So far, you've been able to move any `egui::Window` by dragging anywhere
on it. This makes sense on touch screens with thick fingers, but less so
on non-touch-screens.
With this PR, you can now control it with a new enum `WindowDrag`