Fossil SCM

Show the title of a forum thread without truncation.

ashepilko 2020-03-12 22:53 trunk
Commit 81d66a357d291213f56daf82c86498bdc2c33744a4ba3cea5aa3ded140684bad
1 file changed +2 -18
+2 -18
--- src/forum.c
+++ src/forum.c
@@ -536,37 +536,21 @@
536536
/*
537537
** Add an appropriate style_header() to include title of the
538538
** given forum post.
539539
*/
540540
static int forumthread_page_header(int froot, int fpid){
541
- Blob title;
542
- int mxForumPostTitleLen = 50;
543
- char *zThreadTitle = "";
541
+ char *zThreadTitle = 0;
544542
545543
zThreadTitle = db_text("",
546544
"SELECT"
547545
" substr(event.comment,instr(event.comment,':')+2)"
548546
" FROM forumpost, event"
549547
" WHERE event.objid=forumpost.fpid"
550548
" AND forumpost.fpid=%d;",
551549
fpid
552550
);
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");
568552
fossil_free(zThreadTitle);
569553
return 0;
570554
}
571555
572556
/*
573557
--- 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

Keyboard Shortcuts

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