Commit Graph

17 Commits

Author SHA1 Message Date
Sören Tempel
1475c3ce45 client: improve stripping of getline(3) newline
The previous version of this code operated under the assumption that
getline(3) lines are always \n\0 terminated. Unfortunately, this is not
the case as readline will return input which is not terminated with a
newline character if EOF is reached before encountering this newline. In
these cases, the code would falsely strip the last character. As an
example, consider the following bemenu invocation:

	printf foo | ./bemenu

This would start bemenu with `fo` instead of `foo` as a menu item. This
commit fixes this edge case and also hardens the loop body a bit by only
entering it if getline wrote more than zero characters to the buffer.
2021-04-04 19:03:52 +09:00
Sören Tempel
38395e92c7 client: use getline(3)
Not sure why the code didn't use this function previously, but
getline(3) is mandatory since POSIX.1-2008 and should thus be supported
by all maintstream operating systems. The proposed changes make the code
easier to read and should also make it more efficient memory-wise as it
does not necessarily cause the entire input to be copied into memory at
once.
2021-04-04 17:45:04 +09:00
Dominic Monroe
64c38dde50 Add custom key support 2020-08-28 21:01:22 +09:00
Jari Vetoniemi
467ac971d1 bemenu: reuse the calculated buffer end
Also assert that we don't overflow on realloc
2020-02-11 10:23:33 +02:00
Jari Vetoniemi
a89799a6b5 bemenu: fix null termination of input 2020-02-11 10:19:57 +02:00
Jari Vetoniemi
56231f8119 bemenu-run: add --fork option
Make terminal backends not fork by default.
Use this option to fork again on curses.
For non terminal backends this option is no-op.
2020-02-08 13:21:36 +02:00
Jari Vetoniemi
5a4d364d50 Nuke CMake from existance
Welcome glorious GNU Makefile
2020-02-07 16:03:08 +02:00
Jari Vetoniemi
944989c094 bemenu: Remove unneccessary initializers 2017-02-14 21:52:28 +02:00
Jari Vetoniemi
8cfa530b89 bemenu: Reuse code more 2017-02-14 21:51:02 +02:00
Jari Vetoniemi
7b8b38bc21 bemenu: Do not eat newlines 2017-02-14 19:20:44 +02:00
Jari Vetoniemi
9c541d0b42 Add --scrollbar option 2015-01-18 01:08:10 +02:00
Jari Vetoniemi
6b5b93239e Use bools instead of ints 2015-01-18 00:59:11 +02:00
Jari Vetoniemi
4dc5c77d82 Fix argument constants and references to --backend option 2015-01-17 19:05:39 +02:00
Jari Vetoniemi
074b2d1b58 Remove --backend and --prioritory options, change prioritory -> priorty
and provide BEMENU_BACKEND env variable. Change API to reflect this
change.

There is no reliable way to detect when running on terminal (especially
when stdin is a pipe), so we need to make curses backend explicit with
BEMENU_BACKEND=curses or bm_menu_new("curses"), otherwise GUI backend
will be choosed automatically.
2015-01-17 18:53:29 +02:00
Jari Vetoniemi
6ac8d8c4d8 Change font functions to function on pango style font descriptions instead of size
and name.
2015-01-17 15:25:50 +02:00
Jari Vetoniemi
a44b001e82 Mkae highlighted item prefix configurable. 2014-10-26 15:42:09 +02:00
Jari Vetoniemi
9f13ca2e6d Share client code, add bemenu-run 2014-10-25 20:43:52 +03:00