title: Cursor remains at the end when I try to give user input in getline
body: <p>The following is the the code for asking a name and then returning a statement which has your name in it.</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  int main(){
      std::string name;
  
      std::cout &lt;&lt; &quot;What is your name:\n&quot;;
      std::getline(std::cin, name);
  
      std::cout &lt;&lt; &quot;Your name is &quot; &lt;&lt; name &lt;&lt; &quot;.\n&quot;;
  
      return 0;
  }
  </code></pre>
  <p>When I run this program and type the name, sometimes you type the input in wrong manner and hence you use the arrow keys to go left or right. However, when I use the left arrow key, instead of the cursor going to the left, <code>^[[D</code> is printed. And when I use the right arrow key, <code>^[[C</code> is printed.</p>
  <p>My question is how can I avoid this and actually move the cursor to the right or left. I use Vim text editor on Linux.</p>