]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Store the prompts as part of the ShellState object, not as global variables.
authordrh <>
Thu, 9 Apr 2026 22:14:58 +0000 (22:14 +0000)
committerdrh <>
Thu, 9 Apr 2026 22:14:58 +0000 (22:14 +0000)
FossilOrigin-Name: 39f6c5a8a7d91e03f89b13496e333b9500977a2cbcc0c27ba14dfb87dc81e678

manifest
manifest.uuid
src/shell.c.in

index f7524ecc9a20893fd829c709dab90ef030fb6c55..8ad58a623ba0f8a28bd38d0e3a87b54152be2e04 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Strip\sout\sthe\slegacy\sdynamic\sprompt\sgeneration.\s\sIt\swill\sgo\sback\sin\sas\sI\nadd\sthe\suser-defined\sprompt\sescapes.
-D 2026-04-09T20:21:25.880
+C Store\sthe\sprompts\sas\spart\sof\sthe\sShellState\sobject,\snot\sas\sglobal\svariables.
+D 2026-04-09T22:14:58.383
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -735,7 +735,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
 F src/resolve.c 928ff887f2a7c64275182060d94d06fdddbe32226c569781cf7e7edc6f58d7fd
 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
 F src/select.c ffe199f025a0dd74670d2a77232bdea364a4d7b36f32c64a6572d39ba6a11576
-F src/shell.c.in d2d6accf85d516d39ffb5101e3209e22b062c014be0b7c467c12bc3d2e9a4f96
+F src/shell.c.in 41b2b8ed58a2b34ca1b3027ab73fa5f21fa5a359025ec4d803fff43e5053c85e
 F src/sqlite.h.in e2915e4a86d5e0783afb5cb72411df38d987c7f3c5aa2d5441b8e74d30b649d8
 F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
 F src/sqlite3ext.h 1b7a0ee438bb5c2896d0609c537e917d8057b3340f6ad004d2de44f03e3d3cca
@@ -2197,11 +2197,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
 F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
 F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
-P e2c9d4c6b731ea9afbb9cb22f86a3db3670ca67968f15891dc46ae1fc9ba34dc
-R 6a381ddbe79e14291b50a57316105ea7
-T *branch * cli-prompt-redo
-T *sym-cli-prompt-redo *
-T -sym-cli-prompt *
+P ab08b7a8ef518f96a549a41fe8ff11776abe5e83153c5f8d5d58694ecc476389
+R 94a7119792f4c428d79e21c5509da5f9
 U drh
-Z 400a2e048f10888511ab99293cd1badd
+Z 849f1289eaea61587540a79ea11d0c87
 # Remove this line to create a well-formed Fossil manifest.
index ea4743febfb9ff7643c7c036dcbaae26dd7a6d29..e245a501de5d0a3948d5dfca816e256ef3d63fa5 100644 (file)
@@ -1 +1 @@
-ab08b7a8ef518f96a549a41fe8ff11776abe5e83153c5f8d5d58694ecc476389
+39f6c5a8a7d91e03f89b13496e333b9500977a2cbcc0c27ba14dfb87dc81e678
index 705400a05df0854f8a8ffaa3c54879857f0c3662..fa2c9d829b03d7a991b132e6b2ec523b653c3366 100644 (file)
@@ -355,6 +355,10 @@ typedef struct Mode {
 #define MFLG_CRLF  0x02  /* Use CR/LF output line endings */
 #define MFLG_HDR   0x04  /* .header used to change headers on/off */
 
+/*
+** Size of the prompt strings
+*/
+#define PROMPT_MAX 128
 
 /*
 ** State information about the database connection is contained in an
@@ -397,8 +401,6 @@ struct ShellState {
   char *zDestTable;      /* Name of destination table when MODE_Insert */
   char *zTempFile;       /* Temporary file that might need deleting */
   char *zErrPrefix;      /* Alternative error message prefix */
-  char zTestcase[30];    /* Name of current test case */
-  char outfile[FILENAME_MAX]; /* Filename for *out */
   sqlite3_stmt *pStmt;   /* Current statement if any. */
   FILE *pLog;            /* Write log output here */
   Mode mode;             /* Current display mode */
@@ -438,6 +440,10 @@ struct ShellState {
     const char * zDefaultDbName; /* Default name for db file */
   } wasm;
 #endif
+  char zTestcase[30];           /* Name of current test case */
+  char outfile[FILENAME_MAX];   /* Filename for *out */
+  char mainPrompt[PROMPT_MAX];  /* Main prompt */
+  char contPrompt[PROMPT_MAX];  /* Continuation prompt */
 };
 
 #ifdef SQLITE_SHELL_FIDDLE
@@ -674,16 +680,6 @@ static volatile int seenInterrupt = 0;
 */
 static char *Argv0;
 
-/*
-** Prompt strings. Initialized in main. Settable with
-**   .prompt main continue
-*/
-#define PROMPT_LEN_MAX 128
-/* First line prompt.   default: "sqlite> " */
-static char mainPrompt[PROMPT_LEN_MAX];
-/* Continuation prompt. default: "   ...> " */
-static char continuePrompt[PROMPT_LEN_MAX];
-
 /*
 ** Write I/O traces to the following stream.
 */
@@ -952,7 +948,7 @@ static char *one_input_line(ShellState *p, char *zPrior, int isContinuation){
   if( in!=0 ){
     zResult = local_getline(zPrior, in);
   }else{
-    zPrompt = isContinuation ? continuePrompt : mainPrompt;
+    zPrompt = isContinuation ? p->contPrompt : p->mainPrompt;
 #if SHELL_USE_LOCAL_GETLINE
     sputz(stdout, zPrompt);
     fflush(stdout);
@@ -10343,10 +10339,10 @@ static int do_meta_command(const char *zLine, ShellState *p){
 
   if( c=='p' && cli_strncmp(azArg[0], "prompt", n)==0 ){
     if( nArg >= 2) {
-      shell_strncpy(mainPrompt,azArg[1],(int)ArraySize(mainPrompt)-1);
+      shell_strncpy(p->mainPrompt,azArg[1],sizeof(p->mainPrompt)-1);
     }
     if( nArg >= 3) {
-      shell_strncpy(continuePrompt,azArg[2],(int)ArraySize(continuePrompt)-1);
+      shell_strncpy(p->contPrompt,azArg[2],sizeof(p->contPrompt)-1);
     }
   }else
 
@@ -12640,8 +12636,8 @@ static void main_init(ShellState *p) {
 #endif
   sqlite3_config(SQLITE_CONFIG_URI, 1);
   sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
-  sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
-  sqlite3_snprintf(sizeof(continuePrompt), continuePrompt,"   ...> ");
+  sqlite3_snprintf(sizeof(p->mainPrompt), p->mainPrompt,"sqlite> ");
+  sqlite3_snprintf(sizeof(p->contPrompt), p->contPrompt,"   ...> ");
 }
 
 /*