summaryrefslogtreecommitdiff
path: root/src/history.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/history.c')
-rw-r--r--src/history.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/history.c b/src/history.c
index 10de5b9a..562c23bf 100644
--- a/src/history.c
+++ b/src/history.c
@@ -271,19 +271,25 @@ const iStringArray *searchContents_History(const iHistory *d, const iRegExp *pat
271 iString entry; 271 iString entry;
272 init_String(&entry); 272 init_String(&entry);
273 iRangei cap = m.range; 273 iRangei cap = m.range;
274 cap.start = iMax(cap.start - 15, 0); 274 const int prefix = iMin(10, cap.start);
275 cap.end = iMin(cap.end + 15, (int) size_Block(&resp->body)); 275 cap.start = cap.start - prefix;
276 cap.end = iMin(cap.end + 30, (int) size_Block(&resp->body));
277 const size_t maxLen = 60;
278 if (size_Range(&cap) > maxLen) {
279 cap.end = cap.start + maxLen;
280 }
276 iString content; 281 iString content;
277 initRange_String(&content, (iRangecc){ m.subject + cap.start, m.subject + cap.end }); 282 initRange_String(&content, (iRangecc){ m.subject + cap.start, m.subject + cap.end });
278 /* This needs cleaning up; highlight the matched word. */ 283 /* This needs cleaning up; highlight the matched word. */
279 replace_Block(&content.chars, '\n', ' '); 284 replace_Block(&content.chars, '\n', ' ');
280 replace_Block(&content.chars, '\r', ' '); 285 replace_Block(&content.chars, '\r', ' ');
281// insertData_Block(&content.chars, 10, uiTextStrong_ColorEscape, 2); 286 if (prefix + size_Range(&m.range) < size_String(&content)) {
282// insertData_Block(&content.chars, size_String(&content) - 10, uiText_ColorEscape, 2); 287 insertData_Block(&content.chars, prefix + size_Range(&m.range), uiText_ColorEscape, 2);
288 }
289 insertData_Block(&content.chars, prefix, uiTextStrong_ColorEscape, 2);
283 format_String( 290 format_String(
284 &entry, "match len:%zu str:%s", size_String(&content), cstr_String(&content)); 291 &entry, "match len:%zu str:%s", size_String(&content), cstr_String(&content));
285 deinit_String(&content); 292 deinit_String(&content);
286 //appendRange_String(&entry, );
287 appendFormat_String(&entry, " url:%s", cstr_String(&url->url)); 293 appendFormat_String(&entry, " url:%s", cstr_String(&url->url));
288 if (!contains_StringSet(&inserted, &url->url)) { 294 if (!contains_StringSet(&inserted, &url->url)) {
289 pushFront_StringArray(urls, &entry); 295 pushFront_StringArray(urls, &entry);