| Ticket UUID: | 2049429 | |||
| Title: | Some options aren't picked up from the options database | |||
| Type: | Bug | Version: | obsolete: 8.5.3 | |
| Submitter: | egavilan | Created on: | 2008-08-13 11:13:49 | |
| Subsystem: | 18. [text] | Assigned To: | fvogel | |
| Priority: | 6 | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2016-01-12 10:15:47 | |
| Resolution: | Fixed | Closed By: | jan.nijtmans | |
| Closed on: | 2016-01-12 10:15:47 | |||
| Description: |
The text widget ignore the value in the option database for certain options. Examples are -spacing[123]. This fact is not documented in the text manual page. After a bit of source diving, there's an option in the 'flags' field of the Tk_OptionSpec struct in tkText.c named TK_OPTION_DONT_SET_DEFAULT which prevents the value to be read form the option database (line 490 of tkConfig.c). This value is not documented in the Tk_SetOptions manual page, which states " At present only a single flag is supported: TK_OPTION_NULL_OK". There is also TK_CONFIG_NULL_OK in tkText.c, also not documented. | |||
| User Comments: |
jan.nijtmans added on 2016-01-12 10:15:47:
Fixed in trunk, cherry-picked to core-8-5-branch fvogel added on 2016-01-10 20:22:28: re: simplification - You loose fexibility of just changing a #define value in case it's needed some time in the future. - It adds changes not really related to the bug we're fixing. If later we find there is an issue with the fix for the present bug, it will be more difficult to distinguish changes relevant to the fix from unrelated changes, thus complicating the analysis. If simplification of the source code is a goal, why no simplifying elsewhere following the same lines, but then I really believe it should be done in a specific "simplification" branch. - That said, the change in question IS harmless wrt functionality. re: rebasing Well, my opinion is that the rebase of the fix for [1927212] went wrong because the automatic merge [93266946] to 8.6 seems to have worked without conflict in library/scrlbar.tcl (which is quite a surprise to me) and, above all, obviously because no test suite was run in the trunk branch before committing. Having said that, I understand your point (trunk first, backport to 8.5 optional) but, again, my understanding was that all this was to happen *after* the next releases. jan.nijtmans added on 2016-01-10 20:02:07: > why getting rid of DEF_TEXT_SPACING[123]? The plan is simplification, while keeping the same functionality. Of course, if this causes any unintended behaviour change, then it's a bad idea, but so far I didn't see anything bad happen. I'm not 100% sure yet, therefore I didn't commit it to trunk yet. Feedback welcome! If you (or anyone else) think it's a bad idea, please share your view. >why rebasing to 8.6? In order to see if it works there too. DGP wants to drop 8.5 rather sooner than later, so fixing anything in 8.6 is a must, backporting to 8.5 is optional. When fixing [1927212], the re-base to 8.6 went wrong because the scrollbar binding was already partially fixed there. Working on 8.6 as primary target would have helped there. fvogel added on 2016-01-10 18:46:22: Jan, I do not understand your latest commit on the bug branch: [dd92246a] Two questions: - why getting rid of DEF_TEXT_SPACING[123]? Sure they are "0" for all platforms, but what is the plan here? To remove the #define xxx "0" and replace them by NULL everywhere the option has TK_OPTION_NULL_OK? What is the purpose? - why rebasing to 8.6? My understanding of the TCT discussion on Tcl-Core was what DGP said, i.e. *after* 8.5.19 and 8.6.5. fvogel added on 2016-01-09 00:20:39: The case when TK_OPTION_DONT_SET_DEFAULT matters is when there is a .Xdefaults file in the user home directory. If that file defines the spacing, currently this spacing definition is ignored by the text widget. Using TK_OPTION_NULL_OK instead of TK_OPTION_DONT_SET_DEFAULT would change that behavior. But I can't see why we wouldn't want to propagate the settings from .Xdefaults to the text widget, so I think we should do it, or do I definitely miss something? jan.nijtmans added on 2016-01-09 00:06:41: I agree with your proposal to use TK_OPTION_NULL_OK here. If DKF doesn't understand why the spacing[123] options are ignored, you don't see a reason, and I don't see a reason either, there is no harm in changing that if the default is 0 anyway. So, just go ahead! fvogel added on 2016-01-08 23:46:22: Thanks for the review. Appreciated as well! Last thing to figure out regarding this ticket is why -spacing[123] have TK_OPTION_DONT_SET_DEFAULT set on them. With that flag set, Tk_InitOptions skips -spacing[123] when initializing the options values of the text widget. These values therefore are not changed from their original zero value received due to memset(textPtr, 0, sizeof(TkText)); For all platforms, DEF_TEXT_SPACING[123] are #defined to "0". I can't see why -spacing[123] shouldn't have TK_OPTION_NULL_OK instead of TK_OPTION_DONT_SET_DEFAULT. All this boils down to the same zero value in -spacing[123] anyway, except if the options database has different defaults. Why wouldn't we take these defaults and pass them to the text widget? jan.nijtmans added on 2016-01-08 23:34:13: Fix looks good to me. +1 for merging the branch to trunk and core-8-5-branch. Thanks, François for all your work on this! It is really appreciated! fvogel added on 2016-01-08 23:23:03: Regarding TK_CONFIG_NULL_OK: - This flag is already documented in ConfigWidg.3 - The fact that TK_CONFIG_NULL_OK is used in tkText.c is a mistake I believe. It was introduced in commit [8587f521] to allow -selectforeground option to be None in several widgets. At the time of this commit some widgets were not objectified, and as such required TK_CONFIG_NULL_OK, but the text widget was already objectified and required TK_OPTION_NULL_OK instead. Since both are #defined to (1 << 0) both flags worked, but this mistake is now corrected in branch bug-2049429fff (for the text widget, but also for the entry and listbox widgets, which all call Tk_InitOptions in tkConfig.c and not DoConfig in tkOldConfig.c). fvogel added on 2016-01-08 22:48:11: TK_OPTION_DONT_SET_DEFAULT now documented, see branch bug-2049429fff. fvogel added on 2016-01-08 14:14:53: TK_OPTION_DONT_SET_DEFAULT appeared for -spacing[123] in [7ef32f7c99]. This commit implements TIP #113 (search features in the text widget) and also objectifies the text widget. In that commit, TK_CONFIG_DONT_SET_DEFAULT was changed to TK_OPTION_DONT_SET_DEFAULT. TK_CONFIG_DONT_SET_DEFAULT was present since the very beginning (Initial revision of the history, 1998-04-01) on -spacing[123]. No idea why it is set on these three options. Note that TK_OPTION_DONT_SET_DEFAULT is set for -spacing[123] but also elsewhere in the text widget (for tag -borderwidth, tag -elide) and other widgets of Tk. Regarding this, the best (or at least the easiest) would be to document that these options are not taken from the options database. dkf added on 2008-08-21 14:46:52: Logged In: YES user_id=79902 Originator: NO TK_CONFIG_NULL_OK is public and should be documented. TK_OPTION_DONT_SET_DEFAULT is public and should be documented. No idea whatsoever why they're set on the -spacing[123] options... | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki