Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Move TkObjIsEmpty() implemention from tkConfig.c to tkText.c, so it can be re-used by rtext. Add support for TIP#698 (again, so it can be used by revised_text as well) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | revised_text | tip-466 |
Files: | files | file ages | folders |
SHA3-256: |
68fa9a67c0f027f0d935fed75dfa1a91 |
User & Date: | jan.nijtmans 2025-02-22 17:38:00.087 |
Original Comment: | More TkObjIsEmpty() implemention from tkConfig.c to tkText.c, so it can be re-used by revised_text. Add support for TIP#698 (again, so it can be used by revised_text as well) |
Context
2025-02-23
| ||
00:53 | Previous commit was almost right, just the wrong file ... check-in: 1ad1323e user: jan.nijtmans tags: revised_text, tip-466 | |
2025-02-22
| ||
17:38 | Move TkObjIsEmpty() implemention from tkConfig.c to tkText.c, so it can be re-used by rtext. Add support for TIP#698 (again, so it can be used by revised_text as well) check-in: 68fa9a67 user: jan.nijtmans tags: revised_text, tip-466 | |
2025-02-21
| ||
16:45 | Merge 9.0 check-in: 91066fc0 user: jan.nijtmans tags: revised_text, tip-466 | |
Changes
Changes to generic/tkConfig.c.
︙ | ︙ | |||
1084 1085 1086 1087 1088 1089 1090 | *slotPtrPtr = valuePtr; if (valuePtr != NULL) { Tcl_IncrRefCount(valuePtr); } } return TCL_OK; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 | *slotPtrPtr = valuePtr; if (valuePtr != NULL) { Tcl_IncrRefCount(valuePtr); } } return TCL_OK; } /* *---------------------------------------------------------------------- * * GetOption -- * * This function searches through a chained option table to find the |
︙ | ︙ |
Changes to generic/tkText.c.
︙ | ︙ | |||
16 17 18 19 20 21 22 | */ #include "tkInt.h" #include "tkText.h" #include "tkTextUndo.h" #include "tkTextTagSet.h" #include "tkBitField.h" | < < | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | */ #include "tkInt.h" #include "tkText.h" #include "tkTextUndo.h" #include "tkTextTagSet.h" #include "tkBitField.h" #include "tkFont.h" #include <stdlib.h> #include <assert.h> #include "default.h" /* needed for strncasecmp */ #if defined(_WIN32) && !defined(__GNUC__) # define strncasecmp _strnicmp |
︙ | ︙ | |||
198 199 200 201 202 203 204 205 206 207 208 209 210 211 | 0 }; /* * Information used to parse text configuration options: */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BOOLEAN, "-autoseparators", "autoSeparators", "AutoSeparators", DEF_TEXT_AUTO_SEPARATORS, TCL_INDEX_NONE, offsetof(TkText, autoSeparators), TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_TEXT_BG_COLOR, TCL_INDEX_NONE, offsetof(TkText, border), 0, DEF_TEXT_BG_MONO, TK_TEXT_LINE_REDRAW}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, | > > > > | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | 0 }; /* * Information used to parse text configuration options: */ #ifndef TK_OPTION_NEG_OK # define TK_OPTION_NEG_OK (1 << 6) #endif /* TK_OPTION_NEG_OK */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BOOLEAN, "-autoseparators", "autoSeparators", "AutoSeparators", DEF_TEXT_AUTO_SEPARATORS, TCL_INDEX_NONE, offsetof(TkText, autoSeparators), TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_TEXT_BG_COLOR, TCL_INDEX_NONE, offsetof(TkText, border), 0, DEF_TEXT_BG_MONO, TK_TEXT_LINE_REDRAW}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, |
︙ | ︙ | |||
284 285 286 287 288 289 290 | {TK_OPTION_INT, "-maxundo", "maxUndo", "MaxUndo", DEF_TEXT_MAX_UNDO, TCL_INDEX_NONE, offsetof(TkText, maxUndoDepth), TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_INT, "-maxundosize", "maxUndoSize", "MaxUndoSize", DEF_TEXT_MAX_UNDO, TCL_INDEX_NONE, offsetof(TkText, maxUndoSize), TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_INT, "-maxredo", "maxRedo", "MaxRedo", "TCL_INDEX_NONE", TCL_INDEX_NONE, offsetof(TkText, maxRedoDepth), TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", | | | | 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | {TK_OPTION_INT, "-maxundo", "maxUndo", "MaxUndo", DEF_TEXT_MAX_UNDO, TCL_INDEX_NONE, offsetof(TkText, maxUndoDepth), TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_INT, "-maxundosize", "maxUndoSize", "MaxUndoSize", DEF_TEXT_MAX_UNDO, TCL_INDEX_NONE, offsetof(TkText, maxUndoSize), TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_INT, "-maxredo", "maxRedo", "MaxRedo", "TCL_INDEX_NONE", TCL_INDEX_NONE, offsetof(TkText, maxRedoDepth), TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", DEF_TEXT_PADX, TCL_INDEX_NONE, offsetof(TkText, padX), TK_OPTION_NEG_OK, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", DEF_TEXT_PADY, TCL_INDEX_NONE, offsetof(TkText, padY), TK_OPTION_NEG_OK, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_TEXT_RELIEF, TCL_INDEX_NONE, offsetof(TkText, relief), 0, 0, 0}, {TK_OPTION_INT, "-responsiveness", "responsiveness", "Responsiveness", "50", TCL_INDEX_NONE, offsetof(TkText, responsiveness), 0, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground", DEF_TEXT_SELECT_COLOR, TCL_INDEX_NONE, offsetof(TkText, selAttrs.border), 0, DEF_TEXT_SELECT_MONO, 0}, |
︙ | ︙ | |||
8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 | } Tcl_GuardedDecrRefCount(tuple); return !(textPtr->flags & DESTROYED) && TkBTreeEpoch(textPtr->sharedTextPtr->tree) == oldStateEpoch; } } /* *---------------------------------------------------------------------- * * TkTextInspectOptions -- * * Build information from option table for "inspect". * | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 | } Tcl_GuardedDecrRefCount(tuple); return !(textPtr->flags & DESTROYED) && TkBTreeEpoch(textPtr->sharedTextPtr->tree) == oldStateEpoch; } } /* *---------------------------------------------------------------------- * * TkObjIsEmpty -- * * This function tests whether the string value of an object is empty. * * Results: * The return value is 1 if the string value of objPtr has length zero, * and 0 otherwise. * * Side effects: * None. * *---------------------------------------------------------------------- */ #if defined(USE_TCL_STUBS) # undef Tcl_IsEmpty # define Tcl_IsEmpty \ ((int (*)(Tcl_Obj *))(void *)((&(tclStubsPtr->tcl_PkgProvideEx))[690])) #endif int TkObjIsEmpty( Tcl_Obj *objPtr) /* Object to test. May be NULL. */ { if (objPtr == NULL) { return 1; } if (objPtr->bytes == NULL) { #if defined(USE_TCL_STUBS) if (Tcl_IsEmpty) { return Tcl_IsEmpty(objPtr); } #endif Tcl_GetString(objPtr); } return (objPtr->length == 0); } /* *---------------------------------------------------------------------- * * TkTextInspectOptions -- * * Build information from option table for "inspect". * |
︙ | ︙ |
Changes to generic/tkText.h.
︙ | ︙ | |||
1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 | #define INSPECT_INCLUDE_SYSTEM_COLORS (1 << 5) /* * Declarations for procedures that are used by the text-related files but * shouldn't be used anywhere else in Tk (or by Tk clients): */ inline TkSharedText * TkBTreeGetShared(TkTextBTree tree); inline int TkBTreeGetNumberOfDisplayLines(const TkTextPixelInfo *pixelInfo); MODULE_SCOPE void TkBTreeAdjustPixelHeight(const TkText *textPtr, TkTextLine *linePtr, int newPixelHeight, unsigned mergedLogicalLines, unsigned oldNumDispLines); MODULE_SCOPE void TkBTreeUpdatePixelHeights(const TkText *textPtr, TkTextLine *linePtr, int numLines, unsigned epoch); | > | 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 | #define INSPECT_INCLUDE_SYSTEM_COLORS (1 << 5) /* * Declarations for procedures that are used by the text-related files but * shouldn't be used anywhere else in Tk (or by Tk clients): */ MODULE_SCOPE int TkObjIsEmpty(Tcl_Obj *objPtr); inline TkSharedText * TkBTreeGetShared(TkTextBTree tree); inline int TkBTreeGetNumberOfDisplayLines(const TkTextPixelInfo *pixelInfo); MODULE_SCOPE void TkBTreeAdjustPixelHeight(const TkText *textPtr, TkTextLine *linePtr, int newPixelHeight, unsigned mergedLogicalLines, unsigned oldNumDispLines); MODULE_SCOPE void TkBTreeUpdatePixelHeights(const TkText *textPtr, TkTextLine *linePtr, int numLines, unsigned epoch); |
︙ | ︙ |
Changes to generic/tkTextTag.c.
︙ | ︙ | |||
37 38 39 40 41 42 43 44 45 46 47 48 49 50 | * the Text widget. These values are used as indices into the string table below. */ static const char *const justifyStrings[] = { "left", "right", "center", "full", NULL }; static const Tk_OptionSpec tagOptionSpecs[] = { {TK_OPTION_BORDER, "-background", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, attrs.border), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BITMAP, "-bgstipple", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, bgStipple), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", NULL, NULL, | > > > | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | * the Text widget. These values are used as indices into the string table below. */ static const char *const justifyStrings[] = { "left", "right", "center", "full", NULL }; #ifndef TK_OPTION_NEG_OK # define TK_OPTION_NEG_OK (1 << 6) #endif /* TK_OPTION_NEG_OK */ static const Tk_OptionSpec tagOptionSpecs[] = { {TK_OPTION_BORDER, "-background", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, attrs.border), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BITMAP, "-bgstipple", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, bgStipple), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", NULL, NULL, |
︙ | ︙ | |||
82 83 84 85 86 87 88 | {TK_OPTION_PIXELS, "-lmargin1", NULL, NULL, NULL, offsetof(TkTextTag, lMargin1Obj), offsetof(TkTextTag, lMargin1), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-lmargin2", NULL, NULL, NULL, offsetof(TkTextTag, lMargin2Obj), offsetof(TkTextTag, lMargin2), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BORDER, "-lmargincolor", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, lMarginColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-offset", NULL, NULL, | | | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | {TK_OPTION_PIXELS, "-lmargin1", NULL, NULL, NULL, offsetof(TkTextTag, lMargin1Obj), offsetof(TkTextTag, lMargin1), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-lmargin2", NULL, NULL, NULL, offsetof(TkTextTag, lMargin2Obj), offsetof(TkTextTag, lMargin2), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BORDER, "-lmargincolor", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, lMarginColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-offset", NULL, NULL, NULL, offsetof(TkTextTag, offsetObj), offsetof(TkTextTag, offset), TK_OPTION_NULL_OK|TK_OPTION_NEG_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-overstrike", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, overstrike), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-overstrikecolor", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, overstrikeColor), TK_OPTION_NULL_OK, 0, 0}, #if SUPPORT_DEPRECATED_TAG_OPTIONS {TK_OPTION_SYNONYM, "-overstrikefg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, TK_OPTION_NULL_OK, "-overstrikecolor", TK_TEXT_DEPRECATED_OVERSTRIKE_FG}, |
︙ | ︙ |