File src/hstr.c changed (mode: 100644) (index f88d4d7..7175f82) |
... |
... |
void selection_loop(HistoryItems *history) |
377 |
377 |
case K_CTRL_T: |
case K_CTRL_T: |
378 |
378 |
caseSensitive=!caseSensitive; |
caseSensitive=!caseSensitive; |
379 |
379 |
result=print_selection(maxHistoryItems, prefix, history); |
result=print_selection(maxHistoryItems, prefix, history); |
|
380 |
|
// TODO render selected line (or reset and move to prompt) |
380 |
381 |
print_history_label(history); |
print_history_label(history); |
381 |
382 |
break; |
break; |
382 |
383 |
case K_CTRL_H: |
case K_CTRL_H: |
383 |
384 |
defaultOrder=!defaultOrder; |
defaultOrder=!defaultOrder; |
384 |
385 |
result=print_selection(maxHistoryItems, prefix, history); |
result=print_selection(maxHistoryItems, prefix, history); |
|
386 |
|
// TODO render selected line (or reset and move to prompt) |
385 |
387 |
print_history_label(history); |
print_history_label(history); |
386 |
388 |
break; |
break; |
387 |
389 |
case K_CTRL_X: |
case K_CTRL_X: |
File src/hstr_history.c changed (mode: 100644) (index d592d61..e7baf39) |
... |
... |
static const char *commandBlacklist[] = { |
35 |
35 |
#endif |
#endif |
36 |
36 |
|
|
37 |
37 |
unsigned history_ranking_function(unsigned rank, int newOccurenceOrder, size_t length) { |
unsigned history_ranking_function(unsigned rank, int newOccurenceOrder, size_t length) { |
38 |
|
long metrics=rank+newOccurenceOrder/10+length; |
|
|
38 |
|
//long metrics=rank+newOccurenceOrder/10+length; |
|
39 |
|
long metrics=rank+(log(newOccurenceOrder)*10.0)+length; |
39 |
40 |
assert(metrics<UINT_MAX); |
assert(metrics<UINT_MAX); |
40 |
41 |
return metrics; |
return metrics; |
41 |
42 |
} |
} |
File tests/src/test_hashset.c changed (mode: 100644) (index eade8b2..7ab3998) |
7 |
7 |
|
|
8 |
8 |
#include "../src/include/hashset.h" |
#include "../src/include/hashset.h" |
9 |
9 |
|
|
10 |
|
int main(int argc, char *argv[]) |
|
11 |
|
{ |
|
12 |
|
const char *commandBlacklist[] = {"ls", "pwd", "cd", "hh", "mc"}; |
|
|
10 |
|
void testBlacklist() { |
|
11 |
|
const char* commandBlacklist[] = { }; |
13 |
12 |
HashSet blacklist; |
HashSet blacklist; |
14 |
13 |
int i; |
int i; |
15 |
14 |
hashset_init(&blacklist); |
hashset_init(&blacklist); |
16 |
|
for(i=0; i<5; i++) { |
|
|
15 |
|
for (i = 0; i < 5; i++) { |
17 |
16 |
hashset_add(&blacklist, commandBlacklist[i]); |
hashset_add(&blacklist, commandBlacklist[i]); |
18 |
17 |
} |
} |
19 |
|
|
|
20 |
|
for(i=0; i<5; i++) { |
|
21 |
|
printf("match %d\n", hashset_contains(&blacklist, strdup(commandBlacklist[i]))); |
|
|
18 |
|
for (i = 0; i < 5; i++) { |
|
19 |
|
printf("match %d\n", |
|
20 |
|
hashset_contains(&blacklist, strdup(commandBlacklist[i]))); |
22 |
21 |
} |
} |
23 |
22 |
} |
} |
24 |
23 |
|
|
|
24 |
|
int main(int argc, char *argv[]) |
|
25 |
|
{ |
|
26 |
|
testBlacklist(); |
|
27 |
|
} |
|
28 |
|
|