I have been working trying to make a simple text editor, and have been experimenting with tags. I have been able to create justifying using tags. Now I\'m adding a bold opti
Tag attributes belong to the tag, not to the text. So, when you highlight something then apply attributes to the "sel" tag, it only affects text that has the "sel" tag. When you remove the tag (by unhighlighting), the attributes revert to the default (or to any other tags that might be present).
To make text bold, you must create a tag that has the bold attribute and assign that tag to the text. As long as the text has that tag, it will have the attributes of that tag.