Commit Graph

102 Commits

Author SHA1 Message Date
bakkeby
18466cd149 Bump to fce06f4.
remove workaround for a crash with color emojis on some systems, now fixed in libXft 2.3.5

https://gitlab.freedesktop.org/xorg/lib/libxft/-/blob/libXft-2.3.5/NEWS

Ref.
https://git.suckless.org/dmenu/commit/fce06f437dcec646ee0a2728fe695f3084cc6ccb.html

Consequently the color emoji patch has been inverted into no color emoji, keeping the workaround in the code base for those that are on systems with older versions of the Xft library.
2022-10-06 15:16:27 +02:00
Stein Gunnar Bakkeby
4be3af6f6c
Merge pull request #15 from monosans/patch-01
Remove unused variables from config.mk
2022-09-26 09:13:42 +02:00
monosans
4dfeea35c2
Remove unused variables from config.mk 2022-09-25 22:22:12 +03:00
bakkeby
dc169b1971 Adding separator patch
This patch is simpler than, and superior to, the TSV patch and as
such takes precedence if both are combined.

Also addressed some compatibility issues and compilation errors.
2022-09-05 14:08:27 +02:00
bakkeby
036d2b0d08 Removing the json patch
Reasoning:
   - the patch is old and incompatible and conflicts with so many
     other patches
   - the functionality is rather limited especially considering that
     it is generally possible to convert json data to work with the
     TSV patch or the separator patch
   - the patch is for dmenu 4.9, which means that since February 2009
     nobody has bothered upgrading this patch to 5.0 or 5.1, which
     again implies that not many people actually use or rely on this
     patch

The json patch may be re-introduced into dmenu-flexipatch in the
future, but in that case it would be a bespoke version that is
designed around some of the other patches and takes more liberties
rather than trying to adhere to what is available at
https://tools.suckless.org/dmenu/patches/json/

Example using jq to convert json data to TSV format:

$ cat ~/.bookmarks
{
	"uggah": "buggah",
	"hello": "there",
	"bye": "tomorrow"
}

$ cat ~/.bookmarks | jq -r '. | to_entries | .[] | "\(.key)\t\(.value)"'
uggah	buggah
hello	there
bye	tomorrow
2022-09-05 12:46:15 +02:00
bakkeby
6f9bd28e6b Bump to 1e8c5b6.
tab-complete: figure out the size before copying

we already need to know the string length since `cursor` needs to be
adjusted.

so just calculate the length beforehand and use `memcpy` to copy exactly
as much as needed (as opposed to `strncpy` which always writes `n`
bytes).

+ fix a regression in the previous commit for tab complete

Reported by Santtu Lakkala <inz@inz.fi>, thanks!

Ref.
https://git.suckless.org/dmenu/commit/528d39b011afb7ef6fd794ba6b74155d4e69bc68.html
https://git.suckless.org/dmenu/commit/1e8c5b68f4881bd4ae257c780fd41f129c79f419.html
2022-09-04 23:18:04 +02:00
bakkeby
1bc6ec6fcd Bump to 32db2b.
readstdin: use getline(3)

currently readstdin():
   - fgets() into a local buffer,
   - strchr() the buffer to eleminate the newline
   - stdups() the buffer into items

a simpler way is to just use getline(3), which will do the allocation
for us; eliminating the need for stdup()-ing.

additionally getline returns back the amount of bytes read, which
eliminates the need for strchr()-ing to find the newline.

Ref.
https://git.suckless.org/dmenu/commit/32db2b125190d366be472ccb7cad833248696144.html
2022-09-04 23:13:37 +02:00
bakkeby
6a1ed51d47 Adding fzfexpect patch 2022-09-04 22:33:24 +02:00
bakkeby
ff2f1552b3 Bump to e35976f.
sync code-style patch from libsl

