@@ -81,6 +81,8 @@ pub struct LinePos {
8181 pub doc_line : usize ,
8282 /// Vertical offset from the top of the inner view area
8383 pub visual_line : u16 ,
84+ /// The given visual line is the last visual line of the document line
85+ pub is_last_visual_line : bool ,
8486}
8587
8688#[ allow( clippy:: too_many_arguments) ]
@@ -154,6 +156,7 @@ pub fn render_text(
154156 first_visual_line : false ,
155157 doc_line : usize:: MAX ,
156158 visual_line : u16:: MAX ,
159+ is_last_visual_line : true ,
157160 } ;
158161 let mut last_line_end = 0 ;
159162 let mut is_in_indent_area = true ;
@@ -188,6 +191,10 @@ pub fn render_text(
188191
189192 // apply decorations before rendering a new line
190193 if grapheme. visual_pos . row as u16 != last_line_pos. visual_line {
194+ if last_line_pos. doc_line == grapheme. line_idx {
195+ last_line_pos. is_last_visual_line = false ;
196+ }
197+
191198 // we initiate doc_line with usize::MAX because no file
192199 // can reach that size (memory allocations are limited to isize::MAX)
193200 // initially there is no "previous" line (so doc_line is set to usize::MAX)
@@ -202,6 +209,7 @@ pub fn render_text(
202209 first_visual_line : grapheme. line_idx != last_line_pos. doc_line ,
203210 doc_line : grapheme. line_idx ,
204211 visual_line : grapheme. visual_pos . row as u16 ,
212+ is_last_visual_line : true ,
205213 } ;
206214 decorations. decorate_line ( renderer, last_line_pos) ;
207215 }
0 commit comments