Skip to content

Commit

Permalink
fix: Reset new word when entering the slash character
Browse files Browse the repository at this point in the history
  • Loading branch information
huytd committed Nov 21, 2023
1 parent 7953e2e commit 9960461
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description = "Bộ gõ tiếng Việt mã nguồn mở đa hệ điều hành Gõ Key"
edition = "2021"
name = "goxkey"
version = "0.2.0"
version = "0.2.1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
8 changes: 5 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use platform::{
use ui::{UIDataAdapter, UPDATE_UI};

static UI_EVENT_SINK: OnceCell<ExtEventSink> = OnceCell::new();
const APP_VERSION: &str = env!("CARGO_PKG_VERSION");

fn do_transform_keys(handle: Handle, is_delete: bool) -> bool {
unsafe {
Expand Down Expand Up @@ -140,7 +141,7 @@ fn event_handler(handle: Handle, pressed_key: Option<PressedKey>, modifiers: Key
INPUT_STATE.pop();
}
c => {
if "()[]{}<>/\\!@#$%^&*-_=+|~`,.;'\"".contains(c)
if "()[]{}<>/\\!@#$%^&*-_=+|~`,.;'\"/".contains(c)
|| (c.is_numeric() && modifiers.is_shift())
{
// If special characters detected, dismiss the current tracking word
Expand Down Expand Up @@ -200,11 +201,12 @@ fn event_handler(handle: Handle, pressed_key: Option<PressedKey>, modifiers: Key
}

fn main() {
let app_title = format!("gõkey v{APP_VERSION}");
env_logger::init();
if !ensure_accessibility_permission() {
// Show the Accessibility Permission Request screen
let win = WindowDesc::new(ui::permission_request_ui_builder())
.title("gõkey")
.title(app_title)
.window_size((500.0, 360.0))
.resizable(false);
let app = AppLauncher::with_window(win);
Expand All @@ -213,7 +215,7 @@ fn main() {
// Start the GõKey application
rebuild_keyboard_layout_map();
let win = WindowDesc::new(ui::main_ui_builder())
.title("gõkey")
.title(app_title)
.window_size((ui::WINDOW_WIDTH, ui::WINDOW_HEIGHT))
.set_position(ui::center_window_position())
.set_always_on_top(true)
Expand Down
1 change: 1 addition & 0 deletions src/platform/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ fn get_char(keycode: CGKeyCode) -> Option<PressedKey> {
43 => Some(PressedKey::Char(key_map[&','])),
24 => Some(PressedKey::Char(key_map[&'='])),
42 => Some(PressedKey::Char(key_map[&'\\'])),
44 => Some(PressedKey::Char(key_map[&'/'])),
36 | 52 => Some(PressedKey::Char(KEY_ENTER)), // ENTER
49 => Some(PressedKey::Char(KEY_SPACE)), // SPACE
48 => Some(PressedKey::Char(KEY_TAB)), // TAB
Expand Down

0 comments on commit 9960461

Please sign in to comment.