A simple line edit (raw mode)
| 401 | } |
| 402 | /// A simple line edit (raw mode) |
| 403 | int lineedit(const std::string& prompt, std::string& output, std::recursive_mutex * lock, CommandHistory & ch) |
| 404 | { |
| 405 | if(state == con_lineedit) |
| 406 | return Console::FAILURE; |
| 407 | output.clear(); |
| 408 | reset_color(); |
| 409 | this->prompt = prompt; |
| 410 | if (!supported_terminal) |
| 411 | { |
| 412 | print(prompt.c_str()); |
| 413 | fflush(dfout_C); |
| 414 | // FIXME: what do we do here??? |
| 415 | //SDL_recursive_mutexV(lock); |
| 416 | state = con_lineedit; |
| 417 | std::getline(std::cin, output); |
| 418 | state = con_unclaimed; |
| 419 | //SDL_recursive_mutexP(lock); |
| 420 | return output.size(); |
| 421 | } |
| 422 | else |
| 423 | { |
| 424 | int count; |
| 425 | if (enable_raw() == -1) return 0; |
| 426 | state = con_lineedit; |
| 427 | count = prompt_loop(lock,ch); |
| 428 | state = con_unclaimed; |
| 429 | disable_raw(); |
| 430 | print("\n"); |
| 431 | if(count > Console::FAILURE) |
| 432 | { |
| 433 | output = toLocaleMB(raw_buffer); |
| 434 | } |
| 435 | return count; |
| 436 | } |
| 437 | } |
| 438 | int enable_raw() |
| 439 | { |
| 440 | struct termios raw; |
nothing calls this directly
no test coverage detected