Fossil

Check-in [7703a5f7a3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Shortcut H to hop between the selected, current (check-out) and ticked entries.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | timeline-keyboard-navigation
Files: files | file ages | folders
SHA3-256: 7703a5f7a37560260bc443c14479dafa83dbe499ef78267999e59234ad757de7
User & Date: florian 2022-08-04 03:57:00.000
Context
2022-08-04
04:01
Remap the shortcut to disable keyboard navigation mode to ESC. This is also a test case for the high-priority ESC handlers of the timeline tooltip and the hamburger menu, and things seem to work fine. ... (check-in: 80085809ac user: florian tags: timeline-keyboard-navigation)
03:57
Shortcut H to hop between the selected, current (check-out) and ticked entries. ... (check-in: 7703a5f7a3 user: florian tags: timeline-keyboard-navigation)
03:51
Shortcuts B and SHIFT+B top copy the hash or branch name of the focused entry to clipboard. ... (check-in: f23a6d13a2 user: florian tags: timeline-keyboard-navigation)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/graph.js.
851
852
853
854
855
856
857












858
859
860
861
862
863
864
(function(){
  window.addEventListener('load',function(){
    function focusDefaultId(){
      var tn = document.querySelector('.timelineSelected .tl-nodemark') ||
                document.querySelector('.timelineCurrent .tl-nodemark');
      return tn ? tn.id : 'm1';
    }












    function focusFirstId(id){
      return 'm1';
    }
    function focusLastId(id){
      var el = document.getElementsByClassName('tl-nodemark');
      var tn = el ? el[el.length-1] : null;
      return tn ? tn.id : id;







>
>
>
>
>
>
>
>
>
>
>
>







851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
(function(){
  window.addEventListener('load',function(){
    function focusDefaultId(){
      var tn = document.querySelector('.timelineSelected .tl-nodemark') ||
                document.querySelector('.timelineCurrent .tl-nodemark');
      return tn ? tn.id : 'm1';
    }
    function focusSelectedId(){
      var tn = document.querySelector('.timelineSelected .tl-nodemark');
      return tn ? tn.id : null;
    }
    function focusCurrentId(){
      var tn = document.querySelector('.timelineCurrent .tl-nodemark');
      return tn ? tn.id : null;
    }
    function focusTickedId(){
      var nd = document.querySelector('.tl-node.sel');
      return nd ? 'm' + nd.id.slice(3) : null;
    }
    function focusFirstId(id){
      return 'm1';
    }
    function focusLastId(id){
      var el = document.getElementsByClassName('tl-nodemark');
      var tn = el ? el[el.length-1] : null;
      return tn ? tn.id : id;
928
929
930
931
932
933
934

935
936
937
938
939
940
941
942
943
944
945
946
947
948

949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966









967
968
969
970
971
972
973
974
      if( evt.target.tagName=='INPUT' ) return;
      var
        mSHIFT = 1<<13,
        kFRST = mSHIFT | 78 /* SHIFT+N */,
        kNEXT = 78 /* N */,
        kPREV = 77 /* M */,
        kLAST = mSHIFT | 77 /* SHIFT+M */,

        kTICK = 188 /* , */,
        kCPYH = 66 /* B */,
        kCPYB = mSHIFT | 66 /* SHIFT+B */,
        kTMLN = 74 /* J */,
        kVIEW = 75 /* K */,
        kDONE = 76 /* L */,
        mod = evt.altKey<<15 | evt.ctrlKey<<14 | evt.shiftKey<<13,
        key = ( evt.which || evt.keyCode ) | mod;
      var dx = 0;
      switch( key ){
        case kFRST: dx = -2; break;
        case kNEXT: dx = -1; break;
        case kPREV: dx = +1; break;
        case kLAST: dx = +2; break;

        case kTICK: break;
        case kCPYH: break;
        case kCPYB: break;
        case kTMLN: break;
        case kVIEW: break;
        case kDONE: break;
        default: return;
      }
      if( key==kDONE ){
        focusCacheSet(null);
        focusVisualize(null,false);
        document.cookie =
          'fossil_timeline_kbnav=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/';
        return;
      }
      document.cookie = 'fossil_timeline_kbnav=1;path=/';
      var id = focusCacheGet();
      if( id && dx==0 ){









        if( key==kTICK ){
          var gn = document.getElementById('tln'+id.slice(1));
          if( gn ) gn.click();
        }
        else if( key==kCPYH || key==kCPYB ){
          var ri = timelineGetRowInfo(id);
          if( ri ){
            copyTextToClipboard(







>














>


















>
>
>
>
>
>
>
>
>
|







940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
      if( evt.target.tagName=='INPUT' ) return;
      var
        mSHIFT = 1<<13,
        kFRST = mSHIFT | 78 /* SHIFT+N */,
        kNEXT = 78 /* N */,
        kPREV = 77 /* M */,
        kLAST = mSHIFT | 77 /* SHIFT+M */,
        kCYCL = 72 /* H */,
        kTICK = 188 /* , */,
        kCPYH = 66 /* B */,
        kCPYB = mSHIFT | 66 /* SHIFT+B */,
        kTMLN = 74 /* J */,
        kVIEW = 75 /* K */,
        kDONE = 76 /* L */,
        mod = evt.altKey<<15 | evt.ctrlKey<<14 | evt.shiftKey<<13,
        key = ( evt.which || evt.keyCode ) | mod;
      var dx = 0;
      switch( key ){
        case kFRST: dx = -2; break;
        case kNEXT: dx = -1; break;
        case kPREV: dx = +1; break;
        case kLAST: dx = +2; break;
        case kCYCL: break;
        case kTICK: break;
        case kCPYH: break;
        case kCPYB: break;
        case kTMLN: break;
        case kVIEW: break;
        case kDONE: break;
        default: return;
      }
      if( key==kDONE ){
        focusCacheSet(null);
        focusVisualize(null,false);
        document.cookie =
          'fossil_timeline_kbnav=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/';
        return;
      }
      document.cookie = 'fossil_timeline_kbnav=1;path=/';
      var id = focusCacheGet();
      if( id && dx==0 ){
        if( key==kCYCL ){
          var sel = focusSelectedId();
          var cur = focusCurrentId();
          var tik = focusTickedId();
          if( id==sel ) id = cur || tik || sel;
          else if( id==cur ) id = tik || sel || cur;
          else if( id==tik ) id = sel || cur || tik;
          else id = sel || cur || tik || id;
        }
        else if( key==kTICK ){
          var gn = document.getElementById('tln'+id.slice(1));
          if( gn ) gn.click();
        }
        else if( key==kCPYH || key==kCPYB ){
          var ri = timelineGetRowInfo(id);
          if( ri ){
            copyTextToClipboard(