title: textbox.edit() returns unexpected characters
body: <p>I've developed a console application using curses.
  The problem is curses.textpad.Textbox.edit() returns typed characters and some unexpected characters like 'qqqqqj'.</p>
  
  <pre class="lang-py prettyprint-override"><code>import curses
  from curses import textpad
  
  
  def main(stdscr):
      curses.curs_set(0)
      window = stdscr.subwin(1, 10, 1, 1)
      window.clear()
      window.border()
      window2 = stdscr.subwin(2, 10, 3, 1)
      window2.clear()
  
      widget = textpad.Textbox(window, insert_mode=True)
      window.refresh()
      a = widget.edit()
      window2.addstr(0, 0, a)
      window2.refresh()
  
      curses.doupdate()
      window2.getch()
  
  
  if __name__ == '__main__':
      curses.wrapper(main)
  
  </code></pre>
  
  <p>Terminal output is (for example):</p>
  
  <blockquote>
    <p>123──────┘</p>
    
    <p>123qqqqqqj</p>
  </blockquote>
  
  <p>I can't understand what is it? And how to avoid it? Now I decided to use a.split('j')[0].</p>
  
  <p>My environment:</p>
  
  <ol>
  <li>python 3.6.0;</li>
  <li>OS X.</li>
  </ol>