@@ -41,6 +41,7 @@ typedef struct {
4141 UiTermWin * selwin ; /* the currently selected layout */
4242 char info [MAX_WIDTH ]; /* info message displayed at the bottom of the screen */
4343 int width , height ; /* terminal dimensions available for all windows */
44+ int row , col ; /* active cursor's (0-based) position in the terminal */
4445 enum UiLayout layout ; /* whether windows are displayed horizontally or vertically */
4546 TermKey * termkey ; /* libtermkey instance to handle keyboard input (stdin or /dev/tty) */
4647 size_t ids ; /* bit mask of in use window ids */
@@ -372,8 +373,26 @@ static void ui_draw(Ui *ui) {
372373 debug ("ui-draw\n" );
373374 UiTerm * tui = (UiTerm * )ui ;
374375 ui_arrange (ui , tui -> layout );
375- for (UiTermWin * win = tui -> windows ; win ; win = win -> next )
376+ int dx = 0 , dy = 0 ;
377+ for (UiTermWin * win = tui -> windows ; win ; win = win -> next ) {
376378 ui_window_draw ((UiWin * )win );
379+ if (win == tui -> selwin || win -> win -> parent ) {
380+ View * view = win -> win -> view ;
381+ view_coord_get (view , view_cursor_get (view ), NULL , & tui -> row , & tui -> col );
382+ tui -> col += win -> sidebar_width ;
383+ tui -> row += dy ;
384+ if (!win -> win -> parent )
385+ tui -> col += dx ;
386+ else if (tui -> layout == UI_LAYOUT_VERTICAL )
387+ tui -> row += win -> prev -> height ;
388+ }
389+ if (tui -> layout == UI_LAYOUT_HORIZONTAL )
390+ dy += win -> height ;
391+ else if (win -> win -> parent )
392+ dy += win -> prev -> height ;
393+ else
394+ dx += win -> width + 1 ; /* +1 for the |'s */
395+ }
377396 if (tui -> info [0 ])
378397 ui_draw_string (tui , 0 , tui -> height - 1 , tui -> info , NULL , UI_STYLE_INFO );
379398 ui_term_backend_blit (tui );
@@ -556,6 +575,7 @@ static UiWin *ui_window_new(Ui *ui, Win *w, enum UiOption options) {
556575
557576 styles [UI_STYLE_CURSOR ].attr |= CELL_ATTR_REVERSE ;
558577 styles [UI_STYLE_CURSOR_PRIMARY ].attr |= CELL_ATTR_REVERSE |CELL_ATTR_BLINK ;
578+ styles [UI_STYLE_CURSOR_MATCHING ].attr |= CELL_ATTR_REVERSE ;
559579 styles [UI_STYLE_SELECTION ].attr |= CELL_ATTR_REVERSE ;
560580 styles [UI_STYLE_COLOR_COLUMN ].attr |= CELL_ATTR_REVERSE ;
561581 styles [UI_STYLE_STATUS ].attr |= CELL_ATTR_REVERSE ;
0 commit comments