title: Control keys (left arrow) are sent to stdin (^[[D) instead of being interpreted
body: <p>When reading user input using getline(cin, mystrvar), some control keys don't work.</p>
  
  <p>Example:</p>
  
  <pre><code>User input: abc^[[Dd
  Text: abd
  User input: asc
  Read bytes: 7
  #0: 97
  #1: 98
  #2: 99
  #3: 27
  #4: 91
  #5: 68
  #6: 100
  </code></pre>
  
  <p>I typed a, b, c, then left arrow and d.
  "Text:" apparently writes (cout) the first three characters, then sets the pointer to the left and overwrites the c.
  "asc" is a simple function that prints the length (mystrvar.size()) and ascii values.</p>
  
  <p>When calling "stty -ctlecho" (system(...)), I am able to use the left arrow key, but it isn't limited to my input (I can overwrite "User input: ") plus the control codes are still being sent to my program.</p>
  
  <p>This does not happen on Windows - I can use the arrow keys (even up/down for history) normally.</p>
  
  <p>What's wrong here?</p>
  
  <p><strong>Edit</strong>: I'm mostly using Fedora 15. There doesn't seem to be any difference between lxterminal, terminal, xterm, konsole, gnome-terminal (as terminal) or bash, ksh, tcsh (as shell).</p>