Fossil SCM
Show the title of a forum thread without truncation. (This check-in is reapply after having been accidently deleted.)
Commit
74549a9a8d1668b01c2890616097c7b87bf5755d7d5cb35684cb4edcfcf8c7a0
Parent
dcf441077d52bae…
2 files changed
+2
-18
+2
-18
+2
-18
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -577,37 +577,21 @@ | ||
| 577 | 577 | /* |
| 578 | 578 | ** Add an appropriate style_header() to include title of the |
| 579 | 579 | ** given forum post. |
| 580 | 580 | */ |
| 581 | 581 | static int forumthread_page_header(int froot, int fpid){ |
| 582 | - Blob title; | |
| 583 | - int mxForumPostTitleLen = 50; | |
| 584 | - char *zThreadTitle = ""; | |
| 582 | + char *zThreadTitle = 0; | |
| 585 | 583 | |
| 586 | 584 | zThreadTitle = db_text("", |
| 587 | 585 | "SELECT" |
| 588 | 586 | " substr(event.comment,instr(event.comment,':')+2)" |
| 589 | 587 | " FROM forumpost, event" |
| 590 | 588 | " WHERE event.objid=forumpost.fpid" |
| 591 | 589 | " AND forumpost.fpid=%d;", |
| 592 | 590 | fpid |
| 593 | 591 | ); |
| 594 | - blob_set(&title, zThreadTitle); | |
| 595 | - /* truncate the title when longer than max allowed; | |
| 596 | - * in case of UTF-8 make sure the truncated string remains valid, | |
| 597 | - * otherwise (different encoding?) pass as-is | |
| 598 | - */ | |
| 599 | - if( mxForumPostTitleLen>0 && blob_size(&title)>mxForumPostTitleLen ){ | |
| 600 | - int len; | |
| 601 | - len = utf8_codepoint_index(blob_str(&title), mxForumPostTitleLen); | |
| 602 | - if( len ){ | |
| 603 | - blob_truncate(&title, len); | |
| 604 | - blob_append(&title, "...", 3); | |
| 605 | - } | |
| 606 | - } | |
| 607 | - style_header("%s%s", blob_str(&title), blob_size(&title) ? " - Forum" : "Forum"); | |
| 608 | - blob_reset(&title); | |
| 592 | + style_header("%s%s", zThreadTitle, zThreadTitle[0] ? "" : "Forum"); | |
| 609 | 593 | fossil_free(zThreadTitle); |
| 610 | 594 | return 0; |
| 611 | 595 | } |
| 612 | 596 | |
| 613 | 597 | /* |
| 614 | 598 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -577,37 +577,21 @@ | |
| 577 | /* |
| 578 | ** Add an appropriate style_header() to include title of the |
| 579 | ** given forum post. |
| 580 | */ |
| 581 | static int forumthread_page_header(int froot, int fpid){ |
| 582 | Blob title; |
| 583 | int mxForumPostTitleLen = 50; |
| 584 | char *zThreadTitle = ""; |
| 585 | |
| 586 | zThreadTitle = db_text("", |
| 587 | "SELECT" |
| 588 | " substr(event.comment,instr(event.comment,':')+2)" |
| 589 | " FROM forumpost, event" |
| 590 | " WHERE event.objid=forumpost.fpid" |
| 591 | " AND forumpost.fpid=%d;", |
| 592 | fpid |
| 593 | ); |
| 594 | blob_set(&title, zThreadTitle); |
| 595 | /* truncate the title when longer than max allowed; |
| 596 | * in case of UTF-8 make sure the truncated string remains valid, |
| 597 | * otherwise (different encoding?) pass as-is |
| 598 | */ |
| 599 | if( mxForumPostTitleLen>0 && blob_size(&title)>mxForumPostTitleLen ){ |
| 600 | int len; |
| 601 | len = utf8_codepoint_index(blob_str(&title), mxForumPostTitleLen); |
| 602 | if( len ){ |
| 603 | blob_truncate(&title, len); |
| 604 | blob_append(&title, "...", 3); |
| 605 | } |
| 606 | } |
| 607 | style_header("%s%s", blob_str(&title), blob_size(&title) ? " - Forum" : "Forum"); |
| 608 | blob_reset(&title); |
| 609 | fossil_free(zThreadTitle); |
| 610 | return 0; |
| 611 | } |
| 612 | |
| 613 | /* |
| 614 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -577,37 +577,21 @@ | |
| 577 | /* |
| 578 | ** Add an appropriate style_header() to include title of the |
| 579 | ** given forum post. |
| 580 | */ |
| 581 | static int forumthread_page_header(int froot, int fpid){ |
| 582 | char *zThreadTitle = 0; |
| 583 | |
| 584 | zThreadTitle = db_text("", |
| 585 | "SELECT" |
| 586 | " substr(event.comment,instr(event.comment,':')+2)" |
| 587 | " FROM forumpost, event" |
| 588 | " WHERE event.objid=forumpost.fpid" |
| 589 | " AND forumpost.fpid=%d;", |
| 590 | fpid |
| 591 | ); |
| 592 | style_header("%s%s", zThreadTitle, zThreadTitle[0] ? "" : "Forum"); |
| 593 | fossil_free(zThreadTitle); |
| 594 | return 0; |
| 595 | } |
| 596 | |
| 597 | /* |
| 598 |
+2
-18
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -577,37 +577,21 @@ | ||
| 577 | 577 | /* |
| 578 | 578 | ** Add an appropriate style_header() to include title of the |
| 579 | 579 | ** given forum post. |
| 580 | 580 | */ |
| 581 | 581 | static int forumthread_page_header(int froot, int fpid){ |
| 582 | - Blob title; | |
| 583 | - int mxForumPostTitleLen = 50; | |
| 584 | - char *zThreadTitle = ""; | |
| 582 | + char *zThreadTitle = 0; | |
| 585 | 583 | |
| 586 | 584 | zThreadTitle = db_text("", |
| 587 | 585 | "SELECT" |
| 588 | 586 | " substr(event.comment,instr(event.comment,':')+2)" |
| 589 | 587 | " FROM forumpost, event" |
| 590 | 588 | " WHERE event.objid=forumpost.fpid" |
| 591 | 589 | " AND forumpost.fpid=%d;", |
| 592 | 590 | fpid |
| 593 | 591 | ); |
| 594 | - blob_set(&title, zThreadTitle); | |
| 595 | - /* truncate the title when longer than max allowed; | |
| 596 | - * in case of UTF-8 make sure the truncated string remains valid, | |
| 597 | - * otherwise (different encoding?) pass as-is | |
| 598 | - */ | |
| 599 | - if( mxForumPostTitleLen>0 && blob_size(&title)>mxForumPostTitleLen ){ | |
| 600 | - int len; | |
| 601 | - len = utf8_codepoint_index(blob_str(&title), mxForumPostTitleLen); | |
| 602 | - if( len ){ | |
| 603 | - blob_truncate(&title, len); | |
| 604 | - blob_append(&title, "...", 3); | |
| 605 | - } | |
| 606 | - } | |
| 607 | - style_header("%s%s", blob_str(&title), blob_size(&title) ? " - Forum" : "Forum"); | |
| 608 | - blob_reset(&title); | |
| 592 | + style_header("%s%s", zThreadTitle, zThreadTitle[0] ? "" : "Forum"); | |
| 609 | 593 | fossil_free(zThreadTitle); |
| 610 | 594 | return 0; |
| 611 | 595 | } |
| 612 | 596 | |
| 613 | 597 | /* |
| 614 | 598 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -577,37 +577,21 @@ | |
| 577 | /* |
| 578 | ** Add an appropriate style_header() to include title of the |
| 579 | ** given forum post. |
| 580 | */ |
| 581 | static int forumthread_page_header(int froot, int fpid){ |
| 582 | Blob title; |
| 583 | int mxForumPostTitleLen = 50; |
| 584 | char *zThreadTitle = ""; |
| 585 | |
| 586 | zThreadTitle = db_text("", |
| 587 | "SELECT" |
| 588 | " substr(event.comment,instr(event.comment,':')+2)" |
| 589 | " FROM forumpost, event" |
| 590 | " WHERE event.objid=forumpost.fpid" |
| 591 | " AND forumpost.fpid=%d;", |
| 592 | fpid |
| 593 | ); |
| 594 | blob_set(&title, zThreadTitle); |
| 595 | /* truncate the title when longer than max allowed; |
| 596 | * in case of UTF-8 make sure the truncated string remains valid, |
| 597 | * otherwise (different encoding?) pass as-is |
| 598 | */ |
| 599 | if( mxForumPostTitleLen>0 && blob_size(&title)>mxForumPostTitleLen ){ |
| 600 | int len; |
| 601 | len = utf8_codepoint_index(blob_str(&title), mxForumPostTitleLen); |
| 602 | if( len ){ |
| 603 | blob_truncate(&title, len); |
| 604 | blob_append(&title, "...", 3); |
| 605 | } |
| 606 | } |
| 607 | style_header("%s%s", blob_str(&title), blob_size(&title) ? " - Forum" : "Forum"); |
| 608 | blob_reset(&title); |
| 609 | fossil_free(zThreadTitle); |
| 610 | return 0; |
| 611 | } |
| 612 | |
| 613 | /* |
| 614 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -577,37 +577,21 @@ | |
| 577 | /* |
| 578 | ** Add an appropriate style_header() to include title of the |
| 579 | ** given forum post. |
| 580 | */ |
| 581 | static int forumthread_page_header(int froot, int fpid){ |
| 582 | char *zThreadTitle = 0; |
| 583 | |
| 584 | zThreadTitle = db_text("", |
| 585 | "SELECT" |
| 586 | " substr(event.comment,instr(event.comment,':')+2)" |
| 587 | " FROM forumpost, event" |
| 588 | " WHERE event.objid=forumpost.fpid" |
| 589 | " AND forumpost.fpid=%d;", |
| 590 | fpid |
| 591 | ); |
| 592 | style_header("%s%s", zThreadTitle, zThreadTitle[0] ? "" : "Forum"); |
| 593 | fossil_free(zThreadTitle); |
| 594 | return 0; |
| 595 | } |
| 596 | |
| 597 | /* |
| 598 |