Fossil SCM

Show the title of a forum thread without truncation. (This check-in is reapply after having been accidently deleted.)

drh 2020-03-14 12:46 trunk
Commit 74549a9a8d1668b01c2890616097c7b87bf5755d7d5cb35684cb4edcfcf8c7a0
2 files changed +2 -18 +2 -18
+2 -18
--- src/forum.c
+++ src/forum.c
@@ -577,37 +577,21 @@
577577
/*
578578
** Add an appropriate style_header() to include title of the
579579
** given forum post.
580580
*/
581581
static int forumthread_page_header(int froot, int fpid){
582
- Blob title;
583
- int mxForumPostTitleLen = 50;
584
- char *zThreadTitle = "";
582
+ char *zThreadTitle = 0;
585583
586584
zThreadTitle = db_text("",
587585
"SELECT"
588586
" substr(event.comment,instr(event.comment,':')+2)"
589587
" FROM forumpost, event"
590588
" WHERE event.objid=forumpost.fpid"
591589
" AND forumpost.fpid=%d;",
592590
fpid
593591
);
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");
609593
fossil_free(zThreadTitle);
610594
return 0;
611595
}
612596
613597
/*
614598
--- 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 @@
577577
/*
578578
** Add an appropriate style_header() to include title of the
579579
** given forum post.
580580
*/
581581
static int forumthread_page_header(int froot, int fpid){
582
- Blob title;
583
- int mxForumPostTitleLen = 50;
584
- char *zThreadTitle = "";
582
+ char *zThreadTitle = 0;
585583
586584
zThreadTitle = db_text("",
587585
"SELECT"
588586
" substr(event.comment,instr(event.comment,':')+2)"
589587
" FROM forumpost, event"
590588
" WHERE event.objid=forumpost.fpid"
591589
" AND forumpost.fpid=%d;",
592590
fpid
593591
);
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");
609593
fossil_free(zThreadTitle);
610594
return 0;
611595
}
612596
613597
/*
614598
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button