Compare commits

...

2 Commits

Author SHA1 Message Date
61a141203b
Bump liberty and version, update NEWS 2021-12-21 05:46:28 +01:00
48482ef2e5
Make incremental search more useful
Make it unanchored, as well as case-insensitive.
2021-12-21 05:46:22 +01:00
4 changed files with 15 additions and 10 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 3.0)
project (nncmpp VERSION 1.1.1 LANGUAGES C)
project (nncmpp VERSION 1.2.0 LANGUAGES C)
# Moar warnings
if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC)

4
NEWS
View File

@ -1,10 +1,10 @@
x.x.x (xxxx-xx-xx)
1.2.0 (2021-12-21)
* Added ability to control the volume of MPD's current PulseAudio sink
* Now fetching Internet stream information asynchronously
* Added rudimentary incremental search, normally bound to C-s, in all tabs
* Added basic incremental search, normally bound to C-s, in all tabs
* Fixed jumping to the beginning of the queue after deleting items

@ -1 +1 @@
Subproject commit 782a9a5977bd5f2101e8808b94d659fe52e2490a
Subproject commit 7e8e085c97311b52db4d6739b6ef2a1b26a2319f

View File

@ -2350,12 +2350,17 @@ static size_t
incremental_search_match (const ucs4_t *needle, size_t len,
const struct row_buffer *row)
{
// TODO: case-insensitive search, wilcards, regexps, something easy to use
size_t i = 0;
for (; i < len && i < row->chars_len; i++)
if (needle[i] != row->chars[i].c)
break;
return i;
// XXX: this is slow and simplistic, but unistring is awkward to use
size_t best = 0;
for (size_t start = 0; start < row->chars_len; start++)
{
size_t i = 0;
for (; i < len && start + i < row->chars_len; i++)
if (uc_tolower(needle[i]) != uc_tolower(row->chars[start + i].c))
break;
best = MAX (best, i);
}
return best;
}
static void