-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Adding Colemak #674
Open
New9c
wants to merge
8
commits into
chewing:master
Choose a base branch
from
New9c:add-colemak
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+86
−1
Open
feat: Adding Colemak #674
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ea45c5b
feat: Add Colemak to README.md
New9c 8a76307
feat: Add Colemak
New9c d6c108a
feat: Fix 'item not found in `KeyboardLayoutCompat`'
New9c 2a03c50
fix: Set Colemak as 16th layout
New9c 7d5a308
fix: Fix and add tests
New9c f58a851
fix: Fix and add tests (again)
New9c 10e319d
Merge branch 'master' into add-colemak
kanru 0f652a6
fix: Fix comma issue
New9c File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,6 +113,7 @@ pub enum KB { | |
ThlPinyin, | ||
Mps2Pinyin, | ||
Carpalx, | ||
Colemak, | ||
ColemakDhAnsi, | ||
ColemakDhOrth, | ||
Workman, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use super::{ | ||
generic_map_keycode, | ||
KeyCode::{self, *}, | ||
KeyEvent, KeyboardLayout, Modifiers, MATRIX_SIZE, | ||
}; | ||
|
||
/// A Colemak keyboard. | ||
#[derive(Debug)] | ||
pub struct Colemak; | ||
|
||
#[rustfmt::skip] | ||
static KEYCODE_INDEX: [KeyCode; MATRIX_SIZE] = [ | ||
Unknown, | ||
N1, N2, N3, N4, N5, N6, N7, N8, N9, N0, Minus, Equal, BSlash, Grave, | ||
Q, W, F, P, G, J, L, U, Y, SColon, LBracket, RBracket, | ||
A, R, S, T, D, H, N, E, I, O, Quote, | ||
Z, X, C, V, B, K, M, Comma, Dot, Slash, Space, | ||
Esc, Enter, Del, Backspace, Tab, Left, Right, Up, Down, Home, End, | ||
PageUp, PageDown, NumLock, | ||
]; | ||
|
||
#[rustfmt::skip] | ||
static UNICODE_MAP: [char; MATRIX_SIZE] = [ | ||
'�', | ||
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\\', '`', | ||
'q', 'w', 'f', 'p', 'g', 'j', 'l', 'u', 'y', ';', '[', ']', | ||
'a', 'r', 's', 't', 'd', 'h', 'n', 'e', 'i', 'o', '\'', | ||
'z', 'x', 'c', 'v', 'b', 'k', 'm', ',', '.', '/', ' ', | ||
'�', '�', '�', '�', '�', '�', '�', '�', '�', '�', | ||
'�', '�', '�', '�', | ||
]; | ||
|
||
#[rustfmt::skip] | ||
static SHIFT_MAP: [char; MATRIX_SIZE] = [ | ||
'�', | ||
'!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '|', '~', | ||
'Q', 'W', 'F', 'P', 'G', 'J', 'L', 'U', 'Y', ':', '{', '}', | ||
'A', 'R', 'S', 'T', 'D', 'H', 'N', 'E', 'I', 'O', '"', | ||
'Z', 'X', 'C', 'V', 'B', 'K', 'M', '<', '>', '?', ' ', | ||
'�', '�', '�', '�', '�', '�', '�', '�', '�', '�', | ||
'�', '�', '�', '�', | ||
]; | ||
|
||
impl KeyboardLayout for Colemak { | ||
fn map_with_mod(&self, keycode: KeyCode, modifiers: Modifiers) -> KeyEvent { | ||
generic_map_keycode(&KEYCODE_INDEX, &UNICODE_MAP, &SHIFT_MAP, keycode, modifiers) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not change the existing number. Let's add Colemak as 16th layout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good 👍
BTW, Workman seems to exist as a layout, so I wonder if it should be on the README's "support phonetic keyboard layout" section