@@ -25,7 +25,7 @@ use helix_core::{
2525use helix_view:: {
2626 annotations:: diagnostics:: DiagnosticFilter ,
2727 document:: { Mode , SCRATCH_BUFFER_NAME } ,
28- editor:: { CompleteAction , CursorShapeConfig , InlineBlameBehaviour } ,
28+ editor:: { CompleteAction , CursorShapeConfig , InlineBlameBehaviour , InlineBlameConfig } ,
2929 graphics:: { Color , CursorKind , Modifier , Rect , Style } ,
3030 input:: { KeyEvent , MouseButton , MouseEvent , MouseEventKind } ,
3131 keyboard:: { KeyCode , KeyModifiers } ,
@@ -204,21 +204,70 @@ impl EditorView {
204204 config. end_of_line_diagnostics ,
205205 ) ) ;
206206
207- if config. inline_blame . behaviour == InlineBlameBehaviour :: CursorLine {
207+ Self :: render_inline_blame ( & config. inline_blame , doc, view, & mut decorations, theme) ;
208+
209+ render_document (
210+ surface,
211+ inner,
212+ doc,
213+ view_offset,
214+ & text_annotations,
215+ syntax_highlights,
216+ overlay_highlights,
217+ theme,
218+ decorations,
219+ ) ;
220+
221+ // if we're not at the edge of the screen, draw a right border
222+ if viewport. right ( ) != view. area . right ( ) {
223+ let x = area. right ( ) ;
224+ let border_style = theme. get ( "ui.window" ) ;
225+ for y in area. top ( ) ..area. bottom ( ) {
226+ surface[ ( x, y) ]
227+ . set_symbol ( tui:: symbols:: line:: VERTICAL )
228+ //.set_symbol(" ")
229+ . set_style ( border_style) ;
230+ }
231+ }
232+
233+ if config. inline_diagnostics . disabled ( )
234+ && config. end_of_line_diagnostics == DiagnosticFilter :: Disable
235+ {
236+ Self :: render_diagnostics ( doc, view, inner, surface, theme) ;
237+ }
238+
239+ let statusline_area = view
240+ . area
241+ . clip_top ( view. area . height . saturating_sub ( 1 ) )
242+ . clip_bottom ( 1 ) ; // -1 from bottom to remove commandline
243+
244+ let mut context =
245+ statusline:: RenderContext :: new ( editor, doc, view, is_focused, & self . spinners ) ;
246+
247+ statusline:: render ( & mut context, statusline_area, surface) ;
248+ }
249+
250+ fn render_inline_blame (
251+ inline_blame : & InlineBlameConfig ,
252+ doc : & Document ,
253+ view : & View ,
254+ decorations : & mut DecorationManager ,
255+ theme : & Theme ,
256+ ) {
257+ if inline_blame. behaviour == InlineBlameBehaviour :: CursorLine {
208258 let cursor_line_idx = doc. cursor_line ( view. id ) ;
209259
210260 // do not render inline blame for empty lines to reduce visual noise
211261 if doc. text ( ) . line ( cursor_line_idx) != doc. line_ending . as_str ( ) {
212- if let Ok ( line_blame) =
213- doc. line_blame ( cursor_line_idx as u32 , & config. inline_blame . format )
262+ if let Ok ( line_blame) = doc. line_blame ( cursor_line_idx as u32 , & inline_blame. format )
214263 {
215264 decorations. add_decoration ( InlineBlame :: new (
216265 theme,
217266 text_decorations:: blame:: LineBlame :: OneLine ( ( cursor_line_idx, line_blame) ) ,
218267 ) ) ;
219268 } ;
220269 }
221- } else if config . inline_blame . behaviour == InlineBlameBehaviour :: AllLines {
270+ } else if inline_blame. behaviour == InlineBlameBehaviour :: AllLines {
222271 let text = doc. text ( ) ;
223272 let text_line_count = text. len_lines ( ) ;
224273 let view_height = view. inner_height ( ) ;
@@ -237,7 +286,7 @@ impl EditorView {
237286 let blame_for_all_lines = ( first_line..last_line) . filter_map ( |line_idx| {
238287 // do not render inline blame for empty lines to reduce visual noise
239288 if text. line ( line_idx) != doc. line_ending . as_str ( ) {
240- doc. line_blame ( line_idx as u32 , & config . inline_blame . format )
289+ doc. line_blame ( line_idx as u32 , & inline_blame. format )
241290 . ok ( )
242291 . map ( |blame| ( line_idx, blame) )
243292 } else {
@@ -253,46 +302,6 @@ impl EditorView {
253302 text_decorations:: blame:: LineBlame :: ManyLines ( blame_lines) ,
254303 ) ) ;
255304 }
256-
257- render_document (
258- surface,
259- inner,
260- doc,
261- view_offset,
262- & text_annotations,
263- syntax_highlights,
264- overlay_highlights,
265- theme,
266- decorations,
267- ) ;
268-
269- // if we're not at the edge of the screen, draw a right border
270- if viewport. right ( ) != view. area . right ( ) {
271- let x = area. right ( ) ;
272- let border_style = theme. get ( "ui.window" ) ;
273- for y in area. top ( ) ..area. bottom ( ) {
274- surface[ ( x, y) ]
275- . set_symbol ( tui:: symbols:: line:: VERTICAL )
276- //.set_symbol(" ")
277- . set_style ( border_style) ;
278- }
279- }
280-
281- if config. inline_diagnostics . disabled ( )
282- && config. end_of_line_diagnostics == DiagnosticFilter :: Disable
283- {
284- Self :: render_diagnostics ( doc, view, inner, surface, theme) ;
285- }
286-
287- let statusline_area = view
288- . area
289- . clip_top ( view. area . height . saturating_sub ( 1 ) )
290- . clip_bottom ( 1 ) ; // -1 from bottom to remove commandline
291-
292- let mut context =
293- statusline:: RenderContext :: new ( editor, doc, view, is_focused, & self . spinners ) ;
294-
295- statusline:: render ( & mut context, statusline_area, surface) ;
296305 }
297306
298307 pub fn render_rulers (
0 commit comments