diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.c | 25 | ||||
-rw-r--r-- | src/history.c | 32 | ||||
-rw-r--r-- | src/history.h | 2 |
3 files changed, 50 insertions, 9 deletions
@@ -323,11 +323,10 @@ static void saveState_App_(const iApp *d) { | |||
323 | writeData_File(f, magicState_App_, 4); | 323 | writeData_File(f, magicState_App_, 4); |
324 | writeU32_File(f, latest_FileVersion); /* version */ | 324 | writeU32_File(f, latest_FileVersion); /* version */ |
325 | iConstForEach(ObjectList, i, iClob(listDocuments_App())) { | 325 | iConstForEach(ObjectList, i, iClob(listDocuments_App())) { |
326 | if (isInstance_Object(i.object, &Class_DocumentWidget)) { | 326 | iAssert(isInstance_Object(i.object, &Class_DocumentWidget)); |
327 | writeData_File(f, magicTabDocument_App_, 4); | 327 | writeData_File(f, magicTabDocument_App_, 4); |
328 | write8_File(f, document_App() == i.object ? 1 : 0); | 328 | write8_File(f, document_App() == i.object ? 1 : 0); |
329 | serializeState_DocumentWidget(i.object, stream_File(f)); | 329 | serializeState_DocumentWidget(i.object, stream_File(f)); |
330 | } | ||
331 | } | 330 | } |
332 | } | 331 | } |
333 | iRelease(f); | 332 | iRelease(f); |
@@ -500,14 +499,22 @@ const iString *debugInfo_App(void) { | |||
500 | iApp *d = &app_; | 499 | iApp *d = &app_; |
501 | iString *msg = collectNew_String(); | 500 | iString *msg = collectNew_String(); |
502 | format_String(msg, "# Debug information\n"); | 501 | format_String(msg, "# Debug information\n"); |
503 | appendFormat_String(msg, "## Launch arguments\n"); | 502 | appendFormat_String(msg, "## Documents\n"); |
503 | iForEach(ObjectList, k, listDocuments_App()) { | ||
504 | iDocumentWidget *doc = k.object; | ||
505 | appendFormat_String(msg, "### Tab %zu: %s\n", | ||
506 | childIndex_Widget(constAs_Widget(doc)->parent, k.object), | ||
507 | cstr_String(bookmarkTitle_DocumentWidget(doc))); | ||
508 | append_String(msg, collect_String(debugInfo_History(history_DocumentWidget(doc)))); | ||
509 | } | ||
510 | appendFormat_String(msg, "## Launch arguments\n```\n"); | ||
504 | iConstForEach(StringList, i, args_CommandLine(&d->args)) { | 511 | iConstForEach(StringList, i, args_CommandLine(&d->args)) { |
505 | appendFormat_String(msg, "* %zu: %s\n", i.pos, cstr_String(i.value)); | 512 | appendFormat_String(msg, "%3zu : %s\n", i.pos, cstr_String(i.value)); |
506 | } | 513 | } |
507 | appendFormat_String(msg, "## Launch commands\n"); | 514 | appendFormat_String(msg, "```\n## Launch commands\n"); |
508 | iConstForEach(StringList, j, d->launchCommands) { | 515 | iConstForEach(StringList, j, d->launchCommands) { |
509 | appendFormat_String(msg, "%s\n", cstr_String(j.value)); | 516 | appendFormat_String(msg, "%s\n", cstr_String(j.value)); |
510 | } | 517 | } |
511 | appendFormat_String(msg, "## MIME hooks\n"); | 518 | appendFormat_String(msg, "## MIME hooks\n"); |
512 | append_String(msg, debugInfo_MimeHooks(d->mimehooks)); | 519 | append_String(msg, debugInfo_MimeHooks(d->mimehooks)); |
513 | return msg; | 520 | return msg; |
diff --git a/src/history.c b/src/history.c index 562c23bf..202549a9 100644 --- a/src/history.c +++ b/src/history.c | |||
@@ -86,6 +86,38 @@ iHistory *copy_History(const iHistory *d) { | |||
86 | return copy; | 86 | return copy; |
87 | } | 87 | } |
88 | 88 | ||
89 | iString *debugInfo_History(const iHistory *d) { | ||
90 | iString *str = new_String(); | ||
91 | format_String(str, | ||
92 | "```\n" | ||
93 | "Idx | Size | SP%% | URL\n" | ||
94 | "----+---------+-----+-----\n"); | ||
95 | size_t totalSize = 0; | ||
96 | iConstForEach(Array, i, &d->recent) { | ||
97 | const iRecentUrl *item = i.value; | ||
98 | appendFormat_String( | ||
99 | str, " %2zu | ", size_Array(&d->recent) - index_ArrayConstIterator(&i) - 1); | ||
100 | if (item->cachedResponse) { | ||
101 | appendFormat_String(str, "%7zu", size_Block(&item->cachedResponse->body)); | ||
102 | totalSize += size_Block(&item->cachedResponse->body); | ||
103 | } | ||
104 | else { | ||
105 | appendFormat_String(str, " --"); | ||
106 | } | ||
107 | appendFormat_String(str, | ||
108 | " | %3d | %s\n", | ||
109 | iRound(100.0f * item->normScrollY), | ||
110 | cstr_String(&item->url)); | ||
111 | } | ||
112 | appendFormat_String(str, "\n```\n"); | ||
113 | appendFormat_String(str, | ||
114 | "Total cached data: %.3f MB\n" | ||
115 | "Navigation position: %zu\n\n", | ||
116 | totalSize / 1.0e6f, | ||
117 | d->recentPos); | ||
118 | return str; | ||
119 | } | ||
120 | |||
89 | void serialize_History(const iHistory *d, iStream *outs) { | 121 | void serialize_History(const iHistory *d, iStream *outs) { |
90 | lock_Mutex(d->mtx); | 122 | lock_Mutex(d->mtx); |
91 | writeU16_Stream(outs, d->recentPos); | 123 | writeU16_Stream(outs, d->recentPos); |
diff --git a/src/history.h b/src/history.h index 41005d02..4c6507e3 100644 --- a/src/history.h +++ b/src/history.h | |||
@@ -68,3 +68,5 @@ const iRecentUrl * | |||
68 | const iGmResponse * | 68 | const iGmResponse * |
69 | cachedResponse_History (const iHistory *); | 69 | cachedResponse_History (const iHistory *); |
70 | 70 | ||
71 | iString * debugInfo_History (const iHistory *); | ||
72 | |||