1717 @click.stop =" toggleSearchMatches()"
1818 >
1919 <div class =" title" >
20- <span class =" filename" >{{ filename + extension }}</span >
20+ <span class =" filename" >
21+ <span class =" name" >{{ filename }}</span ><span class =" extension" >{{extension}}</span >
22+ </span >
2123 <span class =" match-count" >{{ matchCount }}</span >
2224 </div >
2325 <!-- <div class="folder-path">
3133 >
3234 <ul >
3335 <li
36+ class =" text-overflow"
3437 v-for =" (searchMatch, index) of getMatches"
3538 :key =" index"
3639 :searchMatch =" searchMatch"
3740 :title =" searchMatch.lineText"
3841 @click =" handleSearchResultClick(searchMatch)"
3942 >
4043 <!-- <span class="line-number">{{ searchMatch.range[0][0] }}</span> -->
41- <span >{{ searchMatch.lineText.substring(0, searchMatch.range[0][1]) }}</span >
42- <span class =" ag- highlight" >{{ searchMatch.lineText.substring(searchMatch.range[0][1], searchMatch.range[1][1]) }}</span >
44+ <span >{{ ellipsisText( searchMatch.lineText.substring(0, searchMatch.range[0][1]) ) }}</span >
45+ <span class =" highlight" >{{ searchMatch.lineText.substring(searchMatch.range[0][1], searchMatch.range[1][1]) }}</span >
4346 <span >{{ searchMatch.lineText.substring(searchMatch.range[1][1]) }}</span >
4447 </li >
4548 </ul >
@@ -83,8 +86,7 @@ export default {
8386 }),
8487
8588 getMatches () {
86- if (this .searchResult .matches .length === 0 ||
87- this .allMatchesShown ) {
89+ if (this .searchResult .matches .length === 0 || this .allMatchesShown ) {
8890 return this .searchResult .matches
8991 }
9092 return this .searchResult .matches .slice (0 , this .shownMatches )
@@ -113,12 +115,19 @@ export default {
113115 toggleSearchMatches () {
114116 this .showSearchMatches = ! this .showSearchMatches
115117 },
118+
116119 handleShowMoreMatches (event ) {
117120 this .shownMatches += 15
118121 if (event .ctrlKey || event .metaKey ||
119122 this .shownMatches >= this .searchResult .matches .length ) {
120123 this .allMatchesShown = true
121124 }
125+ },
126+
127+ ellipsisText (text ) {
128+ const len = text .length
129+ const MAX_PRETEXT_LEN = 6
130+ return len > MAX_PRETEXT_LEN ? ` ...${ text .substring (len - MAX_PRETEXT_LEN )} ` : text
122131 }
123132 }
124133}
@@ -157,16 +166,19 @@ export default {
157166 display : block ;
158167 padding : 2px 16px ;
159168 padding-right : 0 ;
160- text-overflow : ellipsis ;
161- overflow : hidden ;
162169 cursor : pointer ;
163170 /* Hide space between inline spans */
164171 font-size : 0 ;
172+ & .highlight {
173+ background : var (--highlightColor );
174+ line-height : 16px ;
175+ height : 16px ;
176+ display : inline-block ;
177+ color : var (--sideBarTitleColor );
178+ border-radius : 1px ;
179+ }
165180 &:hover {
166181 background : var (--sideBarItemHoverBgColor );
167- },
168- & span :first-child {
169- margin-right : 3px ;
170182 }
171183 & span {
172184 font-size : 13px ;
@@ -195,6 +207,10 @@ export default {
195207 color : var (--sideBarTitleColor );
196208 & .filename {
197209 flex : 1 ;
210+ & .extension {
211+ color : var (--sideBarTextColor );
212+ font-size : 12px ;
213+ }
198214 }
199215 & .match-count {
200216 display : inline-block ;
@@ -206,12 +222,14 @@ export default {
206222 border-radius : 9px ;
207223 flex-shrink : 0 ;
208224 background : var (--itemBgColor );
209- color : var (--sideBarTextColor );
225+ color : var (--sideBarTitleColor );
210226 }
211227 }
228+
212229 .folder-path {
213230 font-size : 12px ;
214231 }
232+
215233 .folder-path > span ,
216234 .matches {
217235 width : 100% ;
0 commit comments