File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 116116 $start = 0
117117 foreach ($offsetAndLength in $_.OffsetAndLengths) {
118118 $offset, $length = $offsetAndLength
119- $out += $preview.Substring($start, $offset - $start) + "`e[43m`e[30m" + $preview.Substring($offset, $length) + "`e[0m"
120- $start += $offset + $length
119+ $out +=
120+ # Not highlighted
121+ $preview.Substring($start, $offset - $start) +
122+ "`e[43m`e[30m" +
123+ # Highlighted
124+ $preview.Substring($offset, $length) +
125+ "`e[0m"
126+ $start = $offset + $length
121127 }
122128 # Add rest
123129 if ($preview.Length -gt $start) {
124130 $out += $preview.Substring($start)
125131 }
126132 $out
127133 } catch {
128- Write-Warning -Message ( "Error highlighting matches: " + ($_ | Out-String))
134+ Write-Warning -Message "Error highlighting matches: $ ($_ | Out-String)`nPreview: $($result.Preview | ConvertTo-Json)`nOffsetAndLengths: $($result.OffsetAndLengths | ConvertTo-Json -Compress)"
129135 $result.Preview
130136 }
131137 </ScriptBlock >
You can’t perform that action at this time.
0 commit comments