Fossil SCM
Enable keyboard navigation for web UI diffs on the new /ckout page. Restore the "Hide Diff" links (at least temporarily), so the keyboard handler can access the URLs.
Commit
9e216433bc12868d127ea9907425183ed34cbd901fb132b94f47daf01d8a68e4
Parent
edda30c66d22cfa…
1 file changed
+24
-2
+24
-2
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -614,10 +614,13 @@ | ||
| 614 | 614 | ** WEBPAGE: ckout |
| 615 | 615 | ** |
| 616 | 616 | ** Show information about the current checkout. This page only functions |
| 617 | 617 | ** if the web server is run on a loopback interface (in other words, was |
| 618 | 618 | ** started using "fossil ui" or similar) from with on open check-out. |
| 619 | +** | |
| 620 | +** See the help screen for the /vdiff web page for a list of available | |
| 621 | +** keyboard shortcuts. | |
| 619 | 622 | */ |
| 620 | 623 | void ckout_page(void){ |
| 621 | 624 | int vid; |
| 622 | 625 | char *zHostname; |
| 623 | 626 | char *zCwd; |
| @@ -677,15 +680,24 @@ | ||
| 677 | 680 | DCfg.diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG; |
| 678 | 681 | } |
| 679 | 682 | @ <hr> |
| 680 | 683 | @ <div class="sectionmenu info-changes-menu"> |
| 681 | 684 | zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; |
| 685 | + if( diffType!=0 ){ | |
| 686 | + /* Class "smb-hide-diff" required by the fossil.diff.js script. */ | |
| 687 | + const char *zBtnClass = "button smb-hide-diff"; | |
| 688 | + @ %z(chref(zBtnClass,"%R?diff=0"))Hide Diffs</a> | |
| 689 | + } | |
| 682 | 690 | if( diffType!=1 ){ |
| 683 | - @ %z(chref("button","%R?diff=1%s",zW))Unified Diff</a> | |
| 691 | + /* Class "smb-unified-diff" required by the fossil.diff.js script. */ | |
| 692 | + const char *zBtnClass = "button smb-unified-diff"; | |
| 693 | + @ %z(chref(zBtnClass,"%R?diff=1%s",zW))Unified Diff</a> | |
| 684 | 694 | } |
| 685 | 695 | if( diffType!=2 ){ |
| 686 | - @ %z(chref("button","%R?diff=2%s",zW))Side-by-Side Diff</a> | |
| 696 | + /* Class "smb-side-by-side-diff" required by the fossil.diff.js script. */ | |
| 697 | + const char *zBtnClass = "button smb-side-by-side-diff"; | |
| 698 | + @ %z(chref(zBtnClass,"%R?diff=2%s",zW))Side-by-Side Diff</a> | |
| 687 | 699 | } |
| 688 | 700 | if( diffType!=0 ){ |
| 689 | 701 | if( *zW ){ |
| 690 | 702 | @ %z(chref("button","%R?diff=%d",diffType))\ |
| 691 | 703 | @ Show Whitespace Changes</a> |
| @@ -783,10 +795,11 @@ | ||
| 783 | 795 | const char *zParent; /* Hash of the parent check-in (if any) */ |
| 784 | 796 | const char *zRe; /* regex parameter */ |
| 785 | 797 | ReCompiled *pRe = 0; /* regex */ |
| 786 | 798 | const char *zW; /* URL param for ignoring whitespace */ |
| 787 | 799 | const char *zPage = "vinfo"; /* Page that shows diffs */ |
| 800 | + const char *zPageHide = "ci"; /* Page that hides diffs */ | |
| 788 | 801 | const char *zBrName; /* Branch name */ |
| 789 | 802 | DiffConfig DCfg,*pCfg; /* Type of diff */ |
| 790 | 803 | |
| 791 | 804 | login_check_credentials(); |
| 792 | 805 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| @@ -1052,10 +1065,16 @@ | ||
| 1052 | 1065 | @ <div class="sectionmenu info-changes-menu"> |
| 1053 | 1066 | /* ^^^ .info-changes-menu is used by diff scroll sync */ |
| 1054 | 1067 | pCfg = construct_diff_flags(diffType, &DCfg); |
| 1055 | 1068 | DCfg.pRe = pRe; |
| 1056 | 1069 | zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; |
| 1070 | + if( diffType!=0 ){ | |
| 1071 | + /* Class "smb-hide-diff" required by the fossil.diff.js script. */ | |
| 1072 | + const char *zBtnClass = "button smb-hide-diff"; | |
| 1073 | + @ %z(chref(zBtnClass,"%R/%s/%T?diff=0",zPageHide,zName))\ | |
| 1074 | + @ Hide Diffs</a> | |
| 1075 | + } | |
| 1057 | 1076 | if( diffType!=1 ){ |
| 1058 | 1077 | /* Class "smb-unified-diff" required by the fossil.diff.js script. */ |
| 1059 | 1078 | const char *zBtnClass = "button smb-unified-diff"; |
| 1060 | 1079 | @ %z(chref(zBtnClass,"%R/%s/%T?diff=1%s",zPage,zName,zW))\ |
| 1061 | 1080 | @ Unified Diff</a> |
| @@ -1436,10 +1455,13 @@ | ||
| 1436 | 1455 | cgi_check_for_malice(); |
| 1437 | 1456 | style_set_current_feature("vdiff"); |
| 1438 | 1457 | if( zBranch==0 ){ |
| 1439 | 1458 | style_submenu_element("Path", "%R/timeline?me=%T&you=%T", zFrom, zTo); |
| 1440 | 1459 | } |
| 1460 | + if( diffType!=0 ){ | |
| 1461 | + style_submenu_element("Hide Diff", "%R/vdiff?diff=0&%b%b", &qp, &qpGlob); | |
| 1462 | + } | |
| 1441 | 1463 | if( diffType!=2 ){ |
| 1442 | 1464 | style_submenu_element("Side-by-Side Diff", "%R/vdiff?diff=2&%b%b", &qp, |
| 1443 | 1465 | &qpGlob); |
| 1444 | 1466 | } |
| 1445 | 1467 | if( diffType!=1 ) { |
| 1446 | 1468 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -614,10 +614,13 @@ | |
| 614 | ** WEBPAGE: ckout |
| 615 | ** |
| 616 | ** Show information about the current checkout. This page only functions |
| 617 | ** if the web server is run on a loopback interface (in other words, was |
| 618 | ** started using "fossil ui" or similar) from with on open check-out. |
| 619 | */ |
| 620 | void ckout_page(void){ |
| 621 | int vid; |
| 622 | char *zHostname; |
| 623 | char *zCwd; |
| @@ -677,15 +680,24 @@ | |
| 677 | DCfg.diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG; |
| 678 | } |
| 679 | @ <hr> |
| 680 | @ <div class="sectionmenu info-changes-menu"> |
| 681 | zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; |
| 682 | if( diffType!=1 ){ |
| 683 | @ %z(chref("button","%R?diff=1%s",zW))Unified Diff</a> |
| 684 | } |
| 685 | if( diffType!=2 ){ |
| 686 | @ %z(chref("button","%R?diff=2%s",zW))Side-by-Side Diff</a> |
| 687 | } |
| 688 | if( diffType!=0 ){ |
| 689 | if( *zW ){ |
| 690 | @ %z(chref("button","%R?diff=%d",diffType))\ |
| 691 | @ Show Whitespace Changes</a> |
| @@ -783,10 +795,11 @@ | |
| 783 | const char *zParent; /* Hash of the parent check-in (if any) */ |
| 784 | const char *zRe; /* regex parameter */ |
| 785 | ReCompiled *pRe = 0; /* regex */ |
| 786 | const char *zW; /* URL param for ignoring whitespace */ |
| 787 | const char *zPage = "vinfo"; /* Page that shows diffs */ |
| 788 | const char *zBrName; /* Branch name */ |
| 789 | DiffConfig DCfg,*pCfg; /* Type of diff */ |
| 790 | |
| 791 | login_check_credentials(); |
| 792 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| @@ -1052,10 +1065,16 @@ | |
| 1052 | @ <div class="sectionmenu info-changes-menu"> |
| 1053 | /* ^^^ .info-changes-menu is used by diff scroll sync */ |
| 1054 | pCfg = construct_diff_flags(diffType, &DCfg); |
| 1055 | DCfg.pRe = pRe; |
| 1056 | zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; |
| 1057 | if( diffType!=1 ){ |
| 1058 | /* Class "smb-unified-diff" required by the fossil.diff.js script. */ |
| 1059 | const char *zBtnClass = "button smb-unified-diff"; |
| 1060 | @ %z(chref(zBtnClass,"%R/%s/%T?diff=1%s",zPage,zName,zW))\ |
| 1061 | @ Unified Diff</a> |
| @@ -1436,10 +1455,13 @@ | |
| 1436 | cgi_check_for_malice(); |
| 1437 | style_set_current_feature("vdiff"); |
| 1438 | if( zBranch==0 ){ |
| 1439 | style_submenu_element("Path", "%R/timeline?me=%T&you=%T", zFrom, zTo); |
| 1440 | } |
| 1441 | if( diffType!=2 ){ |
| 1442 | style_submenu_element("Side-by-Side Diff", "%R/vdiff?diff=2&%b%b", &qp, |
| 1443 | &qpGlob); |
| 1444 | } |
| 1445 | if( diffType!=1 ) { |
| 1446 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -614,10 +614,13 @@ | |
| 614 | ** WEBPAGE: ckout |
| 615 | ** |
| 616 | ** Show information about the current checkout. This page only functions |
| 617 | ** if the web server is run on a loopback interface (in other words, was |
| 618 | ** started using "fossil ui" or similar) from with on open check-out. |
| 619 | ** |
| 620 | ** See the help screen for the /vdiff web page for a list of available |
| 621 | ** keyboard shortcuts. |
| 622 | */ |
| 623 | void ckout_page(void){ |
| 624 | int vid; |
| 625 | char *zHostname; |
| 626 | char *zCwd; |
| @@ -677,15 +680,24 @@ | |
| 680 | DCfg.diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG; |
| 681 | } |
| 682 | @ <hr> |
| 683 | @ <div class="sectionmenu info-changes-menu"> |
| 684 | zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; |
| 685 | if( diffType!=0 ){ |
| 686 | /* Class "smb-hide-diff" required by the fossil.diff.js script. */ |
| 687 | const char *zBtnClass = "button smb-hide-diff"; |
| 688 | @ %z(chref(zBtnClass,"%R?diff=0"))Hide Diffs</a> |
| 689 | } |
| 690 | if( diffType!=1 ){ |
| 691 | /* Class "smb-unified-diff" required by the fossil.diff.js script. */ |
| 692 | const char *zBtnClass = "button smb-unified-diff"; |
| 693 | @ %z(chref(zBtnClass,"%R?diff=1%s",zW))Unified Diff</a> |
| 694 | } |
| 695 | if( diffType!=2 ){ |
| 696 | /* Class "smb-side-by-side-diff" required by the fossil.diff.js script. */ |
| 697 | const char *zBtnClass = "button smb-side-by-side-diff"; |
| 698 | @ %z(chref(zBtnClass,"%R?diff=2%s",zW))Side-by-Side Diff</a> |
| 699 | } |
| 700 | if( diffType!=0 ){ |
| 701 | if( *zW ){ |
| 702 | @ %z(chref("button","%R?diff=%d",diffType))\ |
| 703 | @ Show Whitespace Changes</a> |
| @@ -783,10 +795,11 @@ | |
| 795 | const char *zParent; /* Hash of the parent check-in (if any) */ |
| 796 | const char *zRe; /* regex parameter */ |
| 797 | ReCompiled *pRe = 0; /* regex */ |
| 798 | const char *zW; /* URL param for ignoring whitespace */ |
| 799 | const char *zPage = "vinfo"; /* Page that shows diffs */ |
| 800 | const char *zPageHide = "ci"; /* Page that hides diffs */ |
| 801 | const char *zBrName; /* Branch name */ |
| 802 | DiffConfig DCfg,*pCfg; /* Type of diff */ |
| 803 | |
| 804 | login_check_credentials(); |
| 805 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| @@ -1052,10 +1065,16 @@ | |
| 1065 | @ <div class="sectionmenu info-changes-menu"> |
| 1066 | /* ^^^ .info-changes-menu is used by diff scroll sync */ |
| 1067 | pCfg = construct_diff_flags(diffType, &DCfg); |
| 1068 | DCfg.pRe = pRe; |
| 1069 | zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; |
| 1070 | if( diffType!=0 ){ |
| 1071 | /* Class "smb-hide-diff" required by the fossil.diff.js script. */ |
| 1072 | const char *zBtnClass = "button smb-hide-diff"; |
| 1073 | @ %z(chref(zBtnClass,"%R/%s/%T?diff=0",zPageHide,zName))\ |
| 1074 | @ Hide Diffs</a> |
| 1075 | } |
| 1076 | if( diffType!=1 ){ |
| 1077 | /* Class "smb-unified-diff" required by the fossil.diff.js script. */ |
| 1078 | const char *zBtnClass = "button smb-unified-diff"; |
| 1079 | @ %z(chref(zBtnClass,"%R/%s/%T?diff=1%s",zPage,zName,zW))\ |
| 1080 | @ Unified Diff</a> |
| @@ -1436,10 +1455,13 @@ | |
| 1455 | cgi_check_for_malice(); |
| 1456 | style_set_current_feature("vdiff"); |
| 1457 | if( zBranch==0 ){ |
| 1458 | style_submenu_element("Path", "%R/timeline?me=%T&you=%T", zFrom, zTo); |
| 1459 | } |
| 1460 | if( diffType!=0 ){ |
| 1461 | style_submenu_element("Hide Diff", "%R/vdiff?diff=0&%b%b", &qp, &qpGlob); |
| 1462 | } |
| 1463 | if( diffType!=2 ){ |
| 1464 | style_submenu_element("Side-by-Side Diff", "%R/vdiff?diff=2&%b%b", &qp, |
| 1465 | &qpGlob); |
| 1466 | } |
| 1467 | if( diffType!=1 ) { |
| 1468 |