Fossil SCM

For the timeline command, fix special case where -n|-limit is 0 when using after keyword.

mgagnon 2025-05-08 11:11 trunk
Commit 6e3dde3afd437422917049629610913fea1c5acbcc64f13e9ac23bffa37e7d75
1 file changed +7 -1
+7 -1
--- src/timeline.c
+++ src/timeline.c
@@ -3816,13 +3816,19 @@
38163816
" AND (tagxref.value IS NULL OR tagxref.value='%q')",
38173817
zBr, zBr, zBr, TAG_BRANCH, zBr, zBr);
38183818
}
38193819
38203820
if( mode==TIMELINE_MODE_AFTER ){
3821
+ int lim = n;
3822
+ if( n == 0 ){
3823
+ lim = -1; // 0 means no limit
3824
+ }else if( n < 0 ){
3825
+ lim = -n;
3826
+ }
38213827
/* Complete the above outer select. */
38223828
blob_append_sql(&sql,
3823
- "\nORDER BY event.mtime LIMIT abs(%d)) t ORDER BY t.mDateTime DESC;", n);
3829
+ "\nORDER BY event.mtime LIMIT %d) t ORDER BY t.mDateTime DESC;", lim);
38243830
}else{
38253831
blob_append_sql(&sql, "\nORDER BY event.mtime DESC");
38263832
}
38273833
if( iOffset>0 ){
38283834
/* Don't handle LIMIT here, otherwise print_timeline()
38293835
--- src/timeline.c
+++ src/timeline.c
@@ -3816,13 +3816,19 @@
3816 " AND (tagxref.value IS NULL OR tagxref.value='%q')",
3817 zBr, zBr, zBr, TAG_BRANCH, zBr, zBr);
3818 }
3819
3820 if( mode==TIMELINE_MODE_AFTER ){
 
 
 
 
 
 
3821 /* Complete the above outer select. */
3822 blob_append_sql(&sql,
3823 "\nORDER BY event.mtime LIMIT abs(%d)) t ORDER BY t.mDateTime DESC;", n);
3824 }else{
3825 blob_append_sql(&sql, "\nORDER BY event.mtime DESC");
3826 }
3827 if( iOffset>0 ){
3828 /* Don't handle LIMIT here, otherwise print_timeline()
3829
--- src/timeline.c
+++ src/timeline.c
@@ -3816,13 +3816,19 @@
3816 " AND (tagxref.value IS NULL OR tagxref.value='%q')",
3817 zBr, zBr, zBr, TAG_BRANCH, zBr, zBr);
3818 }
3819
3820 if( mode==TIMELINE_MODE_AFTER ){
3821 int lim = n;
3822 if( n == 0 ){
3823 lim = -1; // 0 means no limit
3824 }else if( n < 0 ){
3825 lim = -n;
3826 }
3827 /* Complete the above outer select. */
3828 blob_append_sql(&sql,
3829 "\nORDER BY event.mtime LIMIT %d) t ORDER BY t.mDateTime DESC;", lim);
3830 }else{
3831 blob_append_sql(&sql, "\nORDER BY event.mtime DESC");
3832 }
3833 if( iOffset>0 ){
3834 /* Don't handle LIMIT here, otherwise print_timeline()
3835

Keyboard Shortcuts

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