Commit Graph

126 Commits

Author SHA1 Message Date
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
bakkeby
82aa682b40 Adding emoji-highlight patch 2021-05-24 13:29:40 +02:00
bakkeby
b6103ff6a7 Adding support for ctrl+v to paste 2021-05-23 13:16:26 +02:00
bakkeby
39faa8f5c3 Improving consistency regarding flag presentation on README.md 2021-05-17 11:58:23 +02:00
bakkeby
08a4618cff Improving consistency regarding flag presentation on README.md 2021-05-17 11:57:12 +02:00
bakkeby
608fa3e837 Adding gridnav patch 2021-05-17 11:46:50 +02:00
bakkeby
f469820531 Adding plain prompt (listfullwidth) patch 2021-05-17 11:39:39 +02:00
bakkeby
24ff57a540 Adding no sort patch 2021-05-17 11:10:09 +02:00
bakkeby
d6894046f1 Adding restrict return patch 2021-05-17 10:59:48 +02:00
bakkeby
976d6bc04c Adding printindex patch 2021-05-15 14:40:05 +02:00
bakkeby
93f5b58d4e Adding tsv patch 2021-05-15 12:51:58 +02:00
bakkeby
79b9ae42d8 highlight: pango compatibility 2021-04-21 16:23:17 +02:00
bakkeby
ba88f1a3e8 Adding missing multiselect.c file ref. #3 2021-03-08 09:03:26 +01:00
bakkeby
e8da68a1a0 xresources: munmap_chunck(): Invalid Pointer when xrdb has not been loaded, ref. #2 2021-03-05 15:28:45 +01:00
bakkeby
088a083524 Proposed fix to make dynamic options and non-blocking stdin patch to work together 2020-09-17 11:14:04 +02:00
bakkeby
82c9f772f7 bump version to 5.0 2020-09-02 20:42:50 +02:00
bakkeby
c256320307 Adding json patch 2020-08-09 15:12:39 +02:00
bakkeby
3eac73fe85 Adding json patch 2020-08-09 15:10:29 +02:00
bakkeby
1f6c8c1e7c MULTI_SELECT_PATCH --> MULTI_SELECTION_PATCH 2020-08-09 13:49:41 +02:00
bakkeby
240cce1c1a Adding multi-select patch 2020-08-09 13:30:03 +02:00
bakkeby
841a0cff2b Adding morecolor patch 2020-08-09 11:57:51 +02:00
bakkeby
478f49b1c4 Adding preselect patch 2020-08-09 11:51:34 +02:00
bakkeby
984476ba94 Adding managed patch 2020-08-09 11:28:27 +02:00
bakkeby
a96da272b3 Adding symbols patch 2020-08-09 11:07:25 +02:00
bakkeby
f47269e387 Commenting out pango libraries 2020-08-09 11:07:11 +02:00
bakkeby
17d32014a3 Adding highpriority patch 2020-08-05 14:54:01 +02:00
bakkeby
aa50b3f2c5 Adding highlight patch 2020-08-05 13:19:30 +02:00