X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/311fe5f36238b8a8c80e49fa85dbac81fec58887..7752205a17e5ea74ed609e029169a633c25d7621:/Console.cpp diff --git a/Console.cpp b/Console.cpp index 4cf0ac1..e01dd07 100644 --- a/Console.cpp +++ b/Console.cpp @@ -394,6 +394,7 @@ static int CYConsoleKeyReturn(int count, int key) { if (memchr(rl_line_buffer, '\n', rl_end) == NULL) return rl_newline(count, key); + insert: char *before(CYmemrchr(rl_line_buffer, '\n', rl_point)); if (before == NULL) before = rl_line_buffer; @@ -419,7 +420,7 @@ static int CYConsoleKeyReturn(int count, int key) { else { std::string command(rl_line_buffer, rl_end); command += '\n'; - std::istringstream stream(command); + std::stringbuf stream(command); size_t last(std::string::npos); for (size_t i(0); i != std::string::npos; i = command.find('\n', i + 1)) @@ -440,8 +441,8 @@ static int CYConsoleKeyReturn(int count, int key) { if (done) return rl_newline(count, key); - rl_insert(count, '\n'); - return 0; + // XXX: this was the most obvious fix, but is seriously dumb + goto insert; } static int CYConsoleKeyUp(int count, int key) { @@ -679,7 +680,7 @@ static void Console(CYOptions &options) { if (bypass) code = command; else try { - std::istringstream stream(command); + std::stringbuf stream(command); CYPool pool; CYDriver driver(pool, stream); @@ -1065,7 +1066,7 @@ int Main(int argc, char * const argv[], char const * const envp[]) { stream = new std::istringstream(buffer.str()); CYPool pool; - CYDriver driver(pool, *stream, script); + CYDriver driver(pool, *stream->rdbuf(), script); Setup(driver); uint64_t begin(CYGetTime()); @@ -1091,7 +1092,7 @@ int Main(int argc, char * const argv[], char const * const envp[]) { } CYPool pool; - CYDriver driver(pool, *stream, script); + CYDriver driver(pool, *stream->rdbuf(), script); Setup(driver); bool failed(driver.Parse());