Commit Graph

144 Commits

Author SHA1 Message Date
Minty Cube
b820f2c1fe
Merge branch 'bakkeby:master' into master 2024-09-21 08:41:55 +00:00
bakkeby
43f0483d5a scroll: compatibility fix wrt upstream utf8decode overhaul changes #33 2024-09-19 09:31:45 +02:00
Saif Shahriar
23cbc819b9
Fix SYMBOLS_PATCH not changing right symbol "<" (#32)
SYMBOLS_PATCH supposed to change "<" and ">". 
Although, it does replaces ">" with a user defined glyph, 
it does not do the same for "<". This commit fixes that.
2024-09-18 21:30:54 +02:00
mintycube
cde29093ca Merge remote-tracking branch 'upstream/master' 2024-07-22 14:23:25 +05:00
mintycube
42dd4a2c08 Add gitattributes
For avoiding merge conflicts in readme.md when syncing forks
2024-07-22 14:21:52 +05:00
mintycube
a5f48fb1d7 Include patches.h for correct syntax highlinghting 2024-07-20 13:25:41 +05:00
bakkeby
ea263d0999 highlight: correct declared utf8len signature 2024-07-18 10:00:53 +02:00
bakkeby
3b547d5263 drw.c: use the same pattern as ellipsis_width to check for infinite recursion
ref.
https://git.suckless.org/dmenu/commit/475d8093cb8d29d5756937bfa9e0b3b9e415f632.html
2024-07-18 09:59:32 +02:00
bakkeby
b980b0a359 render invalid utf8 sequences as U+FFFD
previously drw_text would do the width calculations as if
invalid utf8 sequences were replaced with U+FFFD but would pass
the invalid utf8 sequence to xft to render where xft would just
cut it off at the first invalid byte.

this change makes invalid utf8 render as U+FFFD and avoids
sending invalid sequences to xft. the following can be used to
check the behavior before and after the patch:

	$ printf "0\xef1234567\ntest" | dmenu

Ref: https://lists.suckless.org/dev/2407/35646.html

Ref.
https://git.suckless.org/dmenu/commit/59936c7d972587a47d61161279bb8e8abc0b02f3.html
2024-07-18 09:36:48 +02:00
bakkeby
d66c96ba0b overhaul utf8decode()
this changes the utf8decode function to:

* report when an error occurs
* report how many bytes to advance on error

these will be useful in the next commit to render invalid utf8
sequences.

the new implementation is also shorter and more direct.

ref.
https://git.suckless.org/dmenu/commit/51e32d49b56c86cd288c64fccf6cd765547781b9.html
2024-07-18 09:25:15 +02:00
Stein Gunnar Bakkeby
34b991503c
Adding input method patch (#31)
Adding input method patch ref. PR #22
2024-07-18 09:16:00 +02:00
bakkeby
1c584542f4 caseinsensitive: avoid declaring cistrstr twice 2024-07-17 08:50:07 +02:00
mintycube
b221ccbc21 Applied mouse hover patch 2024-07-17 08:01:32 +05:00
mintycube
d73301dee5 Merge upstream changes 2024-07-17 08:00:17 +05:00
bakkeby
a3a5229059 Aligning variables between exact and fuzzy highlighting 2024-07-16 23:03:10 +02:00
bakkeby
9a1d207eae xresources - fix window embedding ref. PR #19 2024-07-16 22:31:08 +02:00
bakkeby
e74a659468 Refactoring highlight and fuzzyhighlight patches
Follow-up on pull request #16 this change refactors and combines
the highlight and fuzzy highlight patches into one highlight
function.

Overall it does not make any sense using:
   - fuzzy highlighting when exact matching is used or
   - exact highlighting when fuzzy matching is used

As such it makes sense to combine the two such that:
   - exact highlighting is used when exact matching is used and
   - fuzzy highlighting is used when fuzzy matching is used

The FUZZYHIGHLIGHT_PATCH toggle has been removed in favour of
HIGHLIGHT_PATCH. The FUZZYMATCH_PATCH toggle controls whether
fuzzy matching is enabled. Enable both FUZZYMATCH_PATCH and
HIGHLIGHT_PATCH to enable fuzzy highlighting.

Additionally the fuzzy highlight patch only supported single-byte
characters and would break when encountering multi-byte UTF-8
characters. This was reported ref. #24.

This refactoring includes a change to work out the UTF-8 character
length for a given character rather than assuming that every
character uses one byte.
2024-07-16 21:45:01 +02:00
bakkeby
af373aa1cc Addressing some clang warnings 2024-07-16 21:43:57 +02:00
Marco
4a8b71c191 Added patch to highlight an entry when mouse-hovered. 2024-07-16 09:30:50 +02:00
mintycube
2e720dfd25 Update Readme 2024-06-24 14:10:34 +05:00
mintycube
5dbd07ba71 Add my config 2024-06-24 13:33:07 +05:00
bakkeby
d04595790f xyw vs center patch - allow xyw control the width of dmenu when centered ref. #29 2024-06-19 08:37:09 +02:00
bakkeby
9ef1b3c317 pango: passing -fn option could lead to segfault due to writing out of bounds 2024-05-17 21:42:30 +02:00
bakkeby
4f71e5593e pango: add fixes for vertical alignment issues affecting CJK fonts 2024-05-17 15:28:37 +02:00
bakkeby
a686ac9b72 bump version to 5.3
ref.
https://git.suckless.org/dmenu/commit/7be720cc88ed2294338f7182600df10f21c575ce.html
2024-03-20 08:06:09 +01:00
Johnny Mast
0d6d5ac5cc
CENTER_PATCH Fix (#28)
Changed default config for the centered patch to be off by default.
2023-12-13 09:32:30 +01:00
bakkeby
6bd3860e4b scroll + alpha compatibility fix 2023-10-02 20:49:59 +02:00
bakkeby
76549d014e drw: minor improvement to the nomatches cache
1. use `unsigned int` to store the codepoints, this avoids waste on
   common case where `long` is 64bits. and POSIX guarantees `int` to be
   at least 32bits so there's no risk of truncation.
2. since switching to `unsigned int` cuts down the memory requirement by
   half, double the cache size from 64 to 128.
3. instead of a linear search, use a simple hash-table for O(1) lookups.

ref.
https://git.suckless.org/dmenu/commit/7ab0cb5ef0e19352fc5d64ae0d57a5cf4540acbf.html
2023-09-22 18:24:09 +02:00
bakkeby
c5ed9a9f42 Makefile: remove the options target
The Makefile used to suppress output (by using @), so this target made sense at
the time.

But the Makefile should be simple and make debugging with less abstractions or
fancy printing.  The Makefile was made verbose and doesn't hide the build
output, so remove this target.

Prompted by a question on the mailing list about the options target.

ref.
https://git.suckless.org/dwm/commit/9f8855343c881bdc01b9fff5b956537ba1106b76.html
2023-09-22 18:13:28 +02:00
bakkeby
690436ef27 Adding caret patch ref. #23 2023-06-15 09:54:53 +02:00
bakkeby
9e721014cd alpha vs xresources - addressing compatibility issue ref. #4 2023-05-17 00:33:17 +02:00
bakkeby
fc8c1c56c6 Addressing instant vs fuzzymatch compatibility issue ref. #21 2023-04-21 09:52:47 +02:00
bakkeby
0329c28407 highlight: do not highlight items scheduled for output ref. #20
The highlight feature by default overrides other colour schemes and
may in the process partially or fully obscure that an item has already
been output (or is scheduled for output using the multiselect patch).

In this context the highlighting does not add any valuable information
given that the user has already selected the item. Overall it seems
more user-friendly to skip drawing highlights for outputted items.
2023-04-11 09:44:49 +02:00
bakkeby
25ea08edd1 Bump to 0fe460d.
fix BadMatch error when embedding on some windows

When embedded into another window, dmenu will fail with the BadMatch
error if that window have not the same colormap/depth/visual as the
root window.

That happens because dmenu inherits the colormap/depth/visual from
its parent, but draws on a pixmap created based on the root window
using a GC created for the root window (see drw.c).  A BadMatch will
occur when copying the content of the pixmap into dmenu's window.

A solution is to create dmenu's window inside root and then reparent
it if embeded.

See this mail[1] on ports@openbsd.org mailing list for context.

[1]: https://marc.info/?l=openbsd-ports&m=168072150814664&w=2

Ref.
https://git.suckless.org/dmenu/commit/0fe460dbd469a1d5b6a7140d0e1801935e4a923b.html
2023-04-07 14:19:54 +02:00
bakkeby
a725f9f6b9 Bump to dfbbf7f.
readstdin: reduce memory-usage by duplicating the line from getline()

Improves upon commit 32db2b125190d366be472ccb7cad833248696144

The getline() implementation often uses a more greedy way of allocating memory.
Using this buffer directly and forcing an allocation (by setting it to NULL)
would waste a bit of extra space, depending on the implementation of course.

Tested on musl libc and glibc.
The current glibc version allocates a minimum of 120 bytes per line.
For smaller lines musl libc seems less wasteful but still wastes a few bytes
per line.

On a dmenu_path listing on my system the memory usage was about 350kb (old) vs
30kb (new) on Void Linux glibc.

Side-note that getline() also reads NUL bytes in lines, while strdup() would
read until the NUL byte. Since dmenu reads text lines either is probably
fine(tm). Also rename junk to linesiz.

Ref.
https://git.suckless.org/dmenu/commit/dfbbf7f6e1b22ccf9e5a45d77ee10995577fb4fc.html
2023-04-07 14:17:25 +02:00
bakkeby
1279886b9c Bump to ba1a347.
readstdin: allocate amount of items

Keep track of the amount of items (not a total buffer size), allocate an array of
new items. For now change BUFSIZ bytes to 256 * sizeof(struct item)).

Ref.
https://git.suckless.org/dmenu/commit/ba1a347dcaba055f824161007dfee60db3ea785b.html
2023-04-07 14:15:31 +02:00
bakkeby
be4a165539 Bump to 689d9bf.
fix leak when getline fails

according to the getline(3) documentation, the calling code needs to
free the buffer even if getline fails.

dmenu currently doesn't do that which results in a small leak in case of
failure (e.g when piped /dev/null)

	$ ./dmenu < /dev/null
	==8201==ERROR: LeakSanitizer: detected memory leaks
	Direct leak of 120 byte(s) in 1 object(s) allocated from:
	    #0 0x7f6bf5785ef7 in malloc
	    #1 0x7f6bf538ec84 in __getdelim
	    #2 0x405d0c in readstdin dmenu.c:557

moving `line = NULL` inside the loop body wasn't strictly necessary, but
IMO it makes it more apparent that `line` is getting cleared to NULL
after each successful iteration.

Ref.
https://git.suckless.org/dmenu/commit/689d9bfcf6859e5ce85c296ff0f23b5c08b1fedc.html
2023-04-07 14:12:49 +02:00
bakkeby
f739d8c3a5 pango: fix for numbers patch compatiblity issue 2023-04-03 10:53:42 +02:00
bakkeby
3952d1a3a2 Revert 7016369682
This reverts the commit:
   [dmenu][PATCH] call exec in dmenu_run, to avoid dangling shell process

This to be in line with upstream dmenu.
2023-04-03 10:45:38 +02:00
bakkeby
05f5efc5e5 Bump to e42c036.
dmenu: small XmbLookupString code improvements

* Increase the length of composed strings to the same limit as st (32 to 64 bytes).
* Initialize ksym to NoSymbol to be safe: currently this is not an issue though.
* Add comments to clarify the return values of XmbLookupString a bit.

Ref.
https://git.suckless.org/dmenu/commit/e42c03663442f5fb2f66dd59cc5bfdc61c53192c.html
2022-10-26 10:00:45 +02:00
bakkeby
b4aad57ce4 Bump to 1d2b462.
bump version to 5.2

Ref.
https://git.suckless.org/dmenu/commit/1d2b462acf1210b8f86966b8dd9bb6e36e369ee1.html
2022-10-06 15:19:05 +02:00
bakkeby
ab98c7c1a9 Bump to 7ec32fe4.
dmenu: use die() to print the usage message

Ref.
https://git.suckless.org/dmenu/commit/7ec32fe4944d4f7137cf2a23366324ffe0f10a70.html
2022-10-06 15:17:49 +02:00
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