diff options
author | fvogel <fvogelnew1@free.fr> | 2016-10-09 18:23:41 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2016-10-09 18:23:41 (GMT) |
commit | 47ddcd1deb1c2db07e34e62d6f337b13efaaa9ad (patch) | |
tree | 6304d91e22e2efcd13280876b157502cc4deaf39 /generic/tkTextDisp.c | |
parent | cf08e658b359e7fa77150a04e08e85b4994a69c8 (diff) | |
parent | dd206481f5375b42c4add97e7b3dbf4f7caf357b (diff) | |
download | tk-47ddcd1deb1c2db07e34e62d6f337b13efaaa9ad.zip tk-47ddcd1deb1c2db07e34e62d6f337b13efaaa9ad.tar.gz tk-47ddcd1deb1c2db07e34e62d6f337b13efaaa9ad.tar.bz2 |
Fixed [1082213fff] - word wrapping should trim excess spaces
Diffstat (limited to 'generic/tkTextDisp.c')
-rw-r--r-- | generic/tkTextDisp.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index f28ec6a..2171cd0 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -7542,6 +7542,9 @@ TkTextCharLayoutProc( * (b) at least one pixel of the character is visible, we have not * already exceeded the character limit, and the next character is a * white space character. + * In the specific case of 'word' wrapping mode however, include all space + * characters following the characters that fit in the space we've got, + * even if no pixel of them is visible. */ p = segPtr->body.chars + byteOffset; @@ -7604,6 +7607,21 @@ TkTextCharLayoutProc( nextX = maxX; 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 current line. This gives + * the effect of trimming white spaces that would otherwise + * be seen at the beginning of wrapped lines. + * Note that testing for '\t' is useless here because the + * chunk always includes at most one trailing \t, see + * LayoutDLine. + */ + + bytesThatFit++; + } + } if (p[bytesThatFit] == '\n') { /* * A newline character takes up no space, so if the previous |