@@ -113,7 +113,7 @@ impl EditorView {
113113 // Set DAP highlights, if needed.
114114 if let Some ( frame) = editor. current_stack_frame ( ) {
115115 let dap_line = frame. line . saturating_sub ( 1 ) ;
116- let style = theme. get ( editor. mode , "ui.highlight.frameline" ) ;
116+ let style = theme. get ( editor. theme_context ( ) , "ui.highlight.frameline" ) ;
117117 let line_decoration = move |renderer : & mut TextRenderer , pos : LinePos | {
118118 if pos. doc_line != dap_line {
119119 return ;
@@ -200,7 +200,7 @@ impl EditorView {
200200 decorations. add_decoration ( InlineDiagnostics :: new (
201201 doc,
202202 theme,
203- editor. mode ,
203+ editor. theme_context ( ) ,
204204 primary_cursor,
205205 inline_diagnostic_config,
206206 config. end_of_line_diagnostics ,
@@ -221,7 +221,7 @@ impl EditorView {
221221 // if we're not at the edge of the screen, draw a right border
222222 if viewport. right ( ) != view. area . right ( ) {
223223 let x = area. right ( ) ;
224- let border_style = theme. get ( editor. mode , "ui.window" ) ;
224+ let border_style = theme. get ( editor. theme_context ( ) , "ui.window" ) ;
225225 for y in area. top ( ) ..area. bottom ( ) {
226226 surface[ ( x, y) ]
227227 . set_symbol ( tui:: symbols:: line:: VERTICAL )
@@ -257,7 +257,7 @@ impl EditorView {
257257 ) {
258258 let editor_rulers = & editor. config ( ) . rulers ;
259259 let ruler_theme = theme
260- . try_get ( editor. mode , "ui.virtual.ruler" )
260+ . try_get ( editor. theme_context ( ) , "ui.virtual.ruler" )
261261 . unwrap_or_else ( || Style :: default ( ) . bg ( Color :: Red ) ) ;
262262
263263 let rulers = doc
@@ -608,19 +608,27 @@ impl EditorView {
608608 viewport,
609609 editor
610610 . theme
611- . try_get ( editor. mode , "ui.bufferline.background" )
612- . unwrap_or_else ( || editor. theme . get ( editor. mode , "ui.statusline" ) ) ,
611+ . try_get ( editor. theme_context ( ) , "ui.bufferline.background" )
612+ . unwrap_or_else ( || editor. theme . get ( editor. theme_context ( ) , "ui.statusline" ) ) ,
613613 ) ;
614614
615615 let bufferline_active = editor
616616 . theme
617- . try_get ( editor. mode , "ui.bufferline.active" )
618- . unwrap_or_else ( || editor. theme . get ( editor. mode , "ui.statusline.active" ) ) ;
617+ . try_get ( editor. theme_context ( ) , "ui.bufferline.active" )
618+ . unwrap_or_else ( || {
619+ editor
620+ . theme
621+ . get ( editor. theme_context ( ) , "ui.statusline.active" )
622+ } ) ;
619623
620624 let bufferline_inactive = editor
621625 . theme
622- . try_get ( editor. mode , "ui.bufferline" )
623- . unwrap_or_else ( || editor. theme . get ( editor. mode , "ui.statusline.inactive" ) ) ;
626+ . try_get ( editor. theme_context ( ) , "ui.bufferline" )
627+ . unwrap_or_else ( || {
628+ editor
629+ . theme
630+ . get ( editor. theme_context ( ) , "ui.statusline.inactive" )
631+ } ) ;
624632
625633 let mut x = viewport. x ;
626634 let current_doc = view ! ( editor) . doc ;
@@ -672,10 +680,11 @@ impl EditorView {
672680
673681 let mut offset = 0 ;
674682
675- let gutter_style = theme. get ( editor. mode , "ui.gutter" ) ;
676- let gutter_selected_style = theme. get ( editor. mode , "ui.gutter.selected" ) ;
677- let gutter_style_virtual = theme. get ( editor. mode , "ui.gutter.virtual" ) ;
678- let gutter_selected_style_virtual = theme. get ( editor. mode , "ui.gutter.selected.virtual" ) ;
683+ let gutter_style = theme. get ( editor. theme_context ( ) , "ui.gutter" ) ;
684+ let gutter_selected_style = theme. get ( editor. theme_context ( ) , "ui.gutter.selected" ) ;
685+ let gutter_style_virtual = theme. get ( editor. theme_context ( ) , "ui.gutter.virtual" ) ;
686+ let gutter_selected_style_virtual =
687+ theme. get ( editor. theme_context ( ) , "ui.gutter.selected.virtual" ) ;
679688
680689 for gutter_type in view. gutters ( ) {
681690 let mut gutter = gutter_type. style ( editor, doc, view, theme, is_focused) ;
@@ -743,13 +752,13 @@ impl EditorView {
743752 diagnostic. range . start <= cursor && diagnostic. range . end >= cursor
744753 } ) ;
745754
746- let warning = theme. get ( editor. mode , "warning" ) ;
747- let error = theme. get ( editor. mode , "error" ) ;
748- let info = theme. get ( editor. mode , "info" ) ;
749- let hint = theme. get ( editor. mode , "hint" ) ;
755+ let warning = theme. get ( editor. theme_context ( ) , "warning" ) ;
756+ let error = theme. get ( editor. theme_context ( ) , "error" ) ;
757+ let info = theme. get ( editor. theme_context ( ) , "info" ) ;
758+ let hint = theme. get ( editor. theme_context ( ) , "hint" ) ;
750759
751760 let mut lines = Vec :: new ( ) ;
752- let background_style = theme. get ( editor. mode , "ui.background" ) ;
761+ let background_style = theme. get ( editor. theme_context ( ) , "ui.background" ) ;
753762 for diagnostic in diagnostics {
754763 let style = Style :: reset ( )
755764 . patch ( background_style)
@@ -806,8 +815,8 @@ impl EditorView {
806815 . map ( |range| range. cursor_line ( text) )
807816 . collect ( ) ;
808817
809- let primary_style = theme. get ( editor. mode , "ui.cursorline.primary" ) ;
810- let secondary_style = theme. get ( editor. mode , "ui.cursorline.secondary" ) ;
818+ let primary_style = theme. get ( editor. theme_context ( ) , "ui.cursorline.primary" ) ;
819+ let secondary_style = theme. get ( editor. theme_context ( ) , "ui.cursorline.secondary" ) ;
811820 let viewport = view. area ;
812821
813822 move |renderer : & mut TextRenderer , pos : LinePos | {
@@ -835,13 +844,13 @@ impl EditorView {
835844 // Manual fallback behaviour:
836845 // ui.cursorcolumn.{p/s} -> ui.cursorcolumn -> ui.cursorline.{p/s}
837846 let primary_style = theme
838- . try_get_exact ( editor. mode , "ui.cursorcolumn.primary" )
839- . or_else ( || theme. try_get_exact ( editor. mode , "ui.cursorcolumn" ) )
840- . unwrap_or_else ( || theme. get ( editor. mode , "ui.cursorline.primary" ) ) ;
847+ . try_get_exact ( editor. theme_context ( ) , "ui.cursorcolumn.primary" )
848+ . or_else ( || theme. try_get_exact ( editor. theme_context ( ) , "ui.cursorcolumn" ) )
849+ . unwrap_or_else ( || theme. get ( editor. theme_context ( ) , "ui.cursorline.primary" ) ) ;
841850 let secondary_style = theme
842- . try_get_exact ( editor. mode , "ui.cursorcolumn.secondary" )
843- . or_else ( || theme. try_get_exact ( editor. mode , "ui.cursorcolumn" ) )
844- . unwrap_or_else ( || theme. get ( editor. mode , "ui.cursorline.secondary" ) ) ;
851+ . try_get_exact ( editor. theme_context ( ) , "ui.cursorcolumn.secondary" )
852+ . or_else ( || theme. try_get_exact ( editor. theme_context ( ) , "ui.cursorcolumn" ) )
853+ . unwrap_or_else ( || theme. get ( editor. theme_context ( ) , "ui.cursorline.secondary" ) ) ;
845854
846855 let inner_area = view. inner_area ( doc) ;
847856
@@ -1541,7 +1550,12 @@ impl Component for EditorView {
15411550
15421551 fn render ( & mut self , area : Rect , surface : & mut Surface , cx : & mut Context ) {
15431552 // clear with background color
1544- surface. set_style ( area, cx. editor . theme . get ( cx. editor . mode , "ui.background" ) ) ;
1553+ surface. set_style (
1554+ area,
1555+ cx. editor
1556+ . theme
1557+ . get ( cx. editor . theme_context ( ) , "ui.background" ) ,
1558+ ) ;
15451559 let config = cx. editor . config ( ) ;
15461560
15471561 // check if bufferline should be rendered
@@ -1585,9 +1599,9 @@ impl Component for EditorView {
15851599 status_msg_width = status_msg. width ( ) ;
15861600 use helix_view:: editor:: Severity ;
15871601 let style = if * severity == Severity :: Error {
1588- cx. editor . theme . get ( cx. editor . mode , "error" )
1602+ cx. editor . theme . get ( cx. editor . theme_context ( ) , "error" )
15891603 } else {
1590- cx. editor . theme . get ( cx. editor . mode , "ui.text" )
1604+ cx. editor . theme . get ( cx. editor . theme_context ( ) , "ui.text" )
15911605 } ;
15921606
15931607 surface. set_string (
@@ -1609,7 +1623,7 @@ impl Component for EditorView {
16091623 for key in & self . pseudo_pending {
16101624 disp. push_str ( & key. key_sequence_format ( ) ) ;
16111625 }
1612- let style = cx. editor . theme . get ( cx. editor . mode , "ui.text" ) ;
1626+ let style = cx. editor . theme . get ( cx. editor . theme_context ( ) , "ui.text" ) ;
16131627 let macro_width = if cx. editor . macro_recording . is_some ( ) {
16141628 3
16151629 } else {
0 commit comments