Fossil SCM

In /timeline, if "tl=" or similar contains a GLOB pattern, and no "ms=" is specified, default the match style to "glob" instead of "brlist".

drh 2024-12-24 14:47 trunk
Commit 1cfc5d6b4dcc29bf8453d4657f4ecd66879a82cda0a5df5551fd14f9d2c2a588
1 file changed +25 -12
+25 -12
--- src/timeline.c
+++ src/timeline.c
@@ -1813,23 +1813,29 @@
18131813
18141814
/* Check for tl=TAGLIST and rl=TAGLIST which are abbreviations for
18151815
** t=TAGLIST&ms=brlist and r=TAGLIST&ms=brlist repectively. */
18161816
if( zBrName==0 && zTagName==0 ){
18171817
const char *z;
1818
+ const char *zPattern = 0;
18181819
if( (z = P("tl"))!=0 ){
1819
- zTagName = z;
1820
- if( zMatchStyle==0 ) zMatchStyle = "brlist";
1821
- }else
1822
- if( (z = P("rl"))!=0 ){
1823
- zBrName = z;
1820
+ zPattern = zTagName = z;
1821
+ }else if( (z = P("rl"))!=0 ){
1822
+ zPattern = zBrName = z;
18241823
if( related==0 ) related = 1;
1825
- if( zMatchStyle==0 ) zMatchStyle = "brlist";
1826
- }else
1827
- if( (z = P("ml"))!=0 ){
1828
- zBrName = z;
1824
+ }else if( (z = P("ml"))!=0 ){
1825
+ zPattern = zBrName = z;
18291826
if( related==0 ) related = 2;
1830
- if( zMatchStyle==0 ) zMatchStyle = "brlist";
1827
+ }
1828
+ if( zPattern!=0 && zMatchStyle==0 ){
1829
+ /* If there was no ms= query parameter, set the match style to
1830
+ ** "glob" if the pattern appears to contain GLOB character, or
1831
+ ** "brlist" if it does not. */
1832
+ if( strpbrk(zPattern,"*[?") ){
1833
+ zMatchStyle = "glob";
1834
+ }else{
1835
+ zMatchStyle = "brlist";
1836
+ }
18311837
}
18321838
}
18331839
18341840
/* Convert r=TAG to t=TAG&rel in order to populate the UI style widgets. */
18351841
if( zBrName ){
@@ -2919,12 +2925,19 @@
29192925
@ &nbsp;&uarr;</a>
29202926
}
29212927
cgi_check_for_malice();
29222928
{
29232929
Matcher *pLeftBranch;
2924
- if( P("sl")!=0 ){
2925
- pLeftBranch = match_create(zMatchStyle?matchStyle:MS_BRLIST, P("sl"));
2930
+ const char *zPattern = P("sl");
2931
+ if( zPattern!=0 ){
2932
+ MatchStyle ms;
2933
+ if( zMatchStyle!=0 ){
2934
+ ms = matchStyle;
2935
+ }else{
2936
+ ms = strpbrk(zPattern,"*[?")!=0 ? MS_GLOB : MS_BRLIST;
2937
+ }
2938
+ pLeftBranch = match_create(ms,zPattern);
29262939
}else{
29272940
pLeftBranch = match_create(matchStyle, zBrName?zBrName:zTagName);
29282941
}
29292942
www_print_timeline(&q, tmFlags, zThisUser, zThisTag, pLeftBranch,
29302943
selectedRid, secondaryRid, 0);
29312944
--- src/timeline.c
+++ src/timeline.c
@@ -1813,23 +1813,29 @@
1813
1814 /* Check for tl=TAGLIST and rl=TAGLIST which are abbreviations for
1815 ** t=TAGLIST&ms=brlist and r=TAGLIST&ms=brlist repectively. */
1816 if( zBrName==0 && zTagName==0 ){
1817 const char *z;
 
1818 if( (z = P("tl"))!=0 ){
1819 zTagName = z;
1820 if( zMatchStyle==0 ) zMatchStyle = "brlist";
1821 }else
1822 if( (z = P("rl"))!=0 ){
1823 zBrName = z;
1824 if( related==0 ) related = 1;
1825 if( zMatchStyle==0 ) zMatchStyle = "brlist";
1826 }else
1827 if( (z = P("ml"))!=0 ){
1828 zBrName = z;
1829 if( related==0 ) related = 2;
1830 if( zMatchStyle==0 ) zMatchStyle = "brlist";
 
 
 
 
 
 
 
 
 
1831 }
1832 }
1833
1834 /* Convert r=TAG to t=TAG&rel in order to populate the UI style widgets. */
1835 if( zBrName ){
@@ -2919,12 +2925,19 @@
2919 @ &nbsp;&uarr;</a>
2920 }
2921 cgi_check_for_malice();
2922 {
2923 Matcher *pLeftBranch;
2924 if( P("sl")!=0 ){
2925 pLeftBranch = match_create(zMatchStyle?matchStyle:MS_BRLIST, P("sl"));
 
 
 
 
 
 
 
2926 }else{
2927 pLeftBranch = match_create(matchStyle, zBrName?zBrName:zTagName);
2928 }
2929 www_print_timeline(&q, tmFlags, zThisUser, zThisTag, pLeftBranch,
2930 selectedRid, secondaryRid, 0);
2931
--- src/timeline.c
+++ src/timeline.c
@@ -1813,23 +1813,29 @@
1813
1814 /* Check for tl=TAGLIST and rl=TAGLIST which are abbreviations for
1815 ** t=TAGLIST&ms=brlist and r=TAGLIST&ms=brlist repectively. */
1816 if( zBrName==0 && zTagName==0 ){
1817 const char *z;
1818 const char *zPattern = 0;
1819 if( (z = P("tl"))!=0 ){
1820 zPattern = zTagName = z;
1821 }else if( (z = P("rl"))!=0 ){
1822 zPattern = zBrName = z;
 
 
1823 if( related==0 ) related = 1;
1824 }else if( (z = P("ml"))!=0 ){
1825 zPattern = zBrName = z;
 
 
1826 if( related==0 ) related = 2;
1827 }
1828 if( zPattern!=0 && zMatchStyle==0 ){
1829 /* If there was no ms= query parameter, set the match style to
1830 ** "glob" if the pattern appears to contain GLOB character, or
1831 ** "brlist" if it does not. */
1832 if( strpbrk(zPattern,"*[?") ){
1833 zMatchStyle = "glob";
1834 }else{
1835 zMatchStyle = "brlist";
1836 }
1837 }
1838 }
1839
1840 /* Convert r=TAG to t=TAG&rel in order to populate the UI style widgets. */
1841 if( zBrName ){
@@ -2919,12 +2925,19 @@
2925 @ &nbsp;&uarr;</a>
2926 }
2927 cgi_check_for_malice();
2928 {
2929 Matcher *pLeftBranch;
2930 const char *zPattern = P("sl");
2931 if( zPattern!=0 ){
2932 MatchStyle ms;
2933 if( zMatchStyle!=0 ){
2934 ms = matchStyle;
2935 }else{
2936 ms = strpbrk(zPattern,"*[?")!=0 ? MS_GLOB : MS_BRLIST;
2937 }
2938 pLeftBranch = match_create(ms,zPattern);
2939 }else{
2940 pLeftBranch = match_create(matchStyle, zBrName?zBrName:zTagName);
2941 }
2942 www_print_timeline(&q, tmFlags, zThisUser, zThisTag, pLeftBranch,
2943 selectedRid, secondaryRid, 0);
2944

Keyboard Shortcuts

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