Fossil

Check-in [abd3bca70e]
Login

Check-in [abd3bca70e]

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

Overview
Comment:Exempt diff line numbers and diff marks (separators) from text selections and have click-and-drag selection include only the most recently clicked side for side-by-side (split) diffs.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | diff-word-wrap
Files: files | file ages | folders
SHA3-256: abd3bca70ecb9ef3128297926c16fd751fffd32f30c13fdbe1786d47292f0e4f
User & Date: florian 2024-08-25 05:17:00.000
Context
2024-08-25
17:48
Change an assert() to a fossil_fatal() to make the error message appear in the web UI. ... (check-in: 3aad57dd7c user: florian tags: diff-word-wrap)
05:17
Exempt diff line numbers and diff marks (separators) from text selections and have click-and-drag selection include only the most recently clicked side for side-by-side (split) diffs. ... (check-in: abd3bca70e user: florian tags: diff-word-wrap)
2024-08-23
06:02
Remove 'display: inline-block' from insertion and deletion marks to get more natural word-wrapping. Try whether the previous, precisely calculated line height and padding values also work to extend the background color to the entire line height. ... (check-in: b912690fc4 user: florian tags: diff-word-wrap)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/default.css.
689
690
691
692
693
694
695






696
697
698
699
700
701
702
  background-color: #c0c0ff;
}
td.difftxt.ins ins {
  background-color: #a0e4b2;
}
td.difftxt.ins ins.edit {
  background-color: #c0c0ff;






}
body.tkt div.content li > table.udiff {
  margin-left: 1.5em;
  margin-top: 0.5em;
}
body.tkt div.content ol.tkt-changes > li:target > p > span {
  border-bottom: 3px solid gold;







>
>
>
>
>
>







689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
  background-color: #c0c0ff;
}
td.difftxt.ins ins {
  background-color: #a0e4b2;
}
td.difftxt.ins ins.edit {
  background-color: #c0c0ff;
}
table.diff td.diffln,
table.diff td.diffsep,
table.splitdiff.select_right td.difftxtl,
table.splitdiff.select_left td.difftxtr {
  user-select: none;
}
body.tkt div.content li > table.udiff {
  margin-left: 1.5em;
  margin-top: 0.5em;
}
body.tkt div.content ol.tkt-changes > li:target > p > span {
  border-bottom: 3px solid gold;
Changes to src/fossil.diff.js.
542
543
544
545
546
547
548






























        new ChunkLoadControls(D.addClass(tr, 'jchunk'));
      });
    });
    return F;
  };
  Diff.setupDiffContextLoad();
});





































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
        new ChunkLoadControls(D.addClass(tr, 'jchunk'));
      });
    });
    return F;
  };
  Diff.setupDiffContextLoad();
});
/* Click-handler for side-by-side diffs to activate text selection for the most
** recently clicked side (left or right). If the click-handler target is one of
** the simple-nested <del> or <ins> elements, the parent <td> is deciding. Note
** the "pointerdown" event seems to be exactly what is desired here: activating
** the clicked side just before the selection operation starts. */
(function(){
  window.addEventListener('load',function(){
    var s = document.getElementsByClassName('splitdiff');
    for( var i=0; i<s.length; i++ ){
      s[i].addEventListener('pointerdown',splitdiff_click);
    }
  });
  function splitdiff_click(e){
    var n = e.target.nodeName,
        t = n=='DEL' || n=='INS' ? e.target.parentElement : e.target;
    if( /\bdifftxtl\b/.test(t.className) ){
      var s = document.getElementsByClassName('splitdiff');
      for( var i=0; i<s.length; i++ ){
        s[i].classList.remove('select_right');
        s[i].classList.add('select_left');
      }
    }else if( /\bdifftxtr\b/.test(t.className) ){
      var s = document.getElementsByClassName('splitdiff');
      for( var i=0; i<s.length; i++ ){
        s[i].classList.remove('select_left');
        s[i].classList.add('select_right');
      }
    }
  }
}());