From c5b90c42e5d068154fabc02c7b294203ced16e97 Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 28 Sep 2016 15:54:09 +0000 Subject: Fixed [1082213fff] - word wrapping should trim excess spaces --- generic/tkTextDisp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index a135084..892b935 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -7612,6 +7612,18 @@ TkTextCharLayoutProc( bytesThatFit++; } + if (wrapMode == TEXT_WRAPMODE_WORD) { + while (p[bytesThatFit] == ' ') { + /* + * Space characters that would go at the beginning of the + * next line are allocated to the present line. This gives + * the effect of trimming white spaces at the beginning of + * wrapped lines. + */ + + bytesThatFit++; + } + } if (bytesThatFit == 0) { #if TK_LAYOUT_WITH_BASE_CHUNKS chunkPtr->clientData = NULL; -- cgit v0.12