File src/hstr.c changed (mode: 100644) (index dc75181..cde6efa) |
... |
... |
unsigned make_selection(char *prefix, HistoryItems *history, int maxSelectionCou |
143 |
143 |
if(prefix==NULL) { |
if(prefix==NULL) { |
144 |
144 |
selection[selectionCount++]=history->items[i]; |
selection[selectionCount++]=history->items[i]; |
145 |
145 |
} else { |
} else { |
146 |
|
if(history->items[i]==strstr(history->items[i], prefix)) { |
|
147 |
|
selection[selectionCount++]=history->items[i]; |
|
|
146 |
|
if(caseSensitive) { |
|
147 |
|
if(history->items[i]==strstr(history->items[i], prefix)) { |
|
148 |
|
selection[selectionCount++]=history->items[i]; |
|
149 |
|
} |
|
150 |
|
} else { |
|
151 |
|
if(history->items[i]==strcasestr(history->items[i], prefix)) { |
|
152 |
|
selection[selectionCount++]=history->items[i]; |
|
153 |
|
} |
148 |
154 |
} |
} |
149 |
155 |
} |
} |
150 |
156 |
} |
} |
|
... |
... |
char *print_selection(WINDOW *win, unsigned maxHistoryItems, char *prefix, Histo |
187 |
193 |
move(Y_OFFSET_ITEMS, 0); |
move(Y_OFFSET_ITEMS, 0); |
188 |
194 |
wclrtobot(win); |
wclrtobot(win); |
189 |
195 |
|
|
190 |
|
char *p; |
|
|
196 |
|
char *p, *pdup; |
191 |
197 |
for (i = 0; i<height; ++i) { |
for (i = 0; i<height; ++i) { |
192 |
198 |
if(i<selectionSize) { |
if(i<selectionSize) { |
193 |
199 |
snprintf(screenLine, width, " %s", selection[i]); |
snprintf(screenLine, width, " %s", selection[i]); |
194 |
200 |
mvwprintw(win, y++, 0, screenLine); |
mvwprintw(win, y++, 0, screenLine); |
195 |
|
if(prefix!=NULL) { |
|
|
201 |
|
if(prefix!=NULL && strlen(prefix)>0) { |
196 |
202 |
wattron(win,A_BOLD); |
wattron(win,A_BOLD); |
197 |
203 |
if(caseSensitive) { |
if(caseSensitive) { |
198 |
204 |
p=strstr(selection[i], prefix); |
p=strstr(selection[i], prefix); |
|
205 |
|
mvwprintw(win, (y-1), 1+(p-selection[i]), "%s", prefix); |
199 |
206 |
} else { |
} else { |
200 |
207 |
p=strcasestr(selection[i], prefix); |
p=strcasestr(selection[i], prefix); |
|
208 |
|
snprintf(screenLine, strlen(prefix)+1, "%s", p); |
|
209 |
|
mvwprintw(win, (y-1), 1+(p-selection[i]), "%s", screenLine); |
201 |
210 |
} |
} |
202 |
|
mvwprintw(win, (y-1), 1+(p-selection[i]), "%s", prefix); |
|
|
211 |
|
|
203 |
212 |
wattroff(win,A_BOLD); |
wattroff(win,A_BOLD); |
204 |
213 |
} |
} |
205 |
214 |
} else { |
} else { |