From 68af94cf3e6a151d742ab3dac203d2d7d9bb0347 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Tue, 26 Aug 2025 18:28:16 +0100 Subject: [PATCH] Fix 7344dfe651: Hang when clicking on a link in a text file. (#14539) When text is not wrapped, a line's `wrapped_width` is 0, causing the Layouter to get stuck in an infinite loop. --- src/textfile_gui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/textfile_gui.cpp b/src/textfile_gui.cpp index f474ead9c9..75650c52ef 100644 --- a/src/textfile_gui.cpp +++ b/src/textfile_gui.cpp @@ -308,7 +308,7 @@ const TextfileWindow::Hyperlink *TextfileWindow::GetHyperlink(Point pt) const /* Build line layout to figure out character position that was clicked. */ const Line &line = this->lines[line_index]; - Layouter layout(line.text, line.wrapped_width, FS_MONO); + Layouter layout(line.text, line.wrapped_width == 0 ? INT32_MAX : line.wrapped_width, FS_MONO); assert(subline < layout.size()); ptrdiff_t char_index = layout.GetCharAtPosition(pt.x - WidgetDimensions::scaled.frametext.left, subline); if (char_index < 0) return nullptr;