git ssb

16+

cel / patchfoo



Commit d752aa18fb34928491e308a85286101b9f6e35e1

Make diff table more compact

cel committed on 3/28/2020, 5:55:47 PM
Parent: 4ee97dfaa67cc8ab77bbac574f0d05c6d60f4e37

Files changed

lib/render.jschanged
lib/serve.jschanged
static/styles.csschanged
lib/render.jsView
@@ -727,16 +727,17 @@
727727 var oldText = String(oldC.text || oldC.description || '')
728728 var newText = String(newC.text || newC.description || '')
729729 var diff = Diff.structuredPatch('', '', oldText, newText)
730730 var self = this
731- return h('table', [
731 + // note: this structure is duplicated in lib/render.js
732 + return h('table', {class: 'diff-table'}, [
732733 diff.hunks.map(function (hunk) {
733734 var oldLine = hunk.oldStart
734735 var newLine = hunk.newStart
735736 return [
736737 h('tr', [
737738 h('td', {colspan: 2}),
738- h('td', h('pre',
739 + h('td', {colspan: 2}, h('pre',
739740 '@@ -' + oldLine + ',' + hunk.oldLines + ' ' +
740741 '+' + newLine + ',' + hunk.newLines + ' @@'))
741742 ]),
742743 hunk.lines.map(function (line) {
@@ -749,10 +750,10 @@
749750 }, [
750751 lineNums.map(function (num, i) {
751752 return h('td', String(num))
752753 }),
753- h('td', {innerHTML:
754- h('code', s).outerHTML +
754 + h('td', {class: 'diff-sigil'}, h('code', s)),
755 + h('td', {class: 'diff-line'}, {innerHTML:
755756 u.unwrapP(self.markdown(line.substr(1),
756757 s == '-' ? oldC.mentions : newC.mentions))
757758 })
758759 ])
lib/serve.jsView
The diff is too large to show. Use a local git client to view these changes.
Old file size: 164546 bytes
New file size: 164693 bytes
static/styles.cssView
@@ -239,6 +239,10 @@
239239 .chess-square-dark {
240240 background-color: #ccc;
241241 }
242242
243 +.diff-line * {
244 + margin: 0;
245 +}
246 +
243247 .diff-old { background-color: #ffe2dd; }
244248 .diff-new { background-color: #d1ffd6; }

Built with git-ssb-web