1

Console program receiving user input line by line using this code

while ( _run ) { 
    std::cout << "\n > ";
    std::string cmd = "";
    std::getline(std::cin, cmd);
    /* do something */
}

If user want to repeat previous line, he/she will use up/down keyboard keys to navigate to. In windows it works fine, but in Linux i see this characters instead of previous line:

^[[A - for up key
^[[B - for down key
^[[C - for right key
^[[D - for left key

Also not working navigation in current line with left/right keyboard buttons.

How to fix it?

0 Answers0