mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 09:09:03 -04:00
add ncinput_nomod_p()
This commit is contained in:
parent
08e6fefb25
commit
6969652031
4
NEWS.md
4
NEWS.md
@ -1,6 +1,10 @@
|
||||
This document attempts to list user-visible changes and any major internal
|
||||
rearrangements of Notcurses.
|
||||
|
||||
* 2.3.2 (not yet released)
|
||||
* `ncinput_nomod_p()` has been added. This function returns `true` if and
|
||||
only if its `ncinput` argument has no modifiers active.
|
||||
|
||||
* 2.3.1 (2021-05-18)
|
||||
* Sprixels no longer interact with their associated plane's framebuffer. This
|
||||
means plane contents are maintainted across blitting a sprixel and then
|
||||
|
5
USAGE.md
5
USAGE.md
@ -655,6 +655,11 @@ notcurses_getc_blocking(struct notcurses* n, ncinput* ni){
|
||||
sigemptyset(&sigmask);
|
||||
return notcurses_getc(n, NULL, &sigmask, ni);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
ncinput_nomod_p(const ncinput* ni){
|
||||
return !ni->alt && !ni->ctrl && !ni->shift;
|
||||
}
|
||||
```
|
||||
|
||||
By default, certain keys are mapped to signals by the terminal's line
|
||||
|
@ -27,6 +27,8 @@ typedef struct ncinput {
|
||||
|
||||
**bool nckey_mouse_p(char32_t ***r***);**
|
||||
|
||||
**bool ncinput_nomod_p(const ncinput* ***ni***);**
|
||||
|
||||
**char32_t notcurses_getc(struct notcurses* ***n***, const struct timespec* ***ts***, const sigset_t* ***sigmask***, ncinput* ***ni***);**
|
||||
|
||||
**char32_t notcurses_getc_nblock(struct notcurses* ***n***, ncinput* ***ni***);**
|
||||
|
@ -1055,6 +1055,11 @@ notcurses_getc_blocking(struct notcurses* n, ncinput* ni){
|
||||
return notcurses_getc(n, NULL, &sigmask, ni);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
ncinput_nomod_p(const ncinput* ni){
|
||||
return !ni->alt && !ni->ctrl && !ni->shift;
|
||||
}
|
||||
|
||||
// Enable the mouse in "button-event tracking" mode with focus detection and
|
||||
// UTF8-style extended coordinates. On failure, -1 is returned. On success, 0
|
||||
// is returned, and mouse events will be published to notcurses_getc().
|
||||
|
@ -399,9 +399,8 @@ tree_ui(struct notcurses* nc, struct nctree* tree){
|
||||
if(notcurses_render(nc)){
|
||||
return -1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(ni.id == 'q'){
|
||||
}else if(ni.id == '/' && ncinput_nomod_p(&ni)){
|
||||
}else if(ni.id == 'q' && ncinput_nomod_p(&ni)){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user