From b418672b14828cc0a6fed41d86b7f3e5f1c88718 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 6 Dec 2008 10:48:28 +0000 Subject: Implementation of TIP #197. --- ChangeLog | 13 ++++++ doc/text.n | 10 ++++- generic/tkText.c | 30 ++++++++++++-- generic/tkText.h | 18 +++++++- generic/tkTextMark.c | 67 ++++++++++++++++++++---------- macosx/tkMacOSXDefault.h | 3 +- tests/text.test | 104 ++++++++++++++++++++++++++--------------------- unix/tkUnixDefault.h | 3 +- win/tkWinDefault.h | 3 +- 9 files changed, 174 insertions(+), 77 deletions(-) diff --git a/ChangeLog b/ChangeLog index cad8740..3ead46a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2008-12-06 Donal K. Fellows + + TIP #197 IMPLEMENTATION + + * generic/tkText.c (insertUnfocussedStrings, optionSpecs): + * generic/tkText.h (TkText, TkTextInsertUnfocussed): + * doc/text.n, tests/text.test: + Added definitions/tests/docs for "-insertunfocussed" field. + * generic/tkTextMark.c (TkTextInsertDisplayProc): + * generic/tkText.c (TextBlinkProc): + Added user-controlledrendering of insertion cursor when focus is not + in the text widget. + 2008-12-05 Pat Thoyts * library/ttk/ttk.tcl: Added vista theme to iron out the visual diff --git a/doc/text.n b/doc/text.n index ad7129d..bef7aed 100644 --- a/doc/text.n +++ b/doc/text.n @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: text.n,v 1.57 2008/09/23 13:36:55 dkf Exp $ +'\" RCS: @(#) $Id: text.n,v 1.58 2008/12/06 10:48:29 dkf Exp $ '\" .so man.macros .TH text n 8.5 Tk "Tk Built-In Commands" @@ -51,6 +51,14 @@ font given by the \fB\-font\fR option. Must be at least one. Specifies the colour to use for the selection (the \fBsel\fR tag) when the window does not have the input focus. If empty, \fB{}\fR, then no selection is shown when the window does not have the focus. +.OP \-insertunfocussed insertUnfocussed InsertUnfocussed +.VS 8.6 +Specifies how to display the insertion cursor when the widget does not have +the focus. Must be \fBnone\fR (the default) which means to not display the +cursor, \fBhollow\fR which means to display a hollow box, or \fBsolid\fR which +means to display a solid box. Note that \fBhollow\fR and \fBsolid\fR will +appear very similar when the \fB\-blockcursor\fR option is false. +.VE 8.6 .OP \-maxundo maxUndo MaxUndo Specifies the maximum number of compound undo actions on the undo stack. A zero or a negative value imply an unlimited undo stack. diff --git a/generic/tkText.c b/generic/tkText.c index c2cc914..c04dae0 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkText.c,v 1.85 2008/11/27 23:47:09 ferrieux Exp $ + * RCS: @(#) $Id: tkText.c,v 1.86 2008/12/06 10:48:29 dkf Exp $ */ #include "default.h" @@ -75,6 +75,16 @@ static const char *const tabStyleStrings[] = { }; /* + * The 'TkTextInsertUnfocussed' enum in tkText.h is used to define a type for + * the -insertunfocussed option of the Text widget. These values are used as + * indice into the string table below. + */ + +static const char *const insertUnfocussedStrings[] = { + "hollow", "none", "solid", NULL +}; + +/* * The following functions and custom option type are used to define the * "line" option type, and thereby handle the text widget '-startline', * '-endline' configuration options which are of that type. @@ -177,6 +187,10 @@ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime", DEF_TEXT_INSERT_ON_TIME, -1, Tk_Offset(TkText, insertOnTime), 0, 0, 0}, + {TK_OPTION_STRING_TABLE, + "-insertunfocussed", "insertUnfocussed", "InsertUnfocussed", + DEF_TEXT_INSERT_UNFOCUSSED, -1, Tk_Offset(TkText, insertUnfocussed), + 0, (ClientData) insertUnfocussedStrings, 0}, {TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth", DEF_TEXT_INSERT_WIDTH, -1, Tk_Offset(TkText, insertWidth), 0, 0, 0}, @@ -2207,7 +2221,7 @@ ConfigureText( if (textPtr->flags & GOT_FOCUS) { Tcl_DeleteTimerHandler(textPtr->insertBlinkHandler); - textPtr->insertBlinkHandler = (Tcl_TimerToken) NULL; + textPtr->insertBlinkHandler = NULL; TextBlinkProc(textPtr); } @@ -2402,7 +2416,7 @@ TextEventProc( } } else { textPtr->flags &= ~(GOT_FOCUS | INSERT_ON); - textPtr->insertBlinkHandler = (Tcl_TimerToken) NULL; + textPtr->insertBlinkHandler = NULL; } if (textPtr->inactiveSelBorder != textPtr->selBorder) { TkTextRedrawTag(NULL, textPtr, NULL, NULL, textPtr->selTagPtr, @@ -3427,6 +3441,16 @@ TextBlinkProc( if ((textPtr->state == TK_TEXT_STATE_DISABLED) || !(textPtr->flags & GOT_FOCUS) || (textPtr->insertOffTime == 0)) { + if (!(textPtr->flags & GOT_FOCUS) && + (textPtr->insertUnfocussed != TK_TEXT_INSERT_NOFOCUS_NONE)) { + /* + * The widget doesn't have the focus yet it is configured to + * display the cursor when it doesn't have the focus. Act now! + */ + + textPtr->flags |= INSERT_ON; + goto redrawInsert; + } if ((textPtr->insertOffTime == 0) && !(textPtr->flags & INSERT_ON)) { /* * The widget was configured to have zero offtime while the diff --git a/generic/tkText.h b/generic/tkText.h index eb650ea..0a97630 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkText.h,v 1.35 2008/12/04 21:33:25 nijtmans Exp $ + * RCS: @(#) $Id: tkText.h,v 1.36 2008/12/06 10:48:29 dkf Exp $ */ #ifndef _TKTEXT @@ -579,6 +579,17 @@ typedef struct TkSharedText { } TkSharedText; /* + * The following enum is used to define a type for the -insertunfocussed + * option of the Text widget. + */ + +typedef enum { + TK_TEXT_INSERT_NOFOCUS_HOLLOW, + TK_TEXT_INSERT_NOFOCUS_NONE, + TK_TEXT_INSERT_NOFOCUS_SOLID +} TkTextInsertUnfocussed; + +/* * A data structure of the following type is kept for each text widget that * currently exists for this process: */ @@ -710,7 +721,10 @@ typedef struct TkText { Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion * cursor. */ int insertWidth; /* Total width of insert cursor. */ - int insertBorderWidth; /* Width of 3-D border around insert cursor. */ + int insertBorderWidth; /* Width of 3-D border around insert cursor */ + TkTextInsertUnfocussed insertUnfocussed; + /* How to display the insert cursor when the + * text widget does not have the focus. */ int insertOnTime; /* Number of milliseconds cursor should spend * in "on" state for each blink. */ int insertOffTime; /* Number of milliseconds cursor should spend diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c index d162c6f..4e483d8 100644 --- a/generic/tkTextMark.c +++ b/generic/tkTextMark.c @@ -10,11 +10,12 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTextMark.c,v 1.22 2008/10/17 23:18:37 nijtmans Exp $ + * RCS: @(#) $Id: tkTextMark.c,v 1.23 2008/12/06 10:48:29 dkf Exp $ */ #include "tkInt.h" #include "tkText.h" +#include "tk3d.h" /* * Macro that determines the size of a mark segment: @@ -145,7 +146,7 @@ TkTextMarkCmd( Tcl_GetString(objv[3]), "\"", NULL); return TCL_ERROR; } - markPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr); + markPtr = Tcl_GetHashValue(hPtr); } if (objc == 4) { if (markPtr->typePtr == &tkTextRightMarkType) { @@ -157,10 +158,10 @@ TkTextMarkCmd( } str = Tcl_GetStringFromObj(objv[4],&length); c = str[0]; - if ((c == 'l') && (strncmp(str, "left", (unsigned)length) == 0)) { + if ((c == 'l') && (strncmp(str, "left", (unsigned) length) == 0)) { newTypePtr = &tkTextLeftMarkType; } else if ((c == 'r') && - (strncmp(str, "right", (unsigned)length) == 0)) { + (strncmp(str, "right", (unsigned) length) == 0)) { newTypePtr = &tkTextRightMarkType; } else { Tcl_AppendResult(interp, "bad mark gravity \"", str, @@ -215,7 +216,7 @@ TkTextMarkCmd( hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable, Tcl_GetString(objv[i])); if (hPtr != NULL) { - markPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr); + markPtr = Tcl_GetHashValue(hPtr); /* * Special case not needed with peer widgets. @@ -276,7 +277,7 @@ TkTextSetMark( widgetSpecific = 0; hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->markTable, name, &isNew); - markPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr); + markPtr = Tcl_GetHashValue(hPtr); } if (!isNew) { /* @@ -289,7 +290,7 @@ TkTextSetMark( TkTextIndex index, index2; TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index); - TkTextIndexForwChars(NULL,&index, 1, &index2, COUNT_INDICES); + TkTextIndexForwChars(NULL, &index, 1, &index2, COUNT_INDICES); /* * While we wish to redisplay, no heights have changed, so no need @@ -298,8 +299,8 @@ TkTextSetMark( TkTextChanged(NULL, textPtr, &index, &index2); if (TkBTreeLinesTo(textPtr, indexPtr->linePtr) == - TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr)) { - TkTextIndexBackChars(NULL,indexPtr, 1, &insertIndex, + TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr)) { + TkTextIndexBackChars(NULL, indexPtr, 1, &insertIndex, COUNT_INDICES); indexPtr = &insertIndex; } @@ -330,7 +331,7 @@ TkTextSetMark( if (markPtr == textPtr->insertMarkPtr) { TkTextIndex index2; - TkTextIndexForwChars(NULL,indexPtr, 1, &index2, COUNT_INDICES); + TkTextIndexForwChars(NULL, indexPtr, 1, &index2, COUNT_INDICES); /* * While we wish to redisplay, no heights have changed, so no need to @@ -414,12 +415,13 @@ TkTextMarkNameToIndex( } else if (!strcmp(name, "current")) { segPtr = textPtr->currentMarkPtr; } else { - Tcl_HashEntry *hPtr; - hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable, name); + Tcl_HashEntry *hPtr = + Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable, name); + if (hPtr == NULL) { return TCL_ERROR; } - segPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr); + segPtr = Tcl_GetHashValue(hPtr); } TkTextMarkSegToIndex(textPtr, segPtr, indexPtr); return TCL_OK; @@ -586,7 +588,7 @@ TkTextInsertDisplayProc( int rightSideWidth; int ix = 0, iy = 0, iw = 0, ih = 0, charWidth = 0; - if(textPtr->insertCursorType) { + if (textPtr->insertCursorType) { TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index); TkTextIndexBbox(textPtr, &index, &ix, &iy, &iw, &ih, &charWidth); rightSideWidth = charWidth + halfWidth; @@ -614,14 +616,37 @@ TkTextInsertDisplayProc( * the cursor. */ - if (textPtr->flags & INSERT_ON) { + if (textPtr->flags & GOT_FOCUS) { + if (textPtr->flags & INSERT_ON) { + Tk_Fill3DRectangle(textPtr->tkwin, dst, textPtr->insertBorder, + x - halfWidth, y, charWidth + textPtr->insertWidth, + height, textPtr->insertBorderWidth, TK_RELIEF_RAISED); + } else if (textPtr->selBorder == textPtr->insertBorder) { + Tk_Fill3DRectangle(textPtr->tkwin, dst, textPtr->border, + x - halfWidth, y, charWidth + textPtr->insertWidth, + height, 0, TK_RELIEF_FLAT); + } + } else if (textPtr->insertUnfocussed == TK_TEXT_INSERT_NOFOCUS_HOLLOW) { + if (textPtr->insertBorderWidth < 1) { + /* + * Hack to work around the fact that a "solid" border always + * paints in black. + */ + + TkBorder *borderPtr = (TkBorder *) textPtr->insertBorder; + + XDrawRectangle(Tk_Display(textPtr->tkwin), dst, borderPtr->bgGC, + x - halfWidth, y, charWidth + textPtr->insertWidth - 1, + height - 1); + } else { + Tk_Draw3DRectangle(textPtr->tkwin, dst, textPtr->insertBorder, + x - halfWidth, y, charWidth + textPtr->insertWidth, + height, textPtr->insertBorderWidth, TK_RELIEF_RAISED); + } + } else if (textPtr->insertUnfocussed == TK_TEXT_INSERT_NOFOCUS_SOLID) { Tk_Fill3DRectangle(textPtr->tkwin, dst, textPtr->insertBorder, x - halfWidth, y, charWidth + textPtr->insertWidth, height, textPtr->insertBorderWidth, TK_RELIEF_RAISED); - } else if (textPtr->selBorder == textPtr->insertBorder) { - Tk_Fill3DRectangle(textPtr->tkwin, dst, textPtr->border, - x - halfWidth, y, charWidth + textPtr->insertWidth, height, - 0, TK_RELIEF_FLAT); } } @@ -750,7 +775,7 @@ MarkFindNext( * position. */ - segPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr); + segPtr = Tcl_GetHashValue(hPtr); TkTextMarkSegToIndex(textPtr, segPtr, &index); segPtr = segPtr->nextPtr; } else { @@ -848,7 +873,7 @@ MarkFindPrev( * position. */ - segPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr); + segPtr = Tcl_GetHashValue(hPtr); TkTextMarkSegToIndex(textPtr, segPtr, &index); } else { /* diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h index 931d591..cedbbcc 100644 --- a/macosx/tkMacOSXDefault.h +++ b/macosx/tkMacOSXDefault.h @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXDefault.h,v 1.16 2008/10/20 10:50:20 dkf Exp $ + * RCS: @(#) $Id: tkMacOSXDefault.h,v 1.17 2008/12/06 10:48:29 dkf Exp $ */ #ifndef _TKMACDEFAULT @@ -504,6 +504,7 @@ #define DEF_TEXT_INSERT_BD_MONO "0" #define DEF_TEXT_INSERT_OFF_TIME "300" #define DEF_TEXT_INSERT_ON_TIME "600" +#define DEF_TEXT_INSERT_UNFOCUSSED "none" #define DEF_TEXT_INSERT_WIDTH "1" #define DEF_TEXT_MAX_UNDO "0" #define DEF_TEXT_PADX "1" diff --git a/tests/text.test b/tests/text.test index 5709b33..896a997 100644 --- a/tests/text.test +++ b/tests/text.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: text.test,v 1.52 2008/11/12 16:38:13 patthoyts Exp $ +# RCS: @(#) $Id: text.test,v 1.53 2008/12/06 10:48:29 dkf Exp $ package require tcltest 2.2 eval tcltest::configure $argv @@ -20,8 +20,7 @@ wm withdraw . wm minsize . 1 1 wm positionfrom . user wm deiconify . - - + test text-1.1 {configuration option: "autoseparators"} -setup { text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold} pack .t @@ -782,7 +781,6 @@ test text-1.80 {configuration option: "wrap"} -setup { } -cleanup { destroy .t } -match glob -returnCodes {error} -result {*} - test text-1.81 {text options} -setup { text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold} pack .t @@ -813,6 +811,45 @@ test text-1.83 {text options} -setup { } -cleanup { destroy .t } -result {-yscrollcommand yScrollCommand ScrollCommand {} {test command}} +test text-1.83 {configuration option: "insertunfocussed"} -setup { + text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold} + pack .t + update +} -body { + .t configure -insertunfocussed none + .t cget -insertunfocussed +} -cleanup { + destroy .t +} -result none +test text-1.84 {configuration option: "insertunfocussed"} -setup { + text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold} + pack .t + update +} -body { + .t configure -insertunfocussed hollow + .t cget -insertunfocussed +} -cleanup { + destroy .t +} -result hollow +test text-1.85 {configuration option: "insertunfocussed"} -setup { + text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold} + pack .t + update +} -body { + .t configure -insertunfocussed solid + .t cget -insertunfocussed +} -cleanup { + destroy .t +} -result solid +test text-1.86 {configuration option: "insertunfocussed"} -setup { + text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold} + pack .t + update +} -returnCodes error -body { + .t configure -insertunfocussed gorp +} -cleanup { + destroy .t +} -result {bad insertunfocussed "gorp": must be hollow, none, or solid} test text-2.1 {Tk_TextCmd procedure} -body { @@ -843,7 +880,6 @@ test text-2.6 {Tk_TextCmd procedure} -body { } -cleanup { destroy .t } -result {2 red} - test text-2.7 {Tk_TextCmd procedure} -constraints { win } -body { @@ -871,7 +907,6 @@ test text-2.9 {Tk_TextCmd procedure} -constraints { } -cleanup { destroy .t } -result {raised} - test text-2.10 {Tk_TextCmd procedure} -body { list [text .t] [winfo class .t] } -cleanup { @@ -1249,7 +1284,6 @@ abcdefghijklm } -cleanup { destroy .t } -result {abcdefghijklm} - test text-8.10 {TextWidgetCmd procedure, "delete" option} -setup { text .t } -body { @@ -1346,7 +1380,6 @@ test text-8.17 {TextWidgetCmd procedure, "delete" option} -setup { destroy .t } -result {foo ghijklm} - test text-8.18 {TextWidgetCmd procedure, "replace" option} -setup { text .t } -body { @@ -1381,7 +1414,6 @@ Line 7" } -cleanup { destroy .t } -returnCodes ok -result {} - test text-8.21 {TextWidgetCmd procedure, "replace" option with undo} -setup { text .t } -body { @@ -1453,7 +1485,6 @@ Line 7" } -cleanup { destroy .t } -result {1} - test text-8.24 {TextWidgetCmd procedure, "replace" option with peers, undo} -setup { text .t } -body { @@ -1596,7 +1627,6 @@ Line 7" !@#$% Line 7 } - test text-9.8 {TextWidgetCmd procedure, "get" option} -setup { text .t } -body { @@ -1766,7 +1796,6 @@ Line 7" } -cleanup { destroy .t } -result {5.5} - test text-9.20 {TextWidgetCmd procedure, "get" option} -setup { text .t } -body { @@ -1881,7 +1910,6 @@ Line 7" } -cleanup { destroy .t } -result {5.1 5.1} - test text-9.27 {TextWidgetCmd procedure, "get" option} -setup { text .t } -body { @@ -2048,7 +2076,6 @@ Line 7" } -cleanup { destroy .t } -result {29} - test text-10.9 {TextWidgetCmd procedure, "count" option} -setup { text .t .t insert 1.0 "Line 1 @@ -2105,7 +2132,6 @@ Line 7" } -cleanup { destroy .t } -returnCodes {error} -result {bad text index "foo"} - test text-10.13 {TextWidgetCmd procedure, "count" option} -setup { text .t } -body { @@ -2155,7 +2181,6 @@ Line 7" } -cleanup { destroy .t } -result {5} - test text-10.16 {TextWidgetCmd procedure, "count" option} -setup { text .t } -body { @@ -2498,7 +2523,6 @@ Line 7" } -cleanup { destroy .t } -result {19} - test text-10.30 {TextWidgetCmd procedure, "count" option} -setup { text .t } -body { @@ -2986,7 +3010,6 @@ test text-14.6 {ConfigureText procedure} -setup { (while processing -tabs option) invoked from within ".t configure -tabs {30 foo}"} - test text-14.7 {ConfigureText procedure} -setup { text .t } -body { @@ -3109,7 +3132,6 @@ test text-14.17 {ConfigureText procedure} -body { } -cleanup { destroy .t .t2 } -result {1234} - test text-14.18 {ConfigureText procedure} -constraints fonts -setup { toplevel .top text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2 @@ -3122,11 +3144,11 @@ test text-14.18 {ConfigureText procedure} -constraints fonts -setup { } -cleanup { destroy .top } -result {150x140+} +# This test was failing Windows because the title bar on .t was a certain +# minimum size and it was interfering with the size requested by the -setgrid. +# The "overrideredirect" gets rid of the titlebar so the toplevel can shrink +# to the appropriate size. test text-14.19 {ConfigureText procedure} -setup { -# This test was failing Windows because the title bar on .t -# was a certain minimum size and it was interfering with the size -# requested by the -setgrid. The "overrideredirect" gets rid of the -# titlebar so the toplevel can shrink to the appropriate size. toplevel .top text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2 } -body { @@ -3139,12 +3161,11 @@ test text-14.19 {ConfigureText procedure} -setup { } -cleanup { destroy .top } -result {20x10+0+0} - +# This test was failing on Windows because the title bar on .t was a certain +# minimum size and it was interfering with the size requested by the -setgrid. +# The "overrideredirect" gets rid of the titlebar so the toplevel can shrink +# to the appropriate size. test text-14.20 {ConfigureText procedure} -setup { -# This test was failing on Windows because the title bar on .t -# was a certain minimum size and it was interfering with the size -# requested by the -setgrid. The "overrideredirect" gets rid of the -# titlebar so the toplevel can shrink to the appropriate size. toplevel .top text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2 } -body { @@ -3211,7 +3232,6 @@ test text-17.2 {TextCmdDeletedProc procedure, disabling -setgrid} -constraints { update set geom [wm geometry .top] set x [string range $geom 0 [string first + $geom]] - rename .top.t {} update set geom [wm geometry .top] @@ -3463,7 +3483,6 @@ test text-19.12 {DeleteChars procedure} -body { } -cleanup { destroy .top } -result {2.0 y} - test text-19.13 {DeleteChars procedure, updates affecting topIndex} -setup { toplevel .top text .top.t -width 1 -height 10 -wrap char @@ -3594,7 +3613,6 @@ test text-20.4 {TextFetchSelection procedure} -setup { destroy .t } -result {0a..1b.2b.3b.4 cj.0j.1j.2j.3j.4m} - test text-20.5 {TextFetchSelection procedure, long selections} -setup { text .t -width 20 -height 10 pack append . .t {top expand fill} @@ -3642,7 +3660,6 @@ test text-21.2 {TkTextLostSelection procedure} -constraints win -setup { } -cleanup { destroy .t .t2 } -result {1.2 3.3} - test text-21.3 {TkTextLostSelection procedure} -body { text .t .t insert 1.0 "abcdef\nghijk\n1234" @@ -3953,7 +3970,6 @@ test text-22.40 {TextSearchCmd procedure, regexp finds empty lines} -body { } -cleanup { destroy .t } -result {4.0} - test text-22.41 {TextSearchCmd procedure, firstChar and lastChar} -setup { toplevel .top text .top.t -width 30 -height 10 -font {Courier -12} -borderwidth 2 -highlightthickness 2 @@ -4032,7 +4048,6 @@ test text-22.46 {TextSearchCmd procedure, firstChar and lastChar} -setup { } -cleanup { destroy .top } -result {1.1} - test text-22.47 {TextSearchCmd procedure, firstChar and lastChar} -body { text .t .t insert end "xxyz xyz x. the\nfoo -forward bar xxxxx BaR foo\nxyz xxyzx" @@ -5679,7 +5694,6 @@ test text-24.10 {TextDumpCmd procedure, negative range} -body { } -cleanup { destroy .t } -result {} - test text-24.11 {TextDumpCmd procedure, stop at begin-line} -body { pack [text .t] .t insert end "Line One\nLine Two\nLine Three\nLine Four" @@ -5697,7 +5711,6 @@ test text-24.12 {TextDumpCmd procedure, span multiple lines} -body { } -result {text {One } 1.5 text {Line Two } 2.0 text {Line Three} 3.0} - test text-24.13 {TextDumpCmd procedure, tags only} -body { pack [text .t] .t insert end "Line One\nLine Two\nLine Three\nLine Four" @@ -5716,7 +5729,6 @@ test text-24.14 {TextDumpCmd procedure, tags only} -body { } -cleanup { destroy .t } -result {tagon x 2.0} - test text-24.15 {TextDumpCmd procedure, tags only} -body { pack [text .t] .t insert end "Line One\nLine Two\nLine Three\nLine Four" @@ -5735,7 +5747,6 @@ test text-24.16 {TextDumpCmd procedure, tags only} -body { } -cleanup { destroy .t } -result {tagon y 1.0 tagon x 2.0 tagoff x 2.8 tagoff y 5.0} - test text-24.17 {TextDumpCmd procedure, marks only} -body { pack [text .t] .t insert end "Line One\nLine Two\nLine Three\nLine Four" @@ -5784,7 +5795,6 @@ test text-24.20 {TextDumpCmd procedure, marks only} -body { } -cleanup { destroy .t } -result {mark current 1.0 mark insert 1.0 mark m 2.4 mark n 4.0 mark END 5.0} - test text-24.21 {TextDumpCmd procedure, windows only} -setup { pack [text .t] .t insert end "Line One\nLine Two\nLine Three\nLine Four" @@ -5809,7 +5819,6 @@ test text-24.22 {TextDumpCmd procedure, windows only} -setup { } -cleanup { destroy .t } -result {window {} 100.0} - test text-24.23 {TextDumpCmd procedure, command script} -setup { set x {} pack [text .t] @@ -5851,7 +5860,6 @@ test text-24.24 {TextDumpCmd procedure, command script} -setup { destroy .t rename Append {} } -result {mark 1.0 current mark 1.0 insert mark 2.4 m} - test text-24.25 {TextDumpCmd procedure, unicode characters} -body { text .t .t insert 1.0 \xb1\xb1\xb1 @@ -6442,7 +6450,6 @@ test text-31.19 {peer widgets} -body { test text-32.1 {line heights on creation} -setup { text .t - proc makeText {} { set w .g set font "Times 11" @@ -6450,8 +6457,9 @@ test text-32.1 {line heights on creation} -setup { toplevel .g frame $w.f -highlightthickness 2 -borderwidth 2 -relief sunken set t $w.f.text - text $t -yscrollcommand "$w.scroll set" -setgrid true -font $font -width 70 \ - -height 35 -wrap word -highlightthickness 0 -borderwidth 0 + text $t -yscrollcommand "$w.scroll set" -setgrid true -font $font \ + -width 70 -height 35 -wrap word -highlightthickness 0 \ + -borderwidth 0 pack $t -expand yes -fill both scrollbar $w.scroll -command "$t yview" pack $w.scroll -side right -fill y @@ -6666,7 +6674,6 @@ test text-36.1 "bug #1777362: event handling with hyphenated windows" -setup { } -cleanup { destroy .t-1 } -result {} - test text-36.2 "bug #1777362: event handling with hyphenated windows" -setup { proc bgerror {m} {set ::my_error $m} set ::my_error {} @@ -6680,7 +6687,6 @@ test text-36.2 "bug #1777362: event handling with hyphenated windows" -setup { } -cleanup { destroy $w } -result {} - test text-36.3 "bug #1777362: event handling with hyphenated windows" -setup { proc bgerror {m} {set ::my_error $m} set ::my_error {} @@ -6694,7 +6700,11 @@ test text-36.3 "bug #1777362: event handling with hyphenated windows" -setup { } -cleanup { destroy $w } -result {} - + # cleanup cleanupTests return + +# Local Variables: +# mode: tcl +# End: diff --git a/unix/tkUnixDefault.h b/unix/tkUnixDefault.h index 00d14cf..4056896 100644 --- a/unix/tkUnixDefault.h +++ b/unix/tkUnixDefault.h @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixDefault.h,v 1.27 2008/10/20 10:50:20 dkf Exp $ + * RCS: @(#) $Id: tkUnixDefault.h,v 1.28 2008/12/06 10:48:29 dkf Exp $ */ #ifndef _TKUNIXDEFAULT @@ -480,6 +480,7 @@ #define DEF_TEXT_INSERT_BD_MONO "0" #define DEF_TEXT_INSERT_OFF_TIME "300" #define DEF_TEXT_INSERT_ON_TIME "600" +#define DEF_TEXT_INSERT_UNFOCUSSED "none" #define DEF_TEXT_INSERT_WIDTH "2" #define DEF_TEXT_MAX_UNDO "0" #define DEF_TEXT_PADX "1" diff --git a/win/tkWinDefault.h b/win/tkWinDefault.h index 161919a..78bbc61 100644 --- a/win/tkWinDefault.h +++ b/win/tkWinDefault.h @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinDefault.h,v 1.25 2008/10/20 10:50:20 dkf Exp $ + * RCS: @(#) $Id: tkWinDefault.h,v 1.26 2008/12/06 10:48:29 dkf Exp $ */ #ifndef _TKWINDEFAULT @@ -483,6 +483,7 @@ #define DEF_TEXT_INSERT_BD_MONO "0" #define DEF_TEXT_INSERT_OFF_TIME "300" #define DEF_TEXT_INSERT_ON_TIME "600" +#define DEF_TEXT_INSERT_UNFOCUSSED "none" #define DEF_TEXT_INSERT_WIDTH "2" #define DEF_TEXT_MAX_UNDO "0" #define DEF_TEXT_PADX "1" -- cgit v0.12