@@ -4,9 +4,6 @@ package grid
44#cgo CFLAGS: -x objective-c
55#include "../bridge/overlay.h"
66#include <stdlib.h>
7-
8- // Explicit declaration to satisfy cgo name resolution
9- void drawScrollHighlight(OverlayWindow window, CGRect bounds, char* color, int width);
107*/
118import "C"
129
@@ -37,6 +34,19 @@ func (o *GridOverlay) UpdateConfig(cfg config.GridConfig) {
3734 o .cfg = cfg
3835}
3936
37+ // SetHideUnmatched sets whether to hide unmatched cells
38+ func (o * GridOverlay ) SetHideUnmatched (hide bool ) {
39+ C .setHideUnmatched (o .window , C .int (boolToInt (hide )))
40+ }
41+
42+ // boolToInt converts a boolean to an integer (1 for true, 0 for false)
43+ func boolToInt (b bool ) int {
44+ if b {
45+ return 1
46+ }
47+ return 0
48+ }
49+
4050// Show displays the grid overlay
4151func (o * GridOverlay ) Show () {
4252 C .showOverlayWindow (o .window )
@@ -138,6 +148,7 @@ func (o *GridOverlay) ShowSubgrid(cell *Cell) {
138148 size : C.CGSize {width : C .double (right - left ), height : C .double (bottom - top )},
139149 },
140150 isMatched : C .int (0 ),
151+ isSubgrid : C .int (1 ), // Mark as subgrid cell
141152 }
142153 }
143154
@@ -150,15 +161,17 @@ func (o *GridOverlay) ShowSubgrid(cell *Cell) {
150161 borderColor := C .CString (o .cfg .BorderColor )
151162
152163 style := C.GridCellStyle {
153- fontSize : C .int (o .cfg .FontSize ),
154- fontFamily : fontFamily ,
155- backgroundColor : backgroundColor ,
156- textColor : textColor ,
157- matchedTextColor : matchedTextColor ,
158- borderColor : borderColor ,
159- borderWidth : C .int (o .cfg .BorderWidth ),
160- backgroundOpacity : C .double (o .cfg .Opacity ),
161- textOpacity : C .double (1.0 ),
164+ fontSize : C .int (o .cfg .FontSize ),
165+ fontFamily : fontFamily ,
166+ backgroundColor : backgroundColor ,
167+ textColor : textColor ,
168+ matchedTextColor : matchedTextColor ,
169+ matchedBackgroundColor : matchedBackgroundColor ,
170+ matchedBorderColor : matchedBorderColor ,
171+ borderColor : borderColor ,
172+ borderWidth : C .int (o .cfg .BorderWidth ),
173+ backgroundOpacity : C .double (o .cfg .Opacity ),
174+ textOpacity : C .double (1.0 ),
162175 }
163176
164177 C .clearOverlay (o .window )
@@ -228,6 +241,7 @@ func (o *GridOverlay) drawGridCells(cellsGo []*Cell, currentInput string) {
228241 size : C.CGSize {width : C .double (cell .Bounds .Dx ()), height : C .double (cell .Bounds .Dy ())},
229242 },
230243 isMatched : C .int (isMatched ),
244+ isSubgrid : C .int (0 ), // Mark as regular grid cell
231245 }
232246 }
233247
@@ -240,15 +254,17 @@ func (o *GridOverlay) drawGridCells(cellsGo []*Cell, currentInput string) {
240254 borderColor := C .CString (o .cfg .BorderColor )
241255
242256 style := C.GridCellStyle {
243- fontSize : C .int (o .cfg .FontSize ),
244- fontFamily : fontFamily ,
245- backgroundColor : backgroundColor ,
246- textColor : textColor ,
247- matchedTextColor : matchedTextColor ,
248- borderColor : borderColor ,
249- borderWidth : C .int (o .cfg .BorderWidth ),
250- backgroundOpacity : C .double (o .cfg .Opacity ),
251- textOpacity : C .double (1.0 ),
257+ fontSize : C .int (o .cfg .FontSize ),
258+ fontFamily : fontFamily ,
259+ backgroundColor : backgroundColor ,
260+ textColor : textColor ,
261+ matchedTextColor : matchedTextColor ,
262+ matchedBackgroundColor : matchedBackgroundColor ,
263+ matchedBorderColor : matchedBorderColor ,
264+ borderColor : borderColor ,
265+ borderWidth : C .int (o .cfg .BorderWidth ),
266+ backgroundOpacity : C .double (o .cfg .Opacity ),
267+ textOpacity : C .double (1.0 ),
252268 }
253269
254270 C .drawGridCells (o .window , & cGridCells [0 ], C .int (len (cGridCells )), style )
0 commit comments