浏览代码

LibGUI: Correct selection width when using fonts with glyph spacing

We were not adding the glyph spacing after the last character in the
selection, causing it to be slightly too small in some cases.
Andreas Kling 4 年之前
父节点
当前提交
f5384d7c70
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Libraries/LibGUI/TextEditor.cpp

+ 1 - 1
Libraries/LibGUI/TextEditor.cpp

@@ -1666,7 +1666,7 @@ void TextEditor::for_each_visual_line(size_t line_index, Callback callback) cons
         Gfx::IntRect visual_line_rect {
             visual_data.visual_rect.x(),
             visual_data.visual_rect.y() + ((int)visual_line_index * line_height()),
-            font().width(visual_line_view),
+            font().width(visual_line_view) + font().glyph_spacing(),
             line_height()
         };
         if (is_right_text_alignment(text_alignment()))