HackStudio: Fix "navigate to include"

This fixes an off-by-one error in the "navigate to include" feature
of HackStudio.
This commit is contained in:
Itamar 2021-08-19 16:56:55 +03:00 committed by Andreas Kling
parent 9ae98bc81b
commit 43392c567e

View file

@ -565,11 +565,9 @@ void Editor::flush_file_content_to_langauge_server()
void Editor::on_navigatable_link_click(const GUI::TextDocumentSpan& span)
{
auto adjusted_range = span.range;
adjusted_range.end().set_column(adjusted_range.end().column() + 1);
auto span_text = document().text_in_range(adjusted_range);
auto span_text = document().text_in_range(span.range);
auto header_path = span_text.substring(1, span_text.length() - 2);
dbgln_if(EDITOR_DEBUG, "Ctrl+click: {} \"{}\"", adjusted_range, header_path);
dbgln_if(EDITOR_DEBUG, "Ctrl+click: {} \"{}\"", span.range, header_path);
navigate_to_include_if_available(header_path);
}