summaryrefslogtreecommitdiffstats
path: root/generic/tkTextWind.c
diff options
context:
space:
mode:
authorgcramer <remarcg@gmx.net>2017-08-15 14:03:18 (GMT)
committergcramer <remarcg@gmx.net>2017-08-15 14:03:18 (GMT)
commit0bb5211eb28452fdfaf9822892fa387db04b39e3 (patch)
tree767eaa94055c693370f7e55cae1bae447ac6d2a6 /generic/tkTextWind.c
parentd8c4b7332affeb6a7e404053e34b02dc037e5eca (diff)
downloadtk-0bb5211eb28452fdfaf9822892fa387db04b39e3.zip
tk-0bb5211eb28452fdfaf9822892fa387db04b39e3.tar.gz
tk-0bb5211eb28452fdfaf9822892fa387db04b39e3.tar.bz2
Bugfixes [bb22591148] [6a78781cc3] [0421e91b58]: Whole tab handling overworked, the old algorithm (from legacy text widget) did not work at all if line wrapping is involved. Any my previous commit with the attempt to fix the behavior with right justified tabs did not work at all, but now the right adjustment is working again. Under Linux all test cases are passing.
Diffstat (limited to 'generic/tkTextWind.c')
-rw-r--r--generic/tkTextWind.c51
1 files changed, 33 insertions, 18 deletions
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index 5305a28..372725d 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -1386,12 +1386,14 @@ EmbWinLayoutProc(
* TEXT_WRAPMODE_WORD, or TEXT_WRAPMODE_CODEPOINT. */
TkTextSpaceMode spaceMode, /* Not used. */
TkTextDispChunk *chunkPtr) /* Structure to fill in with information about this chunk. The x
- * field has already been set by the caller. */
+ * field has already been set by the caller. This argument may be
+ * NULL. */
{
int width, height;
TkTextEmbWindowClient *client;
TkText *textPtr = indexPtr->textPtr;
bool cantEmbed = false;
+ int x;
assert(indexPtr->textPtr);
assert(offset == 0);
@@ -1538,31 +1540,44 @@ EmbWinLayoutProc(
width = Tk_ReqWidth(ewPtr->body.ew.tkwin) + 2*ewPtr->body.ew.padX;
height = Tk_ReqHeight(ewPtr->body.ew.tkwin) + 2*ewPtr->body.ew.padY;
}
- if (width > maxX - chunkPtr->x && !noCharsYet && textPtr->wrapMode != TEXT_WRAPMODE_NONE) {
+
+ x = chunkPtr ? chunkPtr->x : 0;
+
+ if (width > maxX - x && !noCharsYet && textPtr->wrapMode != TEXT_WRAPMODE_NONE) {
return 0;
}
- /*
- * Fill in the chunk structure.
- */
+ if (chunkPtr) {
+ /*
+ * Fill in the chunk structure.
+ */
- chunkPtr->layoutProcs = &layoutWindowProcs;
- chunkPtr->numBytes = 1;
- if (ewPtr->body.ew.align == ALIGN_BASELINE) {
- chunkPtr->minAscent = height - ewPtr->body.ew.padY;
- chunkPtr->minDescent = ewPtr->body.ew.padY;
- chunkPtr->minHeight = 0;
- } else {
- chunkPtr->minAscent = 0;
- chunkPtr->minDescent = 0;
- chunkPtr->minHeight = height;
+ chunkPtr->layoutProcs = &layoutWindowProcs;
+ chunkPtr->numBytes = 1;
+ if (ewPtr->body.ew.align == ALIGN_BASELINE) {
+ chunkPtr->minAscent = height - ewPtr->body.ew.padY;
+ chunkPtr->minDescent = ewPtr->body.ew.padY;
+ chunkPtr->minHeight = 0;
+ } else {
+ chunkPtr->minAscent = 0;
+ chunkPtr->minDescent = 0;
+ chunkPtr->minHeight = height;
+ }
+ chunkPtr->width = width;
+ chunkPtr->breakIndex = (wrapMode == TEXT_WRAPMODE_NONE) ? -1 : 1;
+ chunkPtr->clientData = ewPtr;
}
- chunkPtr->width = width;
- chunkPtr->breakIndex = (wrapMode == TEXT_WRAPMODE_NONE) ? -1 : 1;
- chunkPtr->clientData = ewPtr;
+
if (client) {
client->chunkCount += 1;
+
+ if (!chunkPtr) {
+ TkTextDispChunk chunk;
+ chunk.clientData = ewPtr;
+ EmbWinUndisplayProc(textPtr, &chunk);
+ }
}
+
return 1;
}