mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 01:29:05 -04:00
[load_ncinput] always capitalize ASCII when Ctrl is used
This commit is contained in:
parent
92bda51996
commit
de02ceed91
@ -207,17 +207,17 @@ In API4, the various **bool** modifier fields will go away, and these statuses
|
|||||||
will be merged into the ***modifiers*** bitmask. You are encouraged to use
|
will be merged into the ***modifiers*** bitmask. You are encouraged to use
|
||||||
**ncinput_shift_p** and friends to future-proof your code.
|
**ncinput_shift_p** and friends to future-proof your code.
|
||||||
|
|
||||||
When support is detected, the Kitty keyboard disambiguation protocol will be
|
|
||||||
requested. This eliminates most of the **BUGS** mentioned below.
|
|
||||||
|
|
||||||
# BUGS
|
# BUGS
|
||||||
|
|
||||||
The Shift key is not indicated in conjunction with typical Unicode text.
|
Notcurses attempts to use the XTMODKEYS and Kitty keyboard disambiguation
|
||||||
If e.g. Shift is used to generate a capital letter 'A', ***id*** will equal 'A',
|
protocols. When supported, they eliminate most of these issues.
|
||||||
and ***shift*** will be **false**. Similarly, when Ctrl is pressed along with a
|
|
||||||
letter, the letter will currently always be reported in its uppercase form.
|
The Shift key is traditionally not indicated in conjunction with typical
|
||||||
E.g., if Shift, Ctrl, and 'a' are all pressed, this is indistinguishable from
|
Unicode text. If e.g. Shift is used to generate a capital letter 'A', ***id***
|
||||||
Ctrl and 'A'.
|
will equal 'A', and ***shift*** will be **false**. Similarly, when Ctrl is
|
||||||
|
pressed along with a letter, the letter will currently always be reported in
|
||||||
|
its uppercase form. E.g., if Shift, Ctrl, and 'a' are all pressed, this is
|
||||||
|
indistinguishable from Ctrl and 'A'.
|
||||||
|
|
||||||
Ctrl pressed along with 'J' or 'M', whether Shift is pressed or not,
|
Ctrl pressed along with 'J' or 'M', whether Shift is pressed or not,
|
||||||
currently registers as **NCKEY_ENTER**. This will likely change in the
|
currently registers as **NCKEY_ENTER**. This will likely change in the
|
||||||
|
19
src/lib/in.c
19
src/lib/in.c
@ -476,16 +476,27 @@ mark_pipe_ready(ipipe pipes[static 2]){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// shove the assembled input |tni| into the input queue (if there's room,
|
// shove the assembled input |tni| into the input queue (if there's room, and
|
||||||
// and we're not draining, and we haven't hit EOF). send any synthesized
|
// we're not draining, and we haven't hit EOF). send any synthesized signal as
|
||||||
// signal as the last thing we do.
|
// the last thing we do. if Ctrl is among the modifiers, we replace any
|
||||||
|
// lowercase letter with its uppercase form, to maintain compatibility with
|
||||||
|
// other input methods.
|
||||||
static void
|
static void
|
||||||
load_ncinput(inputctx* ictx, const ncinput *tni, int synthsig){
|
load_ncinput(inputctx* ictx, ncinput *tni, int synthsig){
|
||||||
inc_input_events(ictx);
|
inc_input_events(ictx);
|
||||||
if(ictx->drain || ictx->stdineof){
|
if(ictx->drain || ictx->stdineof){
|
||||||
send_synth_signal(synthsig);
|
send_synth_signal(synthsig);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(tni->modifiers & NCKEY_MOD_CTRL){
|
||||||
|
// when ctrl is used with an ASCII (0..127) lowercase letter, we always
|
||||||
|
// supply the capitalized form, to maintain compatibility among solutions
|
||||||
|
if(tni->id < 0x7f){
|
||||||
|
if(islower(tni->id)){
|
||||||
|
tni->id = toupper(tni->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
pthread_mutex_lock(&ictx->ilock);
|
pthread_mutex_lock(&ictx->ilock);
|
||||||
if(ictx->ivalid == ictx->isize){
|
if(ictx->ivalid == ictx->isize){
|
||||||
pthread_mutex_unlock(&ictx->ilock);
|
pthread_mutex_unlock(&ictx->ilock);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user