From a59e876622c28c1cf9a72ca6be6ea0bb08464044 Mon Sep 17 00:00:00 2001 From: Dmitry Popov Date: Thu, 3 Mar 2016 21:44:56 +0700 Subject: [PATCH] fix off-by-one error in SimpleTextFormatter line splitting where last char of last word was sent to next line --- src/dlangui/graphics/fonts.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dlangui/graphics/fonts.d b/src/dlangui/graphics/fonts.d index e01bcd53..7abd0f88 100644 --- a/src/dlangui/graphics/fonts.d +++ b/src/dlangui/graphics/fonts.d @@ -502,8 +502,8 @@ struct SimpleTextFormatter { if (ch == '\t' || ch == ' ') { // track last word end if (prevChar != '\t' && prevChar != ' ' && prevChar != 0) { - lastWordEnd = i - 1; - lastWordEndX = widths[i - 1]; + lastWordEnd = i; + lastWordEndX = widths[i]; } prevChar = ch; continue;