Ref.
https://git.suckless.org/dmenu/commit/e35976f4a50f884c2162f71e4128d7c273e3e042.html
2022-08-08 14:42:54 +02:00
bakkeby
333a738709 Adding barpadding patch 2022-06-21 11:03:19 +02:00
bakkeby
d3b51477fc Adding relative input width patch and bumping to 28fb3e2 2022-06-21 10:22:20 +02:00
bakkeby
59d8327727 Makefile: add manual path for OpenBSD ref. https://git.suckless.org/dmenu/commit/28fb3e28120db29ea45d1951eee7047b4109ab5f.html 2022-06-21 10:19:50 +02:00
bakkeby
5c1be5d667 numbers: update to fix segfault in some conditions
Ref.
https://git.suckless.org/sites/commit/98926264b1507784b5e2af41890e26db0e28c1dd.html
2022-05-17 09:27:32 +02:00
bakkeby
872a3623d0 fuzzyhighlight: correcting sign for deducting lrpad 2022-04-26 23:19:03 +02:00
bakkeby
ae643ff68d fuzzyhighlight: addressing graphical highlight glitch when lrpad is an odd number ref. #12 2022-04-26 23:13:26 +02:00
bakkeby
528481f7a6 Upgrade to 33685b0
drw_text: account for fallback fonts in ellipsis_width

additionally, ellipsis_width (which shouldn't change) is made static to
avoid re-calculating it on each drw_text() call.
2022-04-17 10:08:22 +02:00
bakkeby
4b832e8917 drw_text: don't segfault when called with 0 width
this patch just rejects *any* 0 width draws, which is surely an error by
the caller.

this also guards against cases where the width is too small for the
ellipsis to fit, so ellipsis_w will remain 0.
reported by Bakkeby <bakkeby@gmail.com>

ref. https://git.suckless.org/dmenu/commit/e4827b0c4048718ab06670cf60ef68d028fe7fc4.html
2022-04-17 10:06:08 +02:00
bakkeby
4ceaa81c0d Moving ellipsis text into a variable for clarity 2022-04-17 10:05:43 +02:00
bakkeby
7a26db0c06 Adding reference to map of patches 2022-04-01 21:56:35 +02:00
bakkeby
db9e45a2ad Upgrade to e73651f (2022-03-26) 2022-03-28 11:18:32 +02:00
bakkeby
bcc157796d fix UB with the function iscntrl()
From commit 6818e07291f3b2913e687c8ec3d3fe4711724050 by NRK, thanks

ref. https://git.suckless.org/dmenu/commit/e73651f12a406629778f02d8e5acbe2caec0dfc2.html
2022-03-28 11:16:56 +02:00
bakkeby
a1796e627d free all allocated items, use %zu for size_t
`items` itself is not checked for NULL as calling free on NULL is defined to be
a no-op.

ref. https://git.suckless.org/dmenu/commit/b43ec0577f2ad8ad33a0b893fe5360d966036786.html
2022-03-28 11:15:46 +02:00
bakkeby
bb788aa0de drw_text: improve performance when there's no match
this was the last piece of the puzzle, the case where we can't find any
font to draw the codepoint.

in such cases, we use XftFontMatch() which is INSANELY slow. but that's
not the real problem. the real problem was we were continuously trying
to match the same thing over and over again.

this patch introduces a small cache, which keeps track a couple
codepoints for which we know we won't find any matches.

with this, i can dump lots of emojies into dmenu where some of them
don't have any matching font, and still not have dmenu lag insanely or
FREEZE completely when scrolling up and down.

this also improves startup time, which will of course depend on the
system and all installed fonts; but on my system and test case i see the
following startup time drop:

before -> after
60ms   -> 34ms

ref. https://git.suckless.org/dmenu/commit/22511c41d55a38a770541ae617a09383d5e6ad1c.html
2022-03-28 11:14:10 +02:00
bakkeby
761bc7939f inputw: improve correctness and startup performance
a massive amount of time inside readstdin() is spent trying to get the
max input width and then put it into inputw, only for it to get clamped
down to mw/3 inside setup().

it makes more sense to calculate inputw inside setup() once we have mw
available. similar to the last patch, i see noticeable startup
performance improvement:

before -> after
160ms  -> 60ms

additionally this will take fallback fonts into account compared to the
previous version, so it's not only more performant but also more correct.

ref. https://git.suckless.org/dmenu/commit/77526f756e23e362081ac807521f901f2e5cd5e6.html

Disclaimer: this may break the JSON patch
2022-03-28 11:10:31 +02:00
bakkeby
067aa41ac3 significantly improve performance on large strings
this replaces inefficient pattern of `MIN(TEXTW(..), n)` with
drw_fontset_getwidth_clamp() instead, which is far more efficient when
we only want up to a certain width.

dumping a decently sized (unicode) emoji file into dmenu, I see the
startup time drop significantly with this patch.

before -> after
360ms  -> 160ms

this should also noticeably improve input latency (responsiveness) given
that calcoffsets() and drawmenu() are pretty hot functions.

ref. https://git.suckless.org/dmenu/commit/7269c5355d257dd2ad2c53f15dc9c1cf6796aea5.html
2022-03-28 11:02:11 +02:00
bakkeby
78a3c399ee introduce drw_fontset_getwidth_clamp()
getting the width of a string is an O(n) operation, and in many cases
users only care about getting the width upto a certain number.

instead of calling drw_fontset_getwidth() and *then* clamping the
result, this patch introduces drw_fontset_getwidth_clamp() function,
similar to strnlen(), which will stop once we reach n.

the `invert` parameter was overloaded internally to preserve the API,
however library users should be calling drw_fontset_getwidth_clamp() and
not depend upon internal behavior of drw_text().

ref. https://git.suckless.org/dmenu/commit/6be057f060543bb0f3ed9423904263617cdffffe.html
2022-03-28 10:53:35 +02:00
bakkeby
d7f70ce901 drw_text: improve both performance and correctness
this patch makes some non-trivial changes, which significantly improves
the performance of drawing large strings as well as fixes any issues
regarding the printing of the ellipsis when string gets truncated.

* performance:

before there were two O(n) loops, one which finds how long we can go
without changing font, and the second loop would (incorrectly) truncate
the string if it's too big.

this patch merges the overflow calculation into the first loop and exits
out when overflow is detected. when dumping lots of emojies into dmenu,
i see some noticeable startup time improvement:

before -> after
460ms  -> 360ms

input latency when scrolling up/down is also noticeably better and can
be tested with the following:

	for _ in $(seq 20); do
		cat /dev/urandom | base64 | tr -d '\n' | head -c 1000000
	echo
	done | ./dmenu -l 10

* correctness:

the previous version would incorrectly assumed single byte chars and
would overwrite them with '.' , this caused a whole bunch of obvious
problems, including the ellipsis not getting rendered if then font
changed.

in addition to exiting out when we detect overflow, this patch also
keeps track of the last x-position where the ellipsis would fit. if we
detect overflow, we simply make a recursing call to drw_text() at the
ellipsis_x position and overwrite what was there.

so now the ellipsis will always be printed properly, regardless of
weather the font changes or if the string is single byte char or not.

the idea of rendering the ellipsis on top incase of overflow was
from Bakkeby <bakkeby@gmail.com>, thanks! however the original patch had
some issues incorrectly truncating the prompt (-p flag) and cutting off
emojies. those have been fixed in here.

Ref. https://git.suckless.org/dmenu/commit/41fdabbf7c517f8d524b70cbd78238cc319ccef3.html
2022-03-28 10:31:54 +02:00
bakkeby
40ee9e2b7d highpriority: adding check for malloc failure + cleanup on exit
ref. https://git.suckless.org/sites/commit/9bbc02d13a89e427a046817771c6f8fd332d0167.html
2022-03-27 22:38:32 +02:00
bakkeby
67180f6288 multiselect + printindex compatibility ref. #10 2022-03-24 00:15:15 +01:00
bakkeby
b210a99e31 multiselect + restrict return compatibilty 2022-03-14 11:39:19 +01:00
bakkeby
287e7d6afa fuzzymatch + highpriority + no sort patch compatibilty 2022-03-14 11:35:10 +01:00
bakkeby
d4ba5053ce border patch: adding separate colour scheme for the border (rather than forcing SchemeSel) 2022-03-14 11:26:51 +01:00
bakkeby
de7f10513f fuzzymatch + nosort compatibility 2022-03-14 11:15:44 +01:00
bakkeby
84c91ee18e xresources: removing redundant else statements 2022-03-14 11:12:56 +01:00
bakkeby
daf318abf3 Bump to 5.1 2022-03-02 09:35:23 +01:00
bakkeby
ea2fd892db dynamic options vs fuzzymatch and prefix completion patches fix ref. #8 2022-01-20 13:53:38 +01:00
bakkeby
e3a291ea43 dynamic options vs TSV patch issue ref. #8 2022-01-20 11:12:20 +01:00
bakkeby
452174309f dynamic options vs multi selection patch compatibility issue ref. #8 2022-01-20 11:04:02 +01:00
bakkeby
6dd910f53c border patch: fix for no border on the right hand side 2021-10-20 17:52:57 +02:00
bakkeby
7fd7f72d5d xresources: Questionable solution to allowing command line arguments to take precedence over xresources 2021-10-20 17:41:28 +02:00
bakkeby
328a60e0d3 Addressing prefixcompletion vs fuzzymatch compatibility issue ref. #5 2021-08-24 16:54:57 +02:00
bakkeby
310bfe4e02 Revert "Improve speed of drw_text when provided with large strings"
This reverts commit c585e8e498ec6f9c423ab8ea07cf853ee5b05fbe.

It causes issues with truncation of characters when the text does not fit and
so on.  The patch should be reworked and properly tested.

https://git.suckless.org/dmenu/commit/d78ff08d99780a73447d5a95bf1e358e8c23aa3c.html
2021-08-24 15:06:49 +02:00
bakkeby
fb43216a0e Bumping version to cd2133a 2021-08-16 10:51:05 +02:00
bakkeby
6f8e43ac08 add support for more keypad keys
The keypad Enter key was already supported. On some keyboard layouts like my
laptop the page-up and page-down key is more comfortable to use.
This adds a few lines but no complexity.

Ref. https://git.suckless.org/dmenu/commit/cd2133a5f66b42f992a9a1b92bbbce11dc26b941.html
2021-08-16 10:44:16 +02:00
bakkeby
3516ea6e65 Improve speed of drw_text when provided with large strings
Calculates len & ew in drw_font_getexts loop by incrementing instead of
decrementing; as such avoids proportional increase in time spent in loop
based on provided strings size.

Ref. https://git.suckless.org/dmenu/commit/c585e8e498ec6f9c423ab8ea07cf853ee5b05fbe.html#h0-0-3
2021-08-16 10:40:43 +02:00
bakkeby
bd40208171 remove always true condition in if statement
ref. https://git.suckless.org/dmenu/commit/523aa08f51a88c59ad4b1f600f8ce3d122e9e289.html
2021-08-16 10:39:14 +02:00
bakkeby
3cb4dbdf7a [dmenu][patch][navhistory] Bug fix: Write first entry to history file
- Bug fix: Don't skip writing first entry to history file. This happened for
  `histnodup` = 1 (default) plus `histsz` = 0 (value when starting with an
  empty history).

Ref.
https://git.suckless.org/sites/commit/f759877d393eaed126dfc8e56932c49e7581a181.html
2021-07-26 12:10:44 +02:00
bakkeby
21641d4f3f Updating link to alpha patch 2021-07-26 09:33:24 +02:00
bakkeby
1d200d199b alpha: repurposing the -o option to enable or disable alpha ref. #4 2021-07-25 10:09:38 +02:00
bakkeby
c70b92c85c pango: addressing some lineheight and emoji patch compatibility issues 2021-07-14 10:22:51 +02:00