diff --git a/src/tooltips.cpp b/src/tooltips.cpp index 8186ff2..ce7dec2 100644 --- a/src/tooltips.cpp +++ b/src/tooltips.cpp @@ -741,6 +741,11 @@ void Tooltip::insert_markdown(const std::string &input) { i += 5; continue; } + else if(starts_with(input, i, " \n")) { + partial += '\n'; + i += 2; + continue; + } else if(insert_code() || insert_emphasis() || insert_strikethrough() || insert_link()) continue; if(input[i] == '\n' && i + 1 < to) diff --git a/tests/tooltips_test.cpp b/tests/tooltips_test.cpp index 6a04118..cab3618 100644 --- a/tests/tooltips_test.cpp +++ b/tests/tooltips_test.cpp @@ -65,6 +65,10 @@ int main() { auto tooltip = get_markdown_tooltip("test  test"); g_assert(tooltip->buffer->get_text() == "test test"); } + { + auto tooltip = get_markdown_tooltip("test \ntest"); + g_assert(tooltip->buffer->get_text() == "test\ntest"); + } { auto tooltip = get_markdown_tooltip("test\n\n---\ntest"); g_assert(tooltip->buffer->get_text() == "test\n\n---\ntest");