-C Fix\san\serror\shandling\scase\sin\s#base64.
-D 2026-07-22T14:16:33.877
+C CLI\simprovement:\s\sNew\scommand-line\soption\s"--cmdline-edit\sBOOLEAN"\sto\nenable/disable\scommand-line\sediting.\s\sCommand-line\sediting\sis\sdisabled\nby\sdefault\sif\seither\sstdin\sor\sstdout\sis\snot\sa\stty.
+D 2026-07-23T12:12:37.978
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F src/resolve.c 54395ee97eb710e695202d4112cf2b1c1c7767a57afcea745df71abb1c917768
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c 586ccc75f2fa289c51554330f9ff549d00dae4122ac7e2af712437e2ef737cc8
-F src/shell.c.in ce9ef76da7cc153afaa6aa233a155be885859f41c803a20bdc42d1c628b8ccab
+F src/shell.c.in 0df571dd1eae1a15577361902eb5487a072d3290ea94e1e72e757050b641f870
F src/sqlite.h.in 2101a2b494cbc282d0dc1c3f631c4fb83060c52876cc9d7615b091ad66d932b1
F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
F src/sqlite3ext.h 0efd4723bad9124ea1f581d9f1ea0254ac1c6f3e5fb29e4f3dcf36c72485a456
F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
-P 1e90bedec99054f4856bfb89efc4d676486504db67bd1304c45d14c638ddfc7e
-R 4ba1df6437fed061f1eb71312c47e6fe
-U stephan
-Z c36e942c267e89119f3168abed8a1ce3
+P f8c408f66257881937ed18b77e274f71dba2d97dd44546372fa0b0a9629efbd2
+R bad555b624f4fd2230e93ef522552de4
+U drh
+Z 924a5276b6b3c8953d98d053fbac0712
# Remove this line to create a well-formed Fossil manifest.
# define shell_write_history(X) write_history(X)
# define shell_stifle_history(X) stifle_history(X)
# define shell_readline(X) readline(X)
+# define SHELL_CMDLINE_EDIT_AVAILABLE 1 /* command-line editing available */
#elif HAVE_LINENOISE
# define shell_write_history(X) linenoiseHistorySave(X)
# define shell_stifle_history(X) linenoiseHistorySetMaxLen(X)
# define shell_readline(X) linenoise(X)
+# define SHELL_CMDLINE_EDIT_AVAILABLE 1 /* command-line editing available */
#else
# define shell_read_history(X)
# define shell_write_history(X)
# define shell_stifle_history(X)
-
-# define SHELL_USE_LOCAL_GETLINE 1
+# define SHELL_CMDLINE_EDIT_AVAILABLE 0 /* command-line editing not available */
#endif
+/*
+** Global variable shellCmdLineEdit determines whether or not command-line
+** editing is enabled. It defaults to 1 if the CLI is linked against a
+** command-line editing library (linenoise, readline, or editline) and
+** to 0 if no command-line editing library is available. The
+** "--cmdline-edit off" command-line option will change this value to 0.
+*/
+static int shellCmdLineEdit = SHELL_CMDLINE_EDIT_AVAILABLE;
+
#ifndef deliberate_fall_through
/* Quiet some compilers about some of our intentional code. */
# if defined(GCC_VERSION) && GCC_VERSION>=7000000
int nLine = zLine==0 ? 0 : 100;
int n = 0;
- while( 1 ){
+ while( seenInterrupt<2 ){
if( n+100>nLine ){
if( nLine>=1073741773 ){
free(zLine);
const char *zBase = prompt_string(p, bContinue!=0);
char *zPrompt = expand_prompt(p, zAll, zBase);
shell_check_oom(zPrompt);
-#if SHELL_USE_LOCAL_GETLINE
- sputz(stdout, zPrompt);
- fflush(stdout);
- do{
- zResult = local_getline(zPrior, stdin);
- zPrior = 0;
- /* ^C trap creates a false EOF, so let "interrupt" thread catch up. */
- if( zResult==0 ) sqlite3_sleep(50);
- }while( zResult==0 && seenInterrupt>0 );
-#else
- free(zPrior);
- zResult = shell_readline(zPrompt);
- while( zResult==0 ){
- /* ^C trap creates a false EOF, so let "interrupt" thread catch up. */
- sqlite3_sleep(50);
- if( seenInterrupt==0 ) break;
- zResult = shell_readline("");
- }
- if( zResult && *zResult ) shell_add_history(zResult);
+#if SHELL_CMDLINE_EDIT_AVAILABLE
+ if( shellCmdLineEdit ){
+ free(zPrior);
+ zResult = shell_readline(zPrompt);
+ while( zResult==0 ){
+ /* ^C trap creates a false EOF, so let "interrupt" thread catch up. */
+ sqlite3_sleep(50);
+ if( seenInterrupt==0 ) break;
+ zResult = shell_readline("");
+ }
+ if( zResult && *zResult ) shell_add_history(zResult);
+ }else
#endif
+ {
+ sputz(stdout, zPrompt);
+ fflush(stdout);
+ do{
+ zResult = local_getline(zPrior, stdin);
+ zPrior = 0;
+ /* ^C trap creates a false EOF, so let "interrupt" thread catch up. */
+ if( zResult==0 ) sqlite3_sleep(50);
+ }while( zResult==0 && seenInterrupt>0 );
+ }
sqlite3_free(zPrompt);
}
return zResult;
" -batch force batch I/O\n"
" -box set '.mode box'\n"
" -cmd COMMAND run \"COMMAND\" before reading stdin\n"
+ " -cmdline-edit BOOL enable or disable command-line editing\n"
" -column set '.mode column'\n"
" -csv set '.mode csv -limits off'\n"
#if !defined(SQLITE_OMIT_DESERIALIZE)
#else
stdin_is_interactive = isatty(0);
stdout_is_console = isatty(1);
+ if( !stdin_is_interactive || !stdout_is_console ){
+ shellCmdLineEdit = 0;
+ }
#endif
atexit(abnormalExit);
#ifdef SQLITE_DEBUG
}else if( cli_strcmp(z,"-escape")==0 && i+1<argc ){
/* skip over the argument */
i++;
+ }else if( cli_strcmp(z,"-cmdline-edit")==0 ){
+ shellCmdLineEdit = booleanValue(cmdline_option_value(argc,argv,++i));
}else if( cli_strcmp(z,"-test-argv")==0 ){
/* Undocumented test option. Print the values in argv[] and exit.
** Use this to verify that any translation of the argv[], for example
}else if( cli_strcmp(z,"-multiplex")==0 ){
i++;
#endif
+ }else if( cli_strcmp(z,"-cmdline-edit")==0 ){
+ i+=2;
}else if( cli_strcmp(z,"-help")==0 ){
usage(1);
}else if( cli_strcmp(z,"-cmd")==0 ){