//////////////////////////////////////////////////
| 39 | |
| 40 | /////////////////////////////////////////////////////// |
| 41 | G4String G4UIcsh::GetCommandLineString(const char* msg) |
| 42 | /////////////////////////////////////////////////////// |
| 43 | { |
| 44 | MakePrompt(msg); |
| 45 | G4cout << promptString << std::flush; |
| 46 | |
| 47 | G4String newCommand; |
| 48 | G4StrUtil::readline(G4cin, newCommand, false); |
| 49 | if (! G4cin.good()) { |
| 50 | G4cin.clear(); |
| 51 | newCommand = "exit"; |
| 52 | return newCommand; |
| 53 | } |
| 54 | G4StrUtil::rstrip(newCommand, '\r'); // fix for odd behavior on Windows |
| 55 | |
| 56 | // multi-line |
| 57 | while ((newCommand.length() > 0) && (newCommand[G4int(newCommand.length() - 1)] == '_')) { |
| 58 | G4String newLine; |
| 59 | newCommand.erase(newCommand.length() - 1); |
| 60 | G4StrUtil::readline(G4cin, newLine, false); |
| 61 | if (! G4cin.good()) { |
| 62 | G4cin.clear(); |
| 63 | newCommand = "exit"; |
| 64 | return newCommand; |
| 65 | } |
| 66 | newCommand.append(newLine); |
| 67 | } |
| 68 | |
| 69 | return newCommand; |
| 70 | } |
no test coverage detected