From e5e3532586b7da1393d26fbfedce0ca0c4ab73ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Tue, 18 Jun 2024 09:12:27 +0200 Subject: [PATCH] Added line decoration renderer. --- src/RadLine/ILineDecorationRenderer.cs | 7 +++++++ src/RadLine/LineEditor.cs | 3 +++ 2 files changed, 10 insertions(+) create mode 100644 src/RadLine/ILineDecorationRenderer.cs diff --git a/src/RadLine/ILineDecorationRenderer.cs b/src/RadLine/ILineDecorationRenderer.cs new file mode 100644 index 0000000..bc64216 --- /dev/null +++ b/src/RadLine/ILineDecorationRenderer.cs @@ -0,0 +1,7 @@ +namespace RadLine +{ + public interface ILineDecorationRenderer + { + void RenderLineDecoration(LineBuffer buffer); + } +} diff --git a/src/RadLine/LineEditor.cs b/src/RadLine/LineEditor.cs index 440688a..765abdd 100644 --- a/src/RadLine/LineEditor.cs +++ b/src/RadLine/LineEditor.cs @@ -26,6 +26,8 @@ public sealed class LineEditor : IHighlighterAccessor public IHighlighter? Highlighter { get; init; } public ILineEditorHistory History => _history; + public ILineDecorationRenderer? LineDecorationRenderer { get; init; } + public LineEditor(IAnsiConsole? terminal = null, IInputSource? source = null, IServiceProvider? provider = null) { _console = terminal ?? AnsiConsole.Console; @@ -185,6 +187,7 @@ public static bool IsSupported(IAnsiConsole console) // Render the line _renderer.RenderLine(state); + LineDecorationRenderer?.RenderLineDecoration(state.Buffer); } }