&& ((s1)->sValuePtr->bgStipple == (s2)->sValuePtr->bgStipple))
/*
+ * The following macro is used to compare two floating-point numbers
+ * to within a certain degree of scale. Direct comparison fails on
+ * processors where the processor and memory representations of FP
+ * numbers of a particular precision is different (e.g. Intel)
+ */
+
+#define FP_EQUAL_SCALE(double1, double2, scaleFactor) \
+ (fabs((double1)-(double2))*((scaleFactor)+1.0) < 0.3)
+
+/*
* The following structure describes one line of the display, which may
* be either part or all of one line of the text.
*/
static void MeasureUp _ANSI_ARGS_((TkText *textPtr,
TkTextIndex *srcPtr, int distance,
TkTextIndex *dstPtr));
-static int NextTabStop _ANSI_ARGS_((TkText *textPtr, Tk_Font tkfont, int x,
+static int NextTabStop _ANSI_ARGS_((Tk_Font tkfont, int x,
int tabOrigin));
static void UpdateDisplayInfo _ANSI_ARGS_((TkText *textPtr));
static void ScrollByLines _ANSI_ARGS_((TkText *textPtr,
rightX = maxX;
}
if (chunkPtr->stylePtr->bgGC != None) {
+ /* Not visible - bail out now */
+ if (rightX + xOffset <= 0) {
+ leftX = rightX;
+ continue;
+ }
+
+ /*
+ * Trim the start position for drawing to be no further away than
+ * -borderWidth. The reason is that on many X servers drawing from
+ * -32768 (or less) to +something simply does not display
+ * correctly. [Patch #541999]
+ */
+ if ((leftX + xOffset) < -(sValuePtr->borderWidth)) {
+ leftX = -sValuePtr->borderWidth - xOffset;
+ }
+ if ((rightX - leftX) > 32767) {
+ rightX = leftX + 32767;
+ }
+
XFillRectangle(display, pixmap, chunkPtr->stylePtr->bgGC,
leftX + xOffset, 0, (unsigned int) (rightX - leftX),
(unsigned int) dlPtr->height);
TkText *textPtr; /* Information about text widget. */
Tcl_Interp *interp; /* Current interpreter. */
int argc; /* Number of arguments. */
- char **argv; /* Argument strings. Someone else has already
+ CONST char **argv; /* Argument strings. Someone else has already
* parsed this command enough to know that
* argv[1] is "see". */
{
TkText *textPtr; /* Information about text widget. */
Tcl_Interp *interp; /* Current interpreter. */
int argc; /* Number of arguments. */
- char **argv; /* Argument strings. Someone else has already
+ CONST char **argv; /* Argument strings. Someone else has already
* parsed this command enough to know that
* argv[1] is "xview". */
{
TkText *textPtr; /* Information about text widget. */
Tcl_Interp *interp; /* Current interpreter. */
int argc; /* Number of arguments. */
- char **argv; /* Argument strings. Someone else has already
+ CONST char **argv; /* Argument strings. Someone else has already
* parsed this command enough to know that
* argv[1] is "yview". */
{
register TkText *textPtr; /* Information about text widget. */
Tcl_Interp *interp; /* Current interpreter. */
int argc; /* Number of arguments. */
- char **argv; /* Argument strings. Someone else has already
+ CONST char **argv; /* Argument strings. Someone else has already
* parsed this command enough to know that
* argv[1] is "scan". */
{
* scrollbar if it has changed. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- char buffer[TCL_DOUBLE_SPACE * 2];
+ char buffer[TCL_DOUBLE_SPACE * 2 + 1];
double first, last;
int code;
Tcl_SetResult(interp, buffer, TCL_VOLATILE);
return;
}
- if ((first == dInfoPtr->xScrollFirst) && (last == dInfoPtr->xScrollLast)) {
+ if (FP_EQUAL_SCALE(first, dInfoPtr->xScrollFirst, dInfoPtr->maxLength) &&
+ FP_EQUAL_SCALE(last, dInfoPtr->xScrollLast, dInfoPtr->maxLength)) {
return;
}
dInfoPtr->xScrollFirst = first;
* scrollbar if it has changed. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- char buffer[TCL_DOUBLE_SPACE * 2];
+ char buffer[TCL_DOUBLE_SPACE * 2 + 1];
double first, last;
DLine *dlPtr;
int totalLines, code, count;
Tcl_SetResult(interp, buffer, TCL_VOLATILE);
return;
}
- if ((first == dInfoPtr->yScrollFirst) && (last == dInfoPtr->yScrollLast)) {
+ if (FP_EQUAL_SCALE(first, dInfoPtr->yScrollFirst, totalLines) &&
+ FP_EQUAL_SCALE(last, dInfoPtr->yScrollLast, totalLines)) {
return;
}
dInfoPtr->yScrollFirst = first;
*
* This procedure is the "layoutProc" for character segments.
*
-n * Results:
+ * Results:
* If there is something to display for the chunk then a
* non-zero value is returned and the fields of chunkPtr
* will be filled in (see the declaration of TkTextDispChunk
* interpretation of tabs.
*/
- desired = NextTabStop(textPtr, textPtr->tkfont, x, 0);
+ desired = NextTabStop(textPtr->tkfont, x, 0);
goto update;
}
TkTextTabAlign alignment;
if ((tabArrayPtr == NULL) || (tabArrayPtr->numTabs == 0)) {
- tabX = NextTabStop(textPtr, textPtr->tkfont, x, 0);
+ tabX = NextTabStop(textPtr->tkfont, x, 0);
return tabX - x;
}
if (index < tabArrayPtr->numTabs) {
*/
static int
-NextTabStop(textPtr, tkfont, x, tabOrigin)
- TkText *textPtr;
+NextTabStop(tkfont, x, tabOrigin)
Tk_Font tkfont; /* Font in which chunk that contains tab
* stop will be drawn. */
int x; /* X-position in pixels where last
{
int tabWidth, rem;
-#if 1
- tabWidth = Tk_TextWidth(tkfont, "0", 1) * textPtr->tabsize;
-#else
tabWidth = Tk_TextWidth(tkfont, "0", 1) * 8;
-#endif
if (tabWidth == 0) {
tabWidth = 1;
}
*nextXPtr = curX;
return start - source;
}
-