Fossil SCM
Show the title of a forum thread without truncation.
Commit
81d66a357d291213f56daf82c86498bdc2c33744a4ba3cea5aa3ded140684bad
Parent
4b82e96ac84c2fb…
1 file changed
+2
-18
+2
-18
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -536,37 +536,21 @@ | ||
| 536 | 536 | /* |
| 537 | 537 | ** Add an appropriate style_header() to include title of the |
| 538 | 538 | ** given forum post. |
| 539 | 539 | */ |
| 540 | 540 | static int forumthread_page_header(int froot, int fpid){ |
| 541 | - Blob title; | |
| 542 | - int mxForumPostTitleLen = 50; | |
| 543 | - char *zThreadTitle = ""; | |
| 541 | + char *zThreadTitle = 0; | |
| 544 | 542 | |
| 545 | 543 | zThreadTitle = db_text("", |
| 546 | 544 | "SELECT" |
| 547 | 545 | " substr(event.comment,instr(event.comment,':')+2)" |
| 548 | 546 | " FROM forumpost, event" |
| 549 | 547 | " WHERE event.objid=forumpost.fpid" |
| 550 | 548 | " AND forumpost.fpid=%d;", |
| 551 | 549 | fpid |
| 552 | 550 | ); |
| 553 | - blob_set(&title, zThreadTitle); | |
| 554 | - /* truncate the title when longer than max allowed; | |
| 555 | - * in case of UTF-8 make sure the truncated string remains valid, | |
| 556 | - * otherwise (different encoding?) pass as-is | |
| 557 | - */ | |
| 558 | - if( mxForumPostTitleLen>0 && blob_size(&title)>mxForumPostTitleLen ){ | |
| 559 | - int len; | |
| 560 | - len = utf8_codepoint_index(blob_str(&title), mxForumPostTitleLen); | |
| 561 | - if( len ){ | |
| 562 | - blob_truncate(&title, len); | |
| 563 | - blob_append(&title, "...", 3); | |
| 564 | - } | |
| 565 | - } | |
| 566 | - style_header("%s%s", blob_str(&title), blob_size(&title) ? " - Forum" : "Forum"); | |
| 567 | - blob_reset(&title); | |
| 551 | + style_header("%s%s", zThreadTitle, zThreadTitle[0] ? "" : "Forum"); | |
| 568 | 552 | fossil_free(zThreadTitle); |
| 569 | 553 | return 0; |
| 570 | 554 | } |
| 571 | 555 | |
| 572 | 556 | /* |
| 573 | 557 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -536,37 +536,21 @@ | |
| 536 | /* |
| 537 | ** Add an appropriate style_header() to include title of the |
| 538 | ** given forum post. |
| 539 | */ |
| 540 | static int forumthread_page_header(int froot, int fpid){ |
| 541 | Blob title; |
| 542 | int mxForumPostTitleLen = 50; |
| 543 | char *zThreadTitle = ""; |
| 544 | |
| 545 | zThreadTitle = db_text("", |
| 546 | "SELECT" |
| 547 | " substr(event.comment,instr(event.comment,':')+2)" |
| 548 | " FROM forumpost, event" |
| 549 | " WHERE event.objid=forumpost.fpid" |
| 550 | " AND forumpost.fpid=%d;", |
| 551 | fpid |
| 552 | ); |
| 553 | blob_set(&title, zThreadTitle); |
| 554 | /* truncate the title when longer than max allowed; |
| 555 | * in case of UTF-8 make sure the truncated string remains valid, |
| 556 | * otherwise (different encoding?) pass as-is |
| 557 | */ |
| 558 | if( mxForumPostTitleLen>0 && blob_size(&title)>mxForumPostTitleLen ){ |
| 559 | int len; |
| 560 | len = utf8_codepoint_index(blob_str(&title), mxForumPostTitleLen); |
| 561 | if( len ){ |
| 562 | blob_truncate(&title, len); |
| 563 | blob_append(&title, "...", 3); |
| 564 | } |
| 565 | } |
| 566 | style_header("%s%s", blob_str(&title), blob_size(&title) ? " - Forum" : "Forum"); |
| 567 | blob_reset(&title); |
| 568 | fossil_free(zThreadTitle); |
| 569 | return 0; |
| 570 | } |
| 571 | |
| 572 | /* |
| 573 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -536,37 +536,21 @@ | |
| 536 | /* |
| 537 | ** Add an appropriate style_header() to include title of the |
| 538 | ** given forum post. |
| 539 | */ |
| 540 | static int forumthread_page_header(int froot, int fpid){ |
| 541 | char *zThreadTitle = 0; |
| 542 | |
| 543 | zThreadTitle = db_text("", |
| 544 | "SELECT" |
| 545 | " substr(event.comment,instr(event.comment,':')+2)" |
| 546 | " FROM forumpost, event" |
| 547 | " WHERE event.objid=forumpost.fpid" |
| 548 | " AND forumpost.fpid=%d;", |
| 549 | fpid |
| 550 | ); |
| 551 | style_header("%s%s", zThreadTitle, zThreadTitle[0] ? "" : "Forum"); |
| 552 | fossil_free(zThreadTitle); |
| 553 | return 0; |
| 554 | } |
| 555 | |
| 556 | /* |
| 557 |