Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/postcss/lib/css-syntax-error.js
rd565449 r0c6b92a 53 53 let css = this.source 54 54 if (color == null) color = pico.isColorSupported 55 if (terminalHighlight) { 56 if (color) css = terminalHighlight(css) 55 56 let aside = text => text 57 let mark = text => text 58 let highlight = text => text 59 if (color) { 60 let { bold, gray, red } = pico.createColors(true) 61 mark = text => bold(red(text)) 62 aside = text => gray(text) 63 if (terminalHighlight) { 64 highlight = text => terminalHighlight(text) 65 } 57 66 } 58 67 … … 60 69 let start = Math.max(this.line - 3, 0) 61 70 let end = Math.min(this.line + 2, lines.length) 62 63 71 let maxWidth = String(end).length 64 65 let mark, aside66 if (color) {67 let { bold, gray, red } = pico.createColors(true)68 mark = text => bold(red(text))69 aside = text => gray(text)70 } else {71 mark = aside = str => str72 }73 72 74 73 return lines … … 78 77 let gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | ' 79 78 if (number === this.line) { 79 if (line.length > 160) { 80 let padding = 20 81 let subLineStart = Math.max(0, this.column - padding) 82 let subLineEnd = Math.max( 83 this.column + padding, 84 this.endColumn + padding 85 ) 86 let subLine = line.slice(subLineStart, subLineEnd) 87 88 let spacing = 89 aside(gutter.replace(/\d/g, ' ')) + 90 line 91 .slice(0, Math.min(this.column - 1, padding - 1)) 92 .replace(/[^\t]/g, ' ') 93 94 return ( 95 mark('>') + 96 aside(gutter) + 97 highlight(subLine) + 98 '\n ' + 99 spacing + 100 mark('^') 101 ) 102 } 103 80 104 let spacing = 81 105 aside(gutter.replace(/\d/g, ' ')) + 82 106 line.slice(0, this.column - 1).replace(/[^\t]/g, ' ') 83 return mark('>') + aside(gutter) + line + '\n ' + spacing + mark('^') 107 108 return ( 109 mark('>') + 110 aside(gutter) + 111 highlight(line) + 112 '\n ' + 113 spacing + 114 mark('^') 115 ) 84 116 } 85 return ' ' + aside(gutter) + line 117 118 return ' ' + aside(gutter) + highlight(line) 86 119 }) 87 120 .join('\n')
Note:
See TracChangeset
for help on using the changeset viewer.