@@ -27,20 +27,35 @@ function splitByHighLightToken(search: SgSearch) {
2727 endIdx -= leadingSpaces
2828 }
2929 return {
30- index : [ startIdx , endIdx ] ,
31- displayLine
30+ startIdx,
31+ endIdx,
32+ displayLine,
33+ lineSpan : end . line - start . line
3234 }
3335}
3436
37+ // this is also hardcoded in vscode
38+ const lineIndicatorStyle = {
39+ margin : '0 7px 4px' ,
40+ opacity : '0.7' ,
41+ fontSize : '0.9em' ,
42+ verticalAlign : 'bottom'
43+ }
44+
45+ function MultiLineIndicator ( { lineSpan } : { lineSpan : number } ) {
46+ if ( lineSpan <= 0 ) {
47+ return null
48+ }
49+ return < span style = { lineIndicatorStyle } > +{ lineSpan } </ span >
50+ }
51+
3552interface CodeBlockProps {
3653 match : SgSearch
3754}
3855export const CodeBlock = ( { match } : CodeBlockProps ) => {
39- const { file } = match
40- const { index , displayLine } = splitByHighLightToken ( match )
56+ const { startIdx , endIdx , displayLine , lineSpan } =
57+ splitByHighLightToken ( match )
4158
42- const startIdx = index [ 0 ]
43- const endIdx = index [ 1 ]
4459 return (
4560 < Box
4661 flex = "1"
@@ -52,9 +67,10 @@ export const CodeBlock = ({ match }: CodeBlockProps) => {
5267 height = "22px"
5368 cursor = "pointer"
5469 onClick = { ( ) => {
55- openFile ( { filePath : file , locationsToSelect : match . range } )
70+ openFile ( { filePath : match . file , locationsToSelect : match . range } )
5671 } }
5772 >
73+ < MultiLineIndicator lineSpan = { lineSpan } />
5874 { displayLine . slice ( 0 , startIdx ) }
5975 < span style = { style } > { displayLine . slice ( startIdx , endIdx ) } </ span >
6076 { displayLine . slice ( endIdx ) }
0 commit comments