title: Apply tags in a text widget
body: <p>I need some help tag-related!</p>
  
  <p>I am writing a simple editor, supporting basic formatting. 
  By using a Text widget (named <em>text</em>), I put a tag 'b' to set the text where this tag applies to bold.</p>
  
  <p>This is not a problem when I apply the bold to a selection:</p>
  
  <pre><code>text.tag_add('b', SEL_FIRST,SEL_LAST)
  </code></pre>
  
  <p>I have instead two problems when I just want to switch on/off the bold while typing.
  To switch it on the only way I found is this:</p>
  
  <pre><code>text.insert(INSERT, '  ', 'b' )
  text.mark_set("insert", INSERT+'-1c')
  </code></pre>
  
  <p>notice that I have to insert TWO spaces. If I insert one, the bold doesnt apply. If I insert '', my cursor goes back one char!</p>
  
  <p>My second problem is how to switch it off, when I'm writing within a bolded region - and for this I havent the slightest idea...</p>
  
  <p>Thanks for any help!</p>