code: func (t *SimpleStyledText) SetMarkup(s string) {
  
  	markup := []rune(s)
  	styl := make([]tcell.Style, 0, len(markup))
  	text := make([]rune, 0, len(markup))
  
  	style := t.styles['N']
  
  	esc := false
  	for _, r := range markup {
  		if esc {
  			esc = false
  			switch r {
  			case '%':
  				text = append(text, '%')
  				styl = append(styl, style)
  			default:
  				style = t.styles[r]
  			}
  			continue
  		}
  		switch r {
  		case '%':
  			esc = true
  			continue
  		default:
  			text = append(text, r)
  			styl = append(styl, style)
  		}
  	}
  
  	t.Text.SetText(string(text))
  	for i, s := range styl {
  		t.SetStyleAt(i, s)
  	}
  	t.markup = markup
  }
docs: // SetMarkup sets the text used for the string.  It applies markup as follows
  // (modeled on tcsh style prompt markup):
  //
  // * %% - emit a single % in current style
  // * %N - normal style
  // * %A - alternate style
  // * %S - start standout (reverse) style
  // * %B - start bold style
  // * %U - start underline style
  //
  // Other styles can be set using %<rune>, if styles are registered.
  // Upper case characters and punctuation are reserved for use by the system.
  // Lower case are available for use by the user.  (Users may define mappings
  // for upper case letters to override system defined styles.)
  //
  // Note that for simplicity, combining styles is not supported.  By default
  // the alternate style is the same as standout (reverse) mode.
  //
  // Arguably we could have used Markdown syntax instead, but properly doing all
  // of Markdown is not trivial, and these escape sequences make it clearer that
  // we are not even attempting to do that.