Tags added with Task.add_tag() don't show in the editor window if the task already has text
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GTG |
New
|
Undecided
|
Unassigned |
Bug Description
The editor window adds the tags to the text, but only if the text is empty (GTG/taskeditor
Right now, the only way to add tags are with the quick add (before the task can have text, so it works correctly when the editor is opened for the first time), or by adding them in the editor (in which case, the @tag_name text is added by the user typing).
I'm trying to implement adding tags by drag and drop (bug #460763), which can add tags after text exists, triggering this bug. Having add_tag work correctly may also be useful for plugins.
I don't know if the fix is to have Task.add_tag() modify the text, or to have the editor window check to make sure the text contains all of the task's tags and add them if they aren't present. There's also the issue of finding the correct place in the text to insert the tag.
Hi kevin, the add_tag() seems to be an internal function used to manage the tags list. The correct way to add tag in a task is the plugin_ api.insert_ tag(), which is:
def insert_tag(self, tag):
"""Inserts a tag into the current task (in the textview).
Note: this method only works with the onTaskOpened method.
@param tag: The tag's name (without the '@'). get_insert( )
self. textview. insert_ text("@ " + tag,itera)
self. textview. insert_ text(" @" + tag,itera)
self.textview. grab_focus( )
"""
itera = self.textview.
if itera.starts_line() :
else :
I noticed that the add_tag () method creates confusion, that is why I opened bug #493835