* [PATCH] correct: add support for colemak layout
@ 2023-03-09 17:43 Nikita Romanyuk
2023-03-10 3:37 ` Mikael Magnusson
0 siblings, 1 reply; 8+ messages in thread
From: Nikita Romanyuk @ 2023-03-09 17:43 UTC (permalink / raw)
To: zsh-workers; +Cc: Nikita Romanyuk
Colemak is a modern alternative to the QWERTY and Dvorak layouts,
designed for efficient and ergonomic touch typing in English.
Signed-off-by: Nikita Romanyuk <ufh8945@gmail.com>
---
Doc/Zsh/options.yo | 8 ++++++++
Src/options.c | 1 +
Src/utils.c | 14 ++++++++++++++
Src/zsh.h | 3 ++-
4 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 443676b..cda4b33 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -1235,6 +1235,14 @@ Use the Dvorak keyboard instead of the standard qwerty keyboard as a basis
for examining spelling mistakes for the tt(CORRECT) and tt(CORRECT_ALL)
options and the tt(spell-word) editor command.
)
+pindex(COLEMAK)
+pindex(NO_COLEMAK)
+pindex(NOCOLEMAK)
+item(tt(COLEMAK))(
+Use the Colemak keyboard instead of the standard qwerty keyboard as a basis
+for examining spelling mistakes for the tt(CORRECT) and tt(CORRECT_ALL)
+options and the tt(spell-word) editor command.
+)
pindex(FLOW_CONTROL)
pindex(NO_FLOW_CONTROL)
pindex(FLOWCONTROL)
diff --git a/Src/options.c b/Src/options.c
index a1fe918..8f9fe85 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -280,6 +280,7 @@ static struct optname optns[] = {
{{NULL, "stdin", OPT_ALIAS}, /* ksh */ SHINSTDIN},
{{NULL, "trackall", OPT_ALIAS}, /* ksh */ HASHCMDS},
{{NULL, "dvorak", 0}, DVORAK},
+{{NULL, "colemak", 0}, COLEMAK},
{{NULL, NULL, 0}, 0}
};
diff --git a/Src/utils.c b/Src/utils.c
index 62bd3e6..b3d09d7 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -4607,10 +4607,24 @@ spdist(char *s, char *t, int thresh)
\t\"<>PYFGCRL?+\t\
\tAOEUIDHTNS_\n\t\
\t:QJKXBMWVZ\n\n\t\
+\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
+ const char colemakkeymap[] =
+ "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\
+\t1234567890-=\t\
+\tqwfpgjluy;[]\t\
+\tarstdhneio'\n\t\
+\tzxcvbkm,./\t\t\t\
+\n\n\n\n\n\n\n\n\n\n\n\n\n\n\
+\t!@#$%^&*()_+\t\
+\tQWFPGJLUY:{}\t\
+\tARSTDHNEIO\"\n\t\
+\tZXCVBKM<>?\n\n\t\
\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
const char *keymap;
if ( isset( DVORAK ) )
keymap = dvorakkeymap;
+ else if ( isset( COLEMAK ) )
+ keymap = colemakkeymap;
else
keymap = qwertykeymap;
diff --git a/Src/zsh.h b/Src/zsh.h
index 40f9ea5..93f3c8c 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -2547,7 +2547,8 @@ enum {
XTRACE,
USEZLE,
DVORAK,
- OPT_SIZE
+ OPT_SIZE,
+ COLEMAK
};
/*
--
2.39.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] correct: add support for colemak layout
2023-03-09 17:43 [PATCH] correct: add support for colemak layout Nikita Romanyuk
@ 2023-03-10 3:37 ` Mikael Magnusson
2023-03-10 4:47 ` Nikita Romanyuk
2023-03-10 5:07 ` Bart Schaefer
0 siblings, 2 replies; 8+ messages in thread
From: Mikael Magnusson @ 2023-03-10 3:37 UTC (permalink / raw)
To: Nikita Romanyuk; +Cc: zsh-workers
On 3/9/23, Nikita Romanyuk <ufh8945@gmail.com> wrote:
> Colemak is a modern alternative to the QWERTY and Dvorak layouts,
> designed for efficient and ergonomic touch typing in English.
It would be nice to not introduce another weird tri-state thing here,
eg what should happen when both dvorak and colemak are set, why is
qwerty not a named option, etc. Perhaps it would be nicer to just let
the user set the layout in some special (namespaced?) parameter for
scalability and deprecate the dvorak option. We could have some helper
function in the distribution that sets this parameter for various
known layouts.
> Signed-off-by: Nikita Romanyuk <ufh8945@gmail.com>
> ---
> Doc/Zsh/options.yo | 8 ++++++++
> Src/options.c | 1 +
> Src/utils.c | 14 ++++++++++++++
> Src/zsh.h | 3 ++-
> 4 files changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
> index 443676b..cda4b33 100644
> --- a/Doc/Zsh/options.yo
> +++ b/Doc/Zsh/options.yo
> @@ -1235,6 +1235,14 @@ Use the Dvorak keyboard instead of the standard
> qwerty keyboard as a basis
> for examining spelling mistakes for the tt(CORRECT) and tt(CORRECT_ALL)
> options and the tt(spell-word) editor command.
> )
> +pindex(COLEMAK)
> +pindex(NO_COLEMAK)
> +pindex(NOCOLEMAK)
> +item(tt(COLEMAK))(
> +Use the Colemak keyboard instead of the standard qwerty keyboard as a
> basis
> +for examining spelling mistakes for the tt(CORRECT) and tt(CORRECT_ALL)
> +options and the tt(spell-word) editor command.
> +)
> pindex(FLOW_CONTROL)
> pindex(NO_FLOW_CONTROL)
> pindex(FLOWCONTROL)
> diff --git a/Src/options.c b/Src/options.c
> index a1fe918..8f9fe85 100644
> --- a/Src/options.c
> +++ b/Src/options.c
> @@ -280,6 +280,7 @@ static struct optname optns[] = {
> {{NULL, "stdin", OPT_ALIAS}, /* ksh */ SHINSTDIN},
> {{NULL, "trackall", OPT_ALIAS}, /* ksh */ HASHCMDS},
> {{NULL, "dvorak", 0}, DVORAK},
> +{{NULL, "colemak", 0}, COLEMAK},
> {{NULL, NULL, 0}, 0}
> };
>
> diff --git a/Src/utils.c b/Src/utils.c
> index 62bd3e6..b3d09d7 100644
> --- a/Src/utils.c
> +++ b/Src/utils.c
> @@ -4607,10 +4607,24 @@ spdist(char *s, char *t, int thresh)
> \t\"<>PYFGCRL?+\t\
> \tAOEUIDHTNS_\n\t\
> \t:QJKXBMWVZ\n\n\t\
> +\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
> + const char colemakkeymap[] =
> + "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\
> +\t1234567890-=\t\
> +\tqwfpgjluy;[]\t\
> +\tarstdhneio'\n\t\
> +\tzxcvbkm,./\t\t\t\
> +\n\n\n\n\n\n\n\n\n\n\n\n\n\n\
> +\t!@#$%^&*()_+\t\
> +\tQWFPGJLUY:{}\t\
> +\tARSTDHNEIO\"\n\t\
> +\tZXCVBKM<>?\n\n\t\
> \n\n\n\n\n\n\n\n\n\n\n\n\n\n";
> const char *keymap;
> if ( isset( DVORAK ) )
> keymap = dvorakkeymap;
> + else if ( isset( COLEMAK ) )
> + keymap = colemakkeymap;
> else
> keymap = qwertykeymap;
>
> diff --git a/Src/zsh.h b/Src/zsh.h
> index 40f9ea5..93f3c8c 100644
> --- a/Src/zsh.h
> +++ b/Src/zsh.h
> @@ -2547,7 +2547,8 @@ enum {
> XTRACE,
> USEZLE,
> DVORAK,
> - OPT_SIZE
> + OPT_SIZE,
> + COLEMAK
OPT_SIZE should always go last in this list.
> };
>
> /*
> --
> 2.39.2
>
>
>
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] correct: add support for colemak layout
2023-03-10 3:37 ` Mikael Magnusson
@ 2023-03-10 4:47 ` Nikita Romanyuk
2023-03-10 5:13 ` Bart Schaefer
2023-03-10 5:07 ` Bart Schaefer
1 sibling, 1 reply; 8+ messages in thread
From: Nikita Romanyuk @ 2023-03-10 4:47 UTC (permalink / raw)
To: Mikael Magnusson; +Cc: zsh-workers
If I understood correctly, we shouldn't use setopt for changing keyboard
layouts because it's not expandable. Better, there should be a separate
builtin function. How should it be called? "setlayout"? "setkblayout"?
Thanks, I didn't put any brain activity into this enum.
> OPT_SIZE should always go last in this list.
I'm going to send another patch later, but with these options as builtins.
On 3/10/23 06:37, Mikael Magnusson wrote:
> On 3/9/23, Nikita Romanyuk <ufh8945@gmail.com> wrote:
>> Colemak is a modern alternative to the QWERTY and Dvorak layouts,
>> designed for efficient and ergonomic touch typing in English.
> It would be nice to not introduce another weird tri-state thing here,
> eg what should happen when both dvorak and colemak are set, why is
> qwerty not a named option, etc. Perhaps it would be nicer to just let
> the user set the layout in some special (namespaced?) parameter for
> scalability and deprecate the dvorak option. We could have some helper
> function in the distribution that sets this parameter for various
> known layouts.
>
>> Signed-off-by: Nikita Romanyuk <ufh8945@gmail.com>
>> ---
>> Doc/Zsh/options.yo | 8 ++++++++
>> Src/options.c | 1 +
>> Src/utils.c | 14 ++++++++++++++
>> Src/zsh.h | 3 ++-
>> 4 files changed, 25 insertions(+), 1 deletion(-)
>>
>> diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
>> index 443676b..cda4b33 100644
>> --- a/Doc/Zsh/options.yo
>> +++ b/Doc/Zsh/options.yo
>> @@ -1235,6 +1235,14 @@ Use the Dvorak keyboard instead of the standard
>> qwerty keyboard as a basis
>> for examining spelling mistakes for the tt(CORRECT) and tt(CORRECT_ALL)
>> options and the tt(spell-word) editor command.
>> )
>> +pindex(COLEMAK)
>> +pindex(NO_COLEMAK)
>> +pindex(NOCOLEMAK)
>> +item(tt(COLEMAK))(
>> +Use the Colemak keyboard instead of the standard qwerty keyboard as a
>> basis
>> +for examining spelling mistakes for the tt(CORRECT) and tt(CORRECT_ALL)
>> +options and the tt(spell-word) editor command.
>> +)
>> pindex(FLOW_CONTROL)
>> pindex(NO_FLOW_CONTROL)
>> pindex(FLOWCONTROL)
>> diff --git a/Src/options.c b/Src/options.c
>> index a1fe918..8f9fe85 100644
>> --- a/Src/options.c
>> +++ b/Src/options.c
>> @@ -280,6 +280,7 @@ static struct optname optns[] = {
>> {{NULL, "stdin", OPT_ALIAS}, /* ksh */ SHINSTDIN},
>> {{NULL, "trackall", OPT_ALIAS}, /* ksh */ HASHCMDS},
>> {{NULL, "dvorak", 0}, DVORAK},
>> +{{NULL, "colemak", 0}, COLEMAK},
>> {{NULL, NULL, 0}, 0}
>> };
>>
>> diff --git a/Src/utils.c b/Src/utils.c
>> index 62bd3e6..b3d09d7 100644
>> --- a/Src/utils.c
>> +++ b/Src/utils.c
>> @@ -4607,10 +4607,24 @@ spdist(char *s, char *t, int thresh)
>> \t\"<>PYFGCRL?+\t\
>> \tAOEUIDHTNS_\n\t\
>> \t:QJKXBMWVZ\n\n\t\
>> +\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
>> + const char colemakkeymap[] =
>> + "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\
>> +\t1234567890-=\t\
>> +\tqwfpgjluy;[]\t\
>> +\tarstdhneio'\n\t\
>> +\tzxcvbkm,./\t\t\t\
>> +\n\n\n\n\n\n\n\n\n\n\n\n\n\n\
>> +\t!@#$%^&*()_+\t\
>> +\tQWFPGJLUY:{}\t\
>> +\tARSTDHNEIO\"\n\t\
>> +\tZXCVBKM<>?\n\n\t\
>> \n\n\n\n\n\n\n\n\n\n\n\n\n\n";
>> const char *keymap;
>> if ( isset( DVORAK ) )
>> keymap = dvorakkeymap;
>> + else if ( isset( COLEMAK ) )
>> + keymap = colemakkeymap;
>> else
>> keymap = qwertykeymap;
>>
>> diff --git a/Src/zsh.h b/Src/zsh.h
>> index 40f9ea5..93f3c8c 100644
>> --- a/Src/zsh.h
>> +++ b/Src/zsh.h
>> @@ -2547,7 +2547,8 @@ enum {
>> XTRACE,
>> USEZLE,
>> DVORAK,
>> - OPT_SIZE
>> + OPT_SIZE,
>> + COLEMAK
> OPT_SIZE should always go last in this list.
>
>> };
>>
>> /*
>> --
>> 2.39.2
>>
>>
>>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] correct: add support for colemak layout
2023-03-10 3:37 ` Mikael Magnusson
2023-03-10 4:47 ` Nikita Romanyuk
@ 2023-03-10 5:07 ` Bart Schaefer
1 sibling, 0 replies; 8+ messages in thread
From: Bart Schaefer @ 2023-03-10 5:07 UTC (permalink / raw)
To: Mikael Magnusson; +Cc: Nikita Romanyuk, zsh-workers
On Thu, Mar 9, 2023 at 7:38 PM Mikael Magnusson <mikachu@gmail.com> wrote:
>
> It would be nice to not introduce another weird tri-state thing here
> [...] Perhaps it would be nicer to just let
> the user set the layout in some special (namespaced?) parameter
Yes, I was just thinking the same thing. Since the keyboard layout
is expressed as a string rather than a 2d array, there's no special
complication with assigning it to a parameter, the format just needs
documenting. 14 newlines, then four runs of 12 "keys" each with tabs
at each end, then a run of 14 newlines, then four more runs for the
shifted keys, and finally 14 newlines?
If we namespace it (a reasonable idea) we'll need to start documenting
reserved namespaces. Oliver has already suggested a "zle" namespace.
Thanks, BTW, for mentioning OPT_SIZE placement.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] correct: add support for colemak layout
2023-03-10 4:47 ` Nikita Romanyuk
@ 2023-03-10 5:13 ` Bart Schaefer
2023-03-10 5:18 ` Kelvium
0 siblings, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2023-03-10 5:13 UTC (permalink / raw)
To: Nikita Romanyuk; +Cc: Mikael Magnusson, zsh-workers
On Thu, Mar 9, 2023 at 8:48 PM Nikita Romanyuk <ufh8945@gmail.com> wrote:
>
> If I understood correctly, we shouldn't use setopt for changing keyboard
> layouts because it's not expandable. Better, there should be a separate
> builtin function. How should it be called? "setlayout"? "setkblayout"?
No, you have misunderstood. We're suggesting something like
.zle.layout=$'\n\n\n\n\n\n\n\n\n\n\n\n\n\n etc etc'
and then the spdist function would read the value of that variable.
No new options, no new builtins.
A shell function file similar to (for an example)
Functions/Misc/colors would provide a set of layouts that could be
assigned to the variable.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] correct: add support for colemak layout
2023-03-10 5:13 ` Bart Schaefer
@ 2023-03-10 5:18 ` Kelvium
2023-03-11 23:17 ` Bart Schaefer
0 siblings, 1 reply; 8+ messages in thread
From: Kelvium @ 2023-03-10 5:18 UTC (permalink / raw)
To: Bart Schaefer; +Cc: Mikael Magnusson, zsh-workers
[-- Attachment #1: Type: text/plain, Size: 824 bytes --]
Thank you for the clarification.
On Fri, Mar 10, 2023, 08:13 Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Thu, Mar 9, 2023 at 8:48 PM Nikita Romanyuk <ufh8945@gmail.com> wrote:
> >
> > If I understood correctly, we shouldn't use setopt for changing keyboard
> > layouts because it's not expandable. Better, there should be a separate
> > builtin function. How should it be called? "setlayout"? "setkblayout"?
>
> No, you have misunderstood. We're suggesting something like
>
> .zle.layout=$'\n\n\n\n\n\n\n\n\n\n\n\n\n\n etc etc'
>
> and then the spdist function would read the value of that variable.
> No new options, no new builtins.
>
> A shell function file similar to (for an example)
> Functions/Misc/colors would provide a set of layouts that could be
> assigned to the variable.
>
[-- Attachment #2: Type: text/html, Size: 1268 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] correct: add support for colemak layout
2023-03-10 5:18 ` Kelvium
@ 2023-03-11 23:17 ` Bart Schaefer
2023-03-12 6:47 ` Nikita Romanyuk
0 siblings, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2023-03-11 23:17 UTC (permalink / raw)
To: Kelvium; +Cc: Mikael Magnusson, zsh-workers
On Thu, Mar 9, 2023 at 9:19 PM Kelvium <ufh8945@gmail.com> wrote:
>
> Thank you for the clarification.
Could you provide some examples where Colemak produces a guess that
differs from QWERTY ?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] correct: add support for colemak layout
2023-03-11 23:17 ` Bart Schaefer
@ 2023-03-12 6:47 ` Nikita Romanyuk
0 siblings, 0 replies; 8+ messages in thread
From: Nikita Romanyuk @ 2023-03-12 6:47 UTC (permalink / raw)
To: Bart Schaefer; +Cc: Mikael Magnusson, zsh-workers
On 3/12/23 02:17, Bart Schaefer wrote:
>
> Could you provide some examples where Colemak produces a guess that
> differs from QWERTY ?
pastpetch -> fastfetch
cuear, cueas -> clear
mabe -> make
sfay -> sway (with QWERTY it corrects to stat)
tist -> test (with QWERTY it corrects to tset)
sost -> sort (with QWERTY it corrects to ssh)
greg -> grep (with QWERTY it corrects to rev)
evim -> nvim (with QWERTY it corrects to vi)
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-03-12 6:47 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-09 17:43 [PATCH] correct: add support for colemak layout Nikita Romanyuk
2023-03-10 3:37 ` Mikael Magnusson
2023-03-10 4:47 ` Nikita Romanyuk
2023-03-10 5:13 ` Bart Schaefer
2023-03-10 5:18 ` Kelvium
2023-03-11 23:17 ` Bart Schaefer
2023-03-12 6:47 ` Nikita Romanyuk
2023-03-10 5:07 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).