From 82f2e758c73b6fccd77445f3f79a4663341652c8 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Wed, 6 Apr 2022 06:56:11 -0700 Subject: [PATCH] Change the default command prompts --- examples/unbourne.c | 2 +- third_party/lua/lua.main.c | 4 ++-- third_party/python/Python/pythonrun.c | 2 +- third_party/quickjs/libregexp.c | 3 +++ third_party/quickjs/repl.js | 10 ++++++++-- third_party/sqlite3/shell.c | 6 +++--- 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/examples/unbourne.c b/examples/unbourne.c index 558297667..973d1a074 100644 --- a/examples/unbourne.c +++ b/examples/unbourne.c @@ -5731,7 +5731,7 @@ retry: linenoiseSetFreeHintsCallback(free); linenoiseSetHintsCallback(ShellHint); linenoiseSetCompletionCallback(ShellCompletion); - if ((p = linenoiseWithHistory("$ ", "unbourne"))) { + if ((p = linenoiseWithHistory(">: ", "unbourne"))) { nr = min(strlen(p), IBUFSIZ - 2); memcpy(buf, p, nr); buf[nr++] = '\n'; diff --git a/third_party/lua/lua.main.c b/third_party/lua/lua.main.c index c3bb8cb67..51bc6a18c 100644 --- a/third_party/lua/lua.main.c +++ b/third_party/lua/lua.main.c @@ -370,8 +370,8 @@ static int handle_luainit (lua_State *L) { */ #if !defined(LUA_PROMPT) -#define LUA_PROMPT "> " -#define LUA_PROMPT2 ">> " +#define LUA_PROMPT ">: " +#define LUA_PROMPT2 ">>: " #endif #if !defined(LUA_MAXINPUT) diff --git a/third_party/python/Python/pythonrun.c b/third_party/python/Python/pythonrun.c index 114471948..0a4b428a2 100644 --- a/third_party/python/Python/pythonrun.c +++ b/third_party/python/Python/pythonrun.c @@ -101,7 +101,7 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename_str, PyCompilerFlags * } v = _PySys_GetObjectId(&PyId_ps1); if (v == NULL) { - _PySys_SetObjectId(&PyId_ps1, v = PyUnicode_FromString(">>> ")); + _PySys_SetObjectId(&PyId_ps1, v = PyUnicode_FromString(">>: ")); Py_XDECREF(v); } v = _PySys_GetObjectId(&PyId_ps2); diff --git a/third_party/quickjs/libregexp.c b/third_party/quickjs/libregexp.c index 5e08d0027..5739d24fe 100644 --- a/third_party/quickjs/libregexp.c +++ b/third_party/quickjs/libregexp.c @@ -510,6 +510,9 @@ int lre_parse_escape(const uint8_t **pp, int allow_utf16) case 'f': c = '\f'; break; + case 'e': + c = '\e'; /* [jart] love this */ + break; case 'n': c = '\n'; break; diff --git a/third_party/quickjs/repl.js b/third_party/quickjs/repl.js index 484269e16..37f05837a 100644 --- a/third_party/quickjs/repl.js +++ b/third_party/quickjs/repl.js @@ -111,9 +111,9 @@ import * as os from "os"; var plen = 0; var ps1; if (config_numcalc) - ps1 = "> "; + ps1 = ">: "; else - ps1 = "qjs > "; + ps1 = "qjs >: "; var ps2 = " ... "; var utf8 = true; var show_time = false; @@ -547,6 +547,11 @@ import * as os from "os"; this_fun = kill_region; } + function clear_screen() { + std.puts("\e[H\e[2J"); + return -1; + } + function kill_line() { kill_region(cursor_pos, cmd.length, 1); } @@ -743,6 +748,7 @@ import * as os from "os"; "\x09": completion, /* ^I - history-search-backward */ "\x0a": accept_line, /* ^J - newline */ "\x0b": kill_line, /* ^K - delete to end of line */ + "\x0c": clear_screen, /* ^L - clear screen */ "\x0d": accept_line, /* ^M - enter */ "\x0e": next_history, /* ^N - down */ "\x10": previous_history, /* ^P - up */ diff --git a/third_party/sqlite3/shell.c b/third_party/sqlite3/shell.c index 0ee8bdf66..7408d1149 100644 --- a/third_party/sqlite3/shell.c +++ b/third_party/sqlite3/shell.c @@ -1,3 +1,4 @@ +/* clang-format off */ /* DO NOT EDIT! ** This file is automatically generated by the script in the canonical ** SQLite source tree at tool/mkshellc.tcl. That script combines source @@ -34,7 +35,6 @@ /* This needs to come before any includes for MSVC compiler */ #define _CRT_SECURE_NO_WARNINGS #endif -/* clang-format off */ /* ** Determine if we are dealing with WinRT, which provides only a subset of @@ -20521,8 +20521,8 @@ static void main_init(ShellState *data) { sqlite3_config(SQLITE_CONFIG_URI, 1); sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data); sqlite3_config(SQLITE_CONFIG_MULTITHREAD); - sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> "); - sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> "); + sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite>: "); + sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...>: "); } /*