Commit graph

34 commits

Author SHA1 Message Date
zhang_ji b838fce38a [matcher] start matching after main received the start event
This synchronization is needed. Otherwise model will recieve additional
matched items or be cleared unexpectly.

Also change the refresh strategy to avoid screen flickr.
2016-06-28 10:57:09 +08:00
Mark Wallace b3fe263171 [matcher] add cache 2016-06-27 21:54:50 +08:00
zhang_ji 01188a8c8f tmp commit 2016-06-27 18:30:15 +08:00
zhang_ji 5926050ce8 [matcher] match item one by one
Previously the match process is executed in chunks(100 items) and then check
if there is a new event come. It will cause some delay when user change the
query. Now we check the eventbox after each item is processed.
2016-06-27 17:08:54 +08:00
zhang_ji cd048bd95a [reader] insert new item directly in reader 2016-06-27 14:29:28 +08:00
zhang_ji 4e6fc1a8c3 [color] color for print item done. 2016-06-27 09:54:04 +08:00
Mark Wallace 6e42a846a4 [model] set color for selected mark 2016-06-27 08:56:13 +08:00
Mark Wallace fa505c4cc7 [curses] add color support 2016-06-27 08:34:37 +08:00
Mark Wallace d7ae61c7d8 [model] handle terminal resize event. 2016-06-26 15:07:44 +08:00
Mark Wallace 63bbcfbad1 [model] save selected items' indics in model.
Previously whether an item is selected or not is saved in the item. Normally
the selected item won't be much. When finally we want to output, the original
strategy would have to iterate through all existing items and check whether
they are selected or not.

Now we extract this info out, so that we only need to iterate over the
selected ones instead of the whole set. Improve the speed.
2016-06-26 09:51:57 +08:00
Mark Wallace fc6882e826 [controller] fix input delay when there are a lot data to read.
the problem is that the controller will save all items read before send the
NewItem event to matcher. Meanwhile the matcher keeps going because no signal
is received. And since the controller will need to lock the data of items and
that lock is not released by matcher. Kind of deadlock here.
2016-06-26 09:21:36 +08:00
Mark Wallace 2713175ec0 [score] refine the weihts 2016-06-25 17:46:18 +08:00
Mark Wallace ad03409e1b [score] adjust the score for the first character 2016-06-25 17:19:47 +08:00
Mark Wallace d145785e4e [matcher] remove unused function 2016-06-25 17:12:48 +08:00
Mark Wallace 7060a78229 [orderedvec] fix sorting bugs. 2016-06-25 17:11:39 +08:00
Mark Wallace ccbfc24607 [item] change data structure to support indivisual matched characters 2016-06-25 16:48:46 +08:00
Mark Wallace c62afe4d94 [score] refine the code for better understanding 2016-06-25 15:49:37 +08:00
Mark Wallace 1c7e90c6dd [score] add a new fuzzy search algorithm. 2016-06-25 11:30:31 +08:00
zhang_ji 6356249d19 [model] simple highlight for matched items 2016-06-24 16:42:00 +08:00
zhang_ji a6ae8281c1 [model] sort the matched items. 2016-06-24 16:18:50 +08:00
zhang_ji 74b7ed6da0 [fuzzy] add fuzzy search algorithm
Compare the query and choice/item character by character. sorting is not
implemented yet.
2016-06-22 16:00:51 +08:00
zhang_ji 6816c22d00 [input] fix stdin conflict between input and reader
Input used `wget_wch` to fetch keys pressed which occupys stdin of terminal,
thus causes reader failure in reading from stdin. So fzf-rs won't be able to
handle input from stdin.

Now the input is read from `/dev/tty` file. Requires nightly to build.
2016-06-22 11:57:50 +08:00
zhang_ji 5147927e74 [module] move the structs into different modules 2016-06-15 17:11:43 +08:00
zhang_ji 6ec6cfb978 Finish the basic interaction
1. toggle selection of an entry
2. scroll up/down
3. output the selected item
2016-06-15 16:03:51 +08:00
zhang_ji 72252243d1 [item] use struct instead of pure string to represent item 2016-06-15 12:26:13 +08:00
zhang_ji 3b8cb88a5c basic structure for reader/matcher/input done. 2016-06-13 16:38:01 +08:00
zhang_ji c9885784ee [main] first version of input/model done. 2016-06-13 15:52:43 +08:00
zhang_ji 2b603c53e5 [main] reader/matcher communication done. 2016-06-13 13:56:42 +08:00
zhang_ji 3377e7f006 [util] add generic type support for eventbox 2016-06-13 12:39:48 +08:00
Mark Wallace 829d713444 [eventbox] done. wrapper of condvar and mutex for event handling. 2016-06-10 11:00:53 +08:00
Mark Wallace 7c1f34d8ba tmp commit 2016-06-06 08:20:41 +08:00
Mark Wallace 19b575cd3a [reader] draft version for reader done.
read lines from stdin or from command's output(`find .`)
2016-06-04 14:52:04 +08:00
Mark Wallace 4466964792 add ncurses dependency 2016-05-29 14:27:09 +08:00
Jinzhou Zhang cd3ef3c36e Initial commit 2016-05-29 14:24:47 +08:00