Check for typos on CI (#2918)

* Check for typos on CI

* Fix all typos
This commit is contained in:
Emil Ernerfeldt 2023-04-18 16:10:20 +02:00 committed by GitHub
parent 77df9cb982
commit 4809747952
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 60 additions and 33 deletions

17
.github/workflows/typos.yml vendored Normal file
View File

@ -0,0 +1,17 @@
# https://github.com/crate-ci/typos
# Add exceptions to _typos.toml
# install and run locally: cargo install typos-cli && typos
name: Spell Check
on: [pull_request]
jobs:
run:
name: Spell Check
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v2
- name: Check spelling of entire workspace
uses: crate-ci/typos@master

View File

@ -390,7 +390,7 @@ NOTE: [`epaint`](crates/epaint/CHANGELOG.md), [`eframe`](crates/eframe/CHANGELOG
* `Fonts::layout_job`: New text layout engine allowing mixing fonts, colors and styles, with underlining and strikethrough. * `Fonts::layout_job`: New text layout engine allowing mixing fonts, colors and styles, with underlining and strikethrough.
* Added `ui.add_enabled(bool, widget)` to easily add a possibly disabled widget. * Added `ui.add_enabled(bool, widget)` to easily add a possibly disabled widget.
* Added `ui.add_enabled_ui(bool, |ui| …)` to create a possibly disabled UI section. * Added `ui.add_enabled_ui(bool, |ui| …)` to create a possibly disabled UI section.
* Added feature `"serialize"` separatedly from `"persistence"`. * Added feature `"serialize"` separately from `"persistence"`.
* Added `egui::widgets::global_dark_light_mode_buttons` to easily add buttons for switching the egui theme. * Added `egui::widgets::global_dark_light_mode_buttons` to easily add buttons for switching the egui theme.
* `TextEdit` can now be used to show text which can be selected and copied, but not edited. * `TextEdit` can now be used to show text which can be selected and copied, but not edited.
* Added `Memory::caches` for caching things from one frame to the next. * Added `Memory::caches` for caching things from one frame to the next.
@ -405,7 +405,7 @@ NOTE: [`epaint`](crates/epaint/CHANGELOG.md), [`eframe`](crates/eframe/CHANGELOG
* MSRV (Minimum Supported Rust Version) is now `1.54.0`. * MSRV (Minimum Supported Rust Version) is now `1.54.0`.
* By default, `DragValue`s no longer show a tooltip when hovered. Change with `Style::explanation_tooltips`. * By default, `DragValue`s no longer show a tooltip when hovered. Change with `Style::explanation_tooltips`.
* Smaller and nicer color picker. * Smaller and nicer color picker.
* `ScrollArea` will auto-shrink to content size unless told otherwise using `ScollArea::auto_shrink`. * `ScrollArea` will auto-shrink to content size unless told otherwise using `ScrollArea::auto_shrink`.
* By default, `Slider`'s `clamp_to_range` is set to true. * By default, `Slider`'s `clamp_to_range` is set to true.
* Renamed `TextEdit::enabled` to `TextEdit::interactive`. * Renamed `TextEdit::enabled` to `TextEdit::interactive`.
* `ui.label` (and friends) now take `impl ToString` as argument instead of `impl Into<Label>`. * `ui.label` (and friends) now take `impl ToString` as argument instead of `impl Into<Label>`.
@ -597,8 +597,8 @@ NOTE: [`epaint`](crates/epaint/CHANGELOG.md), [`eframe`](crates/eframe/CHANGELOG
* Fixed bug that would close a popup (e.g. the color picker) when clicking inside of it. * Fixed bug that would close a popup (e.g. the color picker) when clicking inside of it.
### Deprecated ☢️ ### Deprecated ☢️
* Deprectated `combo_box_with_label` in favor of new `ComboBox`. * Deprecated `combo_box_with_label` in favor of new `ComboBox`.
* Deprectated type-specific constructors for `Slider` and `DragValue` (`Slider::f32`, `DragValue::usize` etc). * Deprecated type-specific constructors for `Slider` and `DragValue` (`Slider::f32`, `DragValue::usize` etc).
## 0.10.0 - 2021-02-28 - Plot and polish ## 0.10.0 - 2021-02-28 - Plot and polish
@ -686,7 +686,7 @@ NOTE: [`epaint`](crates/epaint/CHANGELOG.md), [`eframe`](crates/eframe/CHANGELOG
### Changed 🔧 ### Changed 🔧
* Renamed `Srgba` to `Color32`. * Renamed `Srgba` to `Color32`.
* All color contructions now starts with `from_`, e.g. `Color32::from_rgb`. * All color constructors now starts with `from_`, e.g. `Color32::from_rgb`.
* Renamed `FontFamily::VariableWidth` to `FontFamily::Proportional`. * Renamed `FontFamily::VariableWidth` to `FontFamily::Proportional`.
* Removed `pixels_per_point` from `FontDefinitions`. * Removed `pixels_per_point` from `FontDefinitions`.

View File

@ -20,7 +20,7 @@ members = [
# opt-level = 's' # 10-20% smaller wasm compared to `opt-level = 3` # opt-level = 's' # 10-20% smaller wasm compared to `opt-level = 3`
# opt-level = 1 # very slow and big wasm. Don't do this. # opt-level = 1 # very slow and big wasm. Don't do this.
opt-level = 2 # fast and small wasm, basically same as `opt-level = 's'` opt-level = 2 # fast and small wasm, basically same as `opt-level = 's'`
# opt-level = 3 # unecessarily large wasm for no performance gain # opt-level = 3 # unnecessarily large wasm for no performance gain
# debug = true # include debug symbols, useful when profiling wasm # debug = true # include debug symbols, useful when profiling wasm

View File

@ -286,7 +286,7 @@ You can also call the layout code twice (once to get the size, once to do the in
For "atomic" widgets (e.g. a button) `egui` knows the size before showing it, so centering buttons, labels etc is possible in `egui` without any special workarounds. For "atomic" widgets (e.g. a button) `egui` knows the size before showing it, so centering buttons, labels etc is possible in `egui` without any special workarounds.
#### CPU usage #### CPU usage
Since an immediate mode GUI does a full layout each frame, the layout code needs to be quick. If you have a very complex GUI this can tax the CPU. In particular, having a very large UI in a scroll area (with very long scrollback) can be slow, as the content needs to be layed out each frame. Since an immediate mode GUI does a full layout each frame, the layout code needs to be quick. If you have a very complex GUI this can tax the CPU. In particular, having a very large UI in a scroll area (with very long scrollback) can be slow, as the content needs to be laid out each frame.
If you design the GUI with this in mind and refrain from huge scroll areas (or only lay out the part that is in view) then the performance hit is generally pretty small. For most cases you can expect `egui` to take up 1-2 ms per frame, but `egui` still has a lot of room for optimization (it's not something I've focused on yet). You can also set up `egui` to only repaint when there is interaction (e.g. mouse movement). If you design the GUI with this in mind and refrain from huge scroll areas (or only lay out the part that is in view) then the performance hit is generally pretty small. For most cases you can expect `egui` to take up 1-2 ms per frame, but `egui` still has a lot of room for optimization (it's not something I've focused on yet). You can also set up `egui` to only repaint when there is interaction (e.g. mouse movement).

10
_typos.toml Normal file
View File

@ -0,0 +1,10 @@
# https://github.com/crate-ci/typos
# install: cargo install typos-cli
# run: typos
[default.extend-words]
nknown = "nknown" # part of @55nknown username
Prefence = "Prefence" # typo in glutin_winit API
[files]
extend-exclude = ["docs/egui_demo_app.js"] # auto-generated

View File

@ -522,7 +522,7 @@ impl EpiIntegration {
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Persistance stuff: // Persistence stuff:
pub fn maybe_autosave(&mut self, app: &mut dyn epi::App, window: &winit::window::Window) { pub fn maybe_autosave(&mut self, app: &mut dyn epi::App, window: &winit::window::Window) {
let now = std::time::Instant::now(); let now = std::time::Instant::now();

View File

@ -291,11 +291,11 @@ impl AppRunner {
/// Get mutable access to the concrete [`App`] we enclose. /// Get mutable access to the concrete [`App`] we enclose.
/// ///
/// This will panic if your app does not implement [`App::as_any_mut`]. /// This will panic if your app does not implement [`App::as_any_mut`].
pub fn app_mut<ConreteApp: 'static + App>(&mut self) -> &mut ConreteApp { pub fn app_mut<ConcreteApp: 'static + App>(&mut self) -> &mut ConcreteApp {
self.app self.app
.as_any_mut() .as_any_mut()
.expect("Your app must implement `as_any_mut`, but it doesn't") .expect("Your app must implement `as_any_mut`, but it doesn't")
.downcast_mut::<ConreteApp>() .downcast_mut::<ConcreteApp>()
.unwrap() .unwrap()
} }

View File

@ -2,7 +2,7 @@ use epaint::Shape;
use crate::{style::WidgetVisuals, *}; use crate::{style::WidgetVisuals, *};
/// Indicate wether or not a popup will be shown above or below the box. /// Indicate whether or not a popup will be shown above or below the box.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum AboveOrBelow { pub enum AboveOrBelow {
Above, Above,

View File

@ -257,7 +257,7 @@ impl GridLayout {
/// A simple grid layout. /// A simple grid layout.
/// ///
/// The cells are always layed out left to right, top-down. /// The cells are always laid out left to right, top-down.
/// The contents of each cell will be aligned to the left and center. /// The contents of each cell will be aligned to the left and center.
/// ///
/// If you want to add multiple widgets to a cell you need to group them with /// If you want to add multiple widgets to a cell you need to group them with

View File

@ -423,7 +423,7 @@ impl Painter {
self.fonts(|f| f.layout(text, font_id, color, f32::INFINITY)) self.fonts(|f| f.layout(text, font_id, color, f32::INFINITY))
} }
/// Paint text that has already been layed out in a [`Galley`]. /// Paint text that has already been laid out in a [`Galley`].
/// ///
/// You can create the [`Galley`] with [`Self::layout`]. /// You can create the [`Galley`] with [`Self::layout`].
/// ///
@ -435,7 +435,7 @@ impl Painter {
} }
} }
/// Paint text that has already been layed out in a [`Galley`]. /// Paint text that has already been laid out in a [`Galley`].
/// ///
/// You can create the [`Galley`] with [`Self::layout`]. /// You can create the [`Galley`] with [`Self::layout`].
/// ///

View File

@ -508,7 +508,7 @@ pub struct Visuals {
/// Draw a vertical lien left of indented region, in e.g. [`crate::CollapsingHeader`]. /// Draw a vertical lien left of indented region, in e.g. [`crate::CollapsingHeader`].
pub indent_has_left_vline: bool, pub indent_has_left_vline: bool,
/// Wether or not Grids and Tables should be striped by default /// Whether or not Grids and Tables should be striped by default
/// (have alternating rows differently colored). /// (have alternating rows differently colored).
pub striped: bool, pub striped: bool,

View File

@ -424,7 +424,7 @@ impl Ui {
/// # Sizes etc /// # Sizes etc
impl Ui { impl Ui {
/// Where and how large the [`Ui`] is already. /// Where and how large the [`Ui`] is already.
/// All widgets that have been added ot this [`Ui`] fits within this rectangle. /// All widgets that have been added to this [`Ui`] fits within this rectangle.
/// ///
/// No matter what, the final Ui will be at least this large. /// No matter what, the final Ui will be at least this large.
/// ///

View File

@ -344,7 +344,7 @@ impl RichText {
/// Often a [`WidgetText`] is just a simple [`String`], /// Often a [`WidgetText`] is just a simple [`String`],
/// but it can be a [`RichText`] (text with color, style, etc), /// but it can be a [`RichText`] (text with color, style, etc),
/// a [`LayoutJob`] (for when you want full control of how the text looks) /// a [`LayoutJob`] (for when you want full control of how the text looks)
/// or text that has already been layed out in a [`Galley`]. /// or text that has already been laid out in a [`Galley`].
#[derive(Clone)] #[derive(Clone)]
pub enum WidgetText { pub enum WidgetText {
RichText(RichText), RichText(RichText),
@ -662,7 +662,7 @@ impl WidgetTextJob {
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/// Text that has been layed out and ready to be painted. /// Text that has been laid out and ready to be painted.
#[derive(Clone, PartialEq)] #[derive(Clone, PartialEq)]
pub struct WidgetTextGalley { pub struct WidgetTextGalley {
pub galley: Arc<Galley>, pub galley: Arc<Galley>,
@ -670,13 +670,13 @@ pub struct WidgetTextGalley {
} }
impl WidgetTextGalley { impl WidgetTextGalley {
/// Size of the layed out text. /// Size of the laid out text.
#[inline] #[inline]
pub fn size(&self) -> crate::Vec2 { pub fn size(&self) -> crate::Vec2 {
self.galley.size() self.galley.size()
} }
/// Size of the layed out text. /// Size of the laid out text.
#[inline] #[inline]
pub fn text(&self) -> &str { pub fn text(&self) -> &str {
self.galley.text() self.galley.text()

View File

@ -69,7 +69,7 @@ fn about_immediate_mode(ui: &mut egui::Ui) {
ui.label("Note how there are no callbacks or messages, and no button state to store."); ui.label("Note how there are no callbacks or messages, and no button state to store.");
ui.label("Immediate mode has its roots in gaming, where everything on the screen is painted at the display refresh rate, i.e. at 60+ frames per second. \ ui.label("Immediate mode has its roots in gaming, where everything on the screen is painted at the display refresh rate, i.e. at 60+ frames per second. \
In immediate mode GUIs, the entire interface is layed out and painted at the same high rate. \ In immediate mode GUIs, the entire interface is laid out and painted at the same high rate. \
This makes immediate mode GUIs especially well suited for highly interactive applications."); This makes immediate mode GUIs especially well suited for highly interactive applications.");
ui.horizontal_wrapped(|ui| { ui.horizontal_wrapped(|ui| {

View File

@ -86,7 +86,7 @@ impl super::View for Scrolling {
fn huge_content_lines(ui: &mut egui::Ui) { fn huge_content_lines(ui: &mut egui::Ui) {
ui.label( ui.label(
"A lot of rows, but only the visible ones are layed out, so performance is still good:", "A lot of rows, but only the visible ones are laid out, so performance is still good:",
); );
ui.add_space(4.0); ui.add_space(4.0);

View File

@ -2,7 +2,7 @@
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
enum DemoType { enum DemoType {
Manual, Manual,
ManyHomogenous, ManyHomogeneous,
ManyHeterogenous, ManyHeterogenous,
} }
@ -61,7 +61,7 @@ impl super::View for TableDemo {
ui.radio_value(&mut self.demo, DemoType::Manual, "Few, manual rows"); ui.radio_value(&mut self.demo, DemoType::Manual, "Few, manual rows");
ui.radio_value( ui.radio_value(
&mut self.demo, &mut self.demo,
DemoType::ManyHomogenous, DemoType::ManyHomogeneous,
"Thousands of rows of same height", "Thousands of rows of same height",
); );
ui.radio_value( ui.radio_value(
@ -179,7 +179,7 @@ impl TableDemo {
}); });
} }
} }
DemoType::ManyHomogenous => { DemoType::ManyHomogeneous => {
body.rows(text_height, self.num_rows, |row_index, mut row| { body.rows(text_height, self.num_rows, |row_index, mut row| {
row.col(|ui| { row.col(|ui| {
ui.label(row_index.to_string()); ui.label(row_index.to_string());

View File

@ -52,7 +52,7 @@ impl super::View for IdTest {
ui.label("\ ui.label("\
Widgets that store state require unique and persisting identifiers so we can track their state between frames.\n\ Widgets that store state require unique and persisting identifiers so we can track their state between frames.\n\
For instance, collapsable headers needs to store whether or not they are open. \ For instance, collapsible headers needs to store whether or not they are open. \
Their Id:s are derived from their names. \ Their Id:s are derived from their names. \
If you fail to give them unique names then clicking one will open both. \ If you fail to give them unique names then clicking one will open both. \
To help you debug this, an error message is printed on screen:"); To help you debug this, an error message is printed on screen:");

View File

@ -56,7 +56,7 @@ pub const LOREM_IPSUM: &str = "Lorem ipsum dolor sit amet, consectetur adipiscin
pub const LOREM_IPSUM_LONG: &str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. pub const LOREM_IPSUM_LONG: &str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue, eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis, neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis, molestie eu, feugiat in, orci. In hac habitasse platea dictumst."; Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam various, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue, eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis, neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis, molestie eu, feugiat in, orci. In hac habitasse platea dictumst.";
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@ -625,7 +625,7 @@ pub struct TextShape {
/// Top left corner of the first character. /// Top left corner of the first character.
pub pos: Pos2, pub pos: Pos2,
/// The layed out text, from [`Fonts::layout_job`]. /// The laid out text, from [`Fonts::layout_job`].
pub galley: Arc<Galley>, pub galley: Arc<Galley>,
/// Add this underline to the whole text. /// Add this underline to the whole text.

View File

@ -70,7 +70,7 @@ pub fn layout(fonts: &mut FontsImpl, job: Arc<LayoutJob>) -> Galley {
for (i, row) in rows.iter_mut().enumerate() { for (i, row) in rows.iter_mut().enumerate() {
let is_last_row = i + 1 == num_rows; let is_last_row = i + 1 == num_rows;
let justify_row = justify && !row.ends_with_newline && !is_last_row; let justify_row = justify && !row.ends_with_newline && !is_last_row;
halign_and_jusitfy_row( halign_and_justify_row(
point_scale, point_scale,
row, row,
job.halign, job.halign,
@ -337,7 +337,7 @@ fn replace_last_glyph_with_overflow_character(
} }
} }
fn halign_and_jusitfy_row( fn halign_and_justify_row(
point_scale: PointScale, point_scale: PointScale,
row: &mut Row, row: &mut Row,
halign: Align, halign: Align,

View File

@ -850,7 +850,7 @@ impl Galley {
// keep same X coord // keep same X coord
let x = self.pos_from_cursor(cursor).center().x; let x = self.pos_from_cursor(cursor).center().x;
let column = if x > self.rows[new_row].rect.right() { let column = if x > self.rows[new_row].rect.right() {
// beyond the end of this row - keep same colum // beyond the end of this row - keep same column
cursor.rcursor.column cursor.rcursor.column
} else { } else {
self.rows[new_row].char_at(x) self.rows[new_row].char_at(x)

View File

@ -351,10 +351,10 @@ class WebHandle {
/** /**
* @param {string} _some_data * @param {string} _some_data
*/ */
set_some_content_from_javasript(_some_data) { set_some_content_from_javascript(_some_data) {
const ptr0 = passStringToWasm0(_some_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const ptr0 = passStringToWasm0(_some_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN; const len0 = WASM_VECTOR_LEN;
wasm.webhandle_set_some_content_from_javasript(this.ptr, ptr0, len0); wasm.webhandle_set_some_content_from_javascript(this.ptr, ptr0, len0);
} }
} }
__exports.WebHandle = WebHandle; __exports.WebHandle = WebHandle;