mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -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
|
||||
**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
|
||||
|
||||
The Shift key is not indicated in conjunction with typical Unicode text.
|
||||
If e.g. Shift is used to generate a capital letter 'A', ***id*** 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'.
|
||||
Notcurses attempts to use the XTMODKEYS and Kitty keyboard disambiguation
|
||||
protocols. When supported, they eliminate most of these issues.
|
||||
|
||||
The Shift key is traditionally not indicated in conjunction with typical
|
||||
Unicode text. If e.g. Shift is used to generate a capital letter 'A', ***id***
|
||||
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,
|
||||
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,
|
||||
// and we're not draining, and we haven't hit EOF). send any synthesized
|
||||
// signal as the last thing we do.
|
||||
// shove the assembled input |tni| into the input queue (if there's room, and
|
||||
// we're not draining, and we haven't hit EOF). send any synthesized signal as
|
||||
// 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
|
||||
load_ncinput(inputctx* ictx, const ncinput *tni, int synthsig){
|
||||
load_ncinput(inputctx* ictx, ncinput *tni, int synthsig){
|
||||
inc_input_events(ictx);
|
||||
if(ictx->drain || ictx->stdineof){
|
||||
send_synth_signal(synthsig);
|
||||
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);
|
||||
if(ictx->ivalid == ictx->isize){
|
||||
pthread_mutex_unlock(&ictx->ilock);
|
||||
|
Loading…
x
Reference in New Issue
Block a user