feat: implement end of line virtual text for the current line
This commit is contained in:
parent
1ac4e51932
commit
711aa58d40
2 changed files with 11 additions and 10 deletions
|
@ -201,15 +201,14 @@ impl EditorView {
|
|||
inline_diagnostic_config,
|
||||
config.end_of_line_diagnostics,
|
||||
));
|
||||
log::error!("{}", primary_cursor);
|
||||
// if config.vcs.blame {
|
||||
// decorations.add_decoration(text_decorations::blame::EolBlame::new(
|
||||
// doc,
|
||||
// theme,
|
||||
// primary_cursor,
|
||||
// "hello world".to_string(),
|
||||
// ));
|
||||
// }
|
||||
if config.vcs.blame {
|
||||
decorations.add_decoration(text_decorations::blame::EolBlame::new(
|
||||
doc,
|
||||
theme,
|
||||
doc.text().char_to_line(primary_cursor),
|
||||
"hello world".to_string(),
|
||||
));
|
||||
}
|
||||
render_document(
|
||||
surface,
|
||||
inner,
|
||||
|
|
|
@ -40,6 +40,9 @@ impl Decoration for EolBlame<'_> {
|
|||
pos: LinePos,
|
||||
virt_off: Position,
|
||||
) -> Position {
|
||||
if self.cursor != pos.doc_line {
|
||||
return Position::new(0, 0);
|
||||
}
|
||||
let row = pos.visual_line;
|
||||
let col = virt_off.col as u16;
|
||||
// if col != self.cursor as u16 {
|
||||
|
@ -67,7 +70,6 @@ impl Decoration for EolBlame<'_> {
|
|||
.0
|
||||
})
|
||||
.unwrap_or(start_col);
|
||||
log::error!("cursor: {}, row: {row}, col: {col}, start_col: {start_col}, draw_col: {draw_col}, end_col: {end_col}", self.cursor);
|
||||
|
||||
let col_off = end_col - start_col;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue