From feab1261c8dd44202d0b9bd1664afdeefd71afd9 Mon Sep 17 00:00:00 2001 From: Cherry <13651622+MolotovCherry@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:33:19 -0700 Subject: [PATCH] Fix some typos (#16623) This PR fixes some typos I found in the source code. Release Notes: - N/A --- .../gpui/src/platform/windows/direct_write.rs | 2 +- crates/gpui/src/platform/windows/events.rs | 6 ++--- crates/gpui/src/platform/windows/window.rs | 26 +++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/crates/gpui/src/platform/windows/direct_write.rs b/crates/gpui/src/platform/windows/direct_write.rs index 6155f2edeccbe3..afceca2ffa89c4 100644 --- a/crates/gpui/src/platform/windows/direct_write.rs +++ b/crates/gpui/src/platform/windows/direct_write.rs @@ -301,7 +301,7 @@ impl DirectWriteState { continue; }; if fonts.GetFontCount() == 0 { - log::error!("No mathcing font find for {}", family_name); + log::error!("No matching font found for {}", family_name); continue; } let font = fonts.GetFontFaceReference(0)?.CreateFontFace()?; diff --git a/crates/gpui/src/platform/windows/events.rs b/crates/gpui/src/platform/windows/events.rs index 986928ddea2025..c831b89dffb5b2 100644 --- a/crates/gpui/src/platform/windows/events.rs +++ b/crates/gpui/src/platform/windows/events.rs @@ -758,7 +758,7 @@ fn handle_dpi_changed_msg( let new_dpi = wparam.loword() as f32; let mut lock = state_ptr.state.borrow_mut(); lock.scale_factor = new_dpi / USER_DEFAULT_SCREEN_DPI as f32; - lock.border_offset.udpate(handle).log_err(); + lock.border_offset.update(handle).log_err(); drop(lock); let rect = unsafe { &*(lparam.0 as *const RECT) }; @@ -796,7 +796,7 @@ fn handle_dpi_changed_msg( fn handle_display_change_msg(handle: HWND, state_ptr: Rc) -> Option { // NOTE: // Even the `lParam` holds the resolution of the screen, we just ignore it. - // Because WM_DPICHANGED, WM_MOVE, WM_SIEZ will come first, window reposition and resize + // Because WM_DPICHANGED, WM_MOVE, WM_SIZE will come first, window reposition and resize // are handled there. // So we only care about if monitor is disconnected. let previous_monitor = state_ptr.as_ref().state.borrow().display; @@ -1087,7 +1087,7 @@ fn handle_system_settings_changed( // mouse double click lock.click_state.system_update(); // window border offset - lock.border_offset.udpate(handle).log_err(); + lock.border_offset.update(handle).log_err(); Some(0) } diff --git a/crates/gpui/src/platform/windows/window.rs b/crates/gpui/src/platform/windows/window.rs index 5d1ba28db97304..943687f8a1949d 100644 --- a/crates/gpui/src/platform/windows/window.rs +++ b/crates/gpui/src/platform/windows/window.rs @@ -166,7 +166,7 @@ impl WindowsWindowState { /// get the logical size of the app's drawable area. /// - /// Currently, GPUI uses logical size of the app to handle mouse interactions (such as + /// Currently, GPUI uses the logical size of the app to handle mouse interactions (such as /// whether the mouse collides with other elements of GPUI). fn content_size(&self) -> Size { self.logical_size @@ -187,13 +187,13 @@ impl WindowsWindowState { } fn title_bar_height(&self) -> Pixels { - // todo(windows) this is hard set to match the ui title bar + // todo(windows) this is hardcoded to match the ui title bar // in the future the ui title bar component will report the size px(32.) + self.title_bar_top_offset() } pub(crate) fn caption_button_width(&self) -> Pixels { - // todo(windows) this is hard set to match the ui title bar + // todo(windows) this is hardcoded to match the ui title bar // in the future the ui title bar component will report the size px(36.) } @@ -343,8 +343,8 @@ impl WindowsWindow { }; let mut lock = state_ptr.state.borrow_mut(); let bounds = bounds.to_device_pixels(lock.scale_factor); - lock.border_offset.udpate(raw_hwnd)?; - placement.rcNormalPosition = calcualte_window_rect(bounds, lock.border_offset); + lock.border_offset.update(raw_hwnd)?; + placement.rcNormalPosition = calculate_window_rect(bounds, lock.border_offset); drop(lock); SetWindowPlacement(raw_hwnd, &placement)?; } @@ -404,7 +404,7 @@ impl PlatformWindow for WindowsWindow { /// get the logical size of the app's drawable area. /// - /// Currently, GPUI uses logical size of the app to handle mouse interactions (such as + /// Currently, GPUI uses the logical size of the app to handle mouse interactions (such as /// whether the mouse collides with other elements of GPUI). fn content_size(&self) -> Size { self.0.state.borrow().content_size() @@ -897,7 +897,7 @@ pub(crate) struct WindowBorderOffset { } impl WindowBorderOffset { - pub(crate) fn udpate(&mut self, hwnd: HWND) -> anyhow::Result<()> { + pub(crate) fn update(&mut self, hwnd: HWND) -> anyhow::Result<()> { let window_rect = unsafe { let mut rect = std::mem::zeroed(); GetWindowRect(hwnd, &mut rect)?; @@ -1015,9 +1015,9 @@ fn register_drag_drop(state_ptr: Rc) -> Result<()> { Ok(()) } -fn calcualte_window_rect(bounds: Bounds, border_offset: WindowBorderOffset) -> RECT { +fn calculate_window_rect(bounds: Bounds, border_offset: WindowBorderOffset) -> RECT { // NOTE: - // The reason that not using `AdjustWindowRectEx()` here is + // The reason we're not using `AdjustWindowRectEx()` here is // that the size reported by this function is incorrect. // You can test it, and there are similar discussions online. // See: https://stackoverflow.com/questions/12423584/how-to-set-exact-client-size-for-overlapped-window-winapi @@ -1032,11 +1032,11 @@ fn calcualte_window_rect(bounds: Bounds, border_offset: WindowBord let left_offset = border_offset.width_offset / 2; let top_offset = border_offset.height_offset / 2; let right_offset = border_offset.width_offset - left_offset; - let bottom_offet = border_offset.height_offset - top_offset; + let bottom_offset = border_offset.height_offset - top_offset; rect.left -= left_offset; rect.top -= top_offset; rect.right += right_offset; - rect.bottom += bottom_offet; + rect.bottom += bottom_offset; rect } @@ -1048,11 +1048,11 @@ fn calculate_client_rect( let left_offset = border_offset.width_offset / 2; let top_offset = border_offset.height_offset / 2; let right_offset = border_offset.width_offset - left_offset; - let bottom_offet = border_offset.height_offset - top_offset; + let bottom_offset = border_offset.height_offset - top_offset; let left = rect.left + left_offset; let top = rect.top + top_offset; let right = rect.right - right_offset; - let bottom = rect.bottom - bottom_offet; + let bottom = rect.bottom - bottom_offset; let physical_size = size(DevicePixels(right - left), DevicePixels(bottom - top)); Bounds { origin: logical_point(left as f32, top as f32, scale_factor),