Skip to content

Commit

Permalink
add typos-cli to ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ameknite committed Mar 6, 2024
1 parent 4a80502 commit 6b4c99e
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 11 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@ jobs:
- name: Check Formatting
run: cargo fmt -- --check

typos:
name: Check for typos
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: typos-cli
- name: run typos
run: typos
- name: Typos info
if: failure()
run: |
echo 'To fix typos, please run `typos -w`'
echo 'To check for a diff, run `typos`'
echo 'You can find typos here: https://crates.io/crates/typos'
tests:
name: Test ${{ matrix.toolchain }} ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
Expand Down
2 changes: 1 addition & 1 deletion examples/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ impl ApplicationHandler<UserEvent> for Application {
println!("Preedit: {}, with caret at {:?}", text, caret_pos);
}
Ime::Commit(text) => {
println!("Commited: {}", text);
println!("Committed: {}", text);
}
Ime::Disabled => println!("IME disabled for Window={window_id:?}"),
},
Expand Down
4 changes: 2 additions & 2 deletions src/platform_impl/linux/x11/event_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ impl EventProcessor {

// Always update the modifiers when we're not replaying.
if !replay {
self.udpate_mods_from_core_event(window_id, xev.state as u16, &mut callback);
self.update_mods_from_core_event(window_id, xev.state as u16, &mut callback);
}

if keycode != 0 && !self.is_composing {
Expand Down Expand Up @@ -1778,7 +1778,7 @@ impl EventProcessor {
self.send_modifiers(window_id, mods.into(), true, &mut callback)
}

pub fn udpate_mods_from_core_event<T: 'static, F>(
pub fn update_mods_from_core_event<T: 'static, F>(
&mut self,
window_id: crate::window::WindowId,
state: u16,
Expand Down
8 changes: 4 additions & 4 deletions src/platform_impl/linux/x11/util/xmodmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const NUM_MODS: usize = 8;
#[derive(Debug, Default)]
pub struct ModifierKeymap {
// Maps keycodes to modifiers
modifers: HashSet<XKeyCode>,
modifiers: HashSet<XKeyCode>,
}

impl ModifierKeymap {
Expand All @@ -25,7 +25,7 @@ impl ModifierKeymap {
}

pub fn is_modifier(&self, keycode: XKeyCode) -> bool {
self.modifers.contains(&keycode)
self.modifiers.contains(&keycode)
}

pub fn reload_from_x_connection(&mut self, xconn: &super::XConnection) {
Expand All @@ -48,9 +48,9 @@ impl ModifierKeymap {
let keys = unsafe {
slice::from_raw_parts(keymap.modifiermap as *const _, keys_per_mod * NUM_MODS)
};
self.modifers.clear();
self.modifiers.clear();
for key in keys {
self.modifers.insert(*key);
self.modifiers.insert(*key);
}
}
}
2 changes: 1 addition & 1 deletion src/platform_impl/linux/x11/xdisplay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl XConnection {

// Get PropertyNotify events from the XSETTINGS window.
// TODO: The XSETTINGS window here can change. In the future, listen for DestroyNotify on this window
// in order to accomodate for a changed window here.
// in order to accommodate for a changed window here.
let selector_window = xcb
.get_selection_owner(xsettings_screen)
.ok()?
Expand Down
6 changes: 3 additions & 3 deletions src/platform_impl/windows/ime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ impl ImeContext {
let mut boundary_before_char = 0;

for (attr, chr) in attrs.into_iter().zip(text.chars()) {
let char_is_targetted =
let char_is_targeted =
attr as u32 == ATTR_TARGET_CONVERTED || attr as u32 == ATTR_TARGET_NOTCONVERTED;

if first.is_none() && char_is_targetted {
if first.is_none() && char_is_targeted {
first = Some(boundary_before_char);
} else if first.is_some() && last.is_none() && !char_is_targetted {
} else if first.is_some() && last.is_none() && !char_is_targeted {
last = Some(boundary_before_char);
}

Expand Down
6 changes: 6 additions & 0 deletions typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# documentation: https://github.com/crate-ci/typos/blob/master/docs/reference.md

[default.extend-identifiers]
ptd = "ptd" # From winwows_sys::Win32::System::Com::FORMATETC { ptd, ..}
requestor = "requestor" # From x11_dl::xlib::XSelectionEvent { requestor ..}
XF86_Calculater = "XF86_Calculater" # From xkbcommon_dl::keysyms::XF86_Calculater

0 comments on commit 6b4c99e

Please sign in to comment.