When running bemenu like:
env BEMENU_OPTS="--list 3" bemenu
Valgrind will report an out-of-bounds read:
Invalid read of size 1
at 0x10BC91: do_getopt.part.0 (common.c:366)
by 0x10C635: do_getopt (common.c:340)
by 0x10C635: parse_args (common.c:556)
by 0x10B535: main (bemenu.c:55)
Address 0x4ac13e2 is 0 bytes after a block of size 2 alloc'd
at 0x4849BF3: calloc (vg_replace_malloc.c:1675)
by 0x10C533: cstrcopy (common.c:120)
by 0x10C533: tokenize_quoted_to_argv (common.c:146)
by 0x10C60C: parse_args (common.c:555)
by 0x10B535: main (bemenu.c:55)
The problem is that the parsing code for `--list` will blindly compare
a character past the number of lines to parse for e.g. `--list '3 up'`
but the end of the string may come right after the number of lines.
In my system Valgrind does not find the error when running bemenu like
`bemenu --list 3` even though the logic is equally questionable.
Fix it by checking that there is more after the number of lines.
Fix many issues with styling related to bemenu and the upwards list
mode. In addition to this, fix/modify some behavior to improve
this(ex: border_size and border_radius are now a double).
Add flag and behavior for a forced single-instance mode.
Add XDG runtime directory possible selection and remove errx
Remove usage of errx and errno in the code, add the ability to select the XDG
runtime directory instead of /tmp for the bemenu lock file.
Add parameters to the password flag, add an option in this flag to
enable indicator mode(display asterisks instead of hiding or
displaying the filter text).
Man page and help flag fix
Add password flag details to the man page, fix the help flag slightly
for better password flag details.
Follow up to 0a44fb65cdc052aeb53ee05ede05ac77ad2d2a0d
Which didn't actually result in the intended behavior of skipping all
menu interaction when `accept-single` is true and the initial filter
results in a single item.
This has the side effect that `ifne` now evaluates on the filtered items
as well.
Signed-off-by: Robert Günzler <r@gnzler.io>
Sometimes you don't want the pointer/touch/keyboard to have any
influence on the menu (e.g. if you mainly use the keyboard, you don't
want the mouse to select an item by accident).
closes #299
If an unexpected error was returned from a Wayland API during rendering (e.g.
from wl_display_flush), the code did set input.sym = XKB_KEY_Escape, so that
the next call to poll_key would return BM_KEY_ESCAPE and bemenu would quit.
However, this has been broken since #135, because input.key_pending was not
set, so the "fake" XKB_KEY_Escape is just ignored, bemenu doesn't quit, but
instead, it enters an infinite loop and keeps a CPU core at 100% usage.
The "quick fix" would be to just set input.key_pending wherever input.sym was
set to XKB_KEY_Escape. However, to make error handling less error-prone,
decouple it from input handling and add an error flag to (bm_menu_)render.
It works on Wayland and X11 and acts as a complement to margin. Exact
behavior is as follows:
- If width factor is 0, width minus margin is used.
- If width multiplied by factor is greater than width minus margin,
width minus is used. (so margin may be used to make sure that bemenu
is at least N pixels away from the view border)
- Otherwise width multiplied by factor is used.
I think it's fine to disable warnings about floating point numbers
comparision. We don't do any arithmetics on them anyway, so we can't
suffer from inaccuracy.
This adds an alias 'focused' for selecting the current monitor, which
becomes the default on x11 and wayland. The previous wayland default of
displaying on all outputs moves under '-2' or 'all'.
ref: https://github.com/Cloudef/bemenu/issues/102#issuecomment-604562234
Signed-off-by: Robert Günzler <r@gnzler.io>