diff --git a/CHANGELOG.md b/CHANGELOG.md index d9d3f80..f57ecc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,21 +6,22 @@ - Replace copy icon with checkmark when clicking copy button in code blocks ([#42](https://github.com/lampsitter/egui_commonmark/pull/42) by [@zeozeozeo](https://github.com/zeozeozeo)) - - Interactive tasklists with `CommonMarkViewer::show_mut` ([#40](https://github.com/lampsitter/egui_commonmark/pull/40) by [@crumblingstatue](https://github.com/crumblingstatue)) ### Changed - Alerts are case-insensitive -- More spacing between list indicator and elements ([#46](https://github.com/lampsitter/egui_commonmark/pull/46) +- More spacing between list indicator and elements ([#46](https://github.com/lampsitter/egui_commonmark/pull/46)) ### Fixed - Lists align text when wrapping instead of wrapping at the beginning of the next - line ([#46](https://github.com/lampsitter/egui_commonmark/pull/46) + line ([#46](https://github.com/lampsitter/egui_commonmark/pull/46)) - Code blocks won't insert a newline when in lists - In certain scenarios there was no newline after lists +- Copy button for code blocks show the correct cursor again on hover (regression + after egui 0.27) ## 0.14.0 - 2024-03-26 diff --git a/src/elements.rs b/src/elements.rs index fbb443b..04c07f8 100644 --- a/src/elements.rs +++ b/src/elements.rs @@ -120,16 +120,25 @@ pub fn code_block<'t>( let persistent_id = ui.make_persistent_id(output.response.id); let copied_icon = ui.memory_mut(|m| *m.data.get_temp_mut_or_default::(persistent_id)); - let copy_button = ui.put( - egui::Rect { - min: position, - max: position, - }, - egui::Button::new(if copied_icon { "✔" } else { "🗐" }) - .small() - .frame(false) - .fill(egui::Color32::TRANSPARENT), - ); + let copy_button = ui + .put( + egui::Rect { + min: position, + max: position, + }, + egui::Button::new(if copied_icon { "✔" } else { "🗐" }) + .small() + .frame(false) + .fill(egui::Color32::TRANSPARENT), + ) + // workaround for a regression after egui 0.27 where the edit cursor was shown even when + // hovering over the button. We try interact_cursor first to allow the cursor to be + // overriden + .on_hover_cursor( + ui.visuals() + .interact_cursor + .unwrap_or(egui::CursorIcon::Default), + ); // Update icon state in persistent memory if copied_icon && !copy_button.hovered() {