code: func (state *TextEditor) tofp(start int, dir int) int {
  	first := (dir < 0)
  	notfirst := !first
  	var i int
  	for i = start; (i >= 0) && (i < len(state.Buffer)); i += dir {
  		c := state.Buffer[i]
  		if !(unicode.IsLetter(c) || unicode.IsDigit(c) || (c == '_') || (c == '-') || (c == '+') || (c == '/') || (c == '=') || (c == '~') || (c == '!') || (c == ':') || (c == ',') || (c == '.')) {
  			if !first {
  				i++
  			}
  			break
  		}
  		first = notfirst
  	}
  	if i < 0 {
  		i = 0
  	}
  	return i
  
  }
docs: // Moves to the beginning or end of something that looks like a file path