From 69537bdef642d71bb5835603c602e426b275306e Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 24 Nov 2025 13:24:58 +0000 Subject: [PATCH] In the CLI on the ".mode" command, replace the recently added --no-limits option with "--limits L,C". And add --sw as an alias for --screenwidth. FossilOrigin-Name: cff0978587a4193b57b0384a587bf89174be2fd91cff4d40130babef1dc8431e --- manifest | 15 ++++++------ manifest.uuid | 2 +- src/shell.c.in | 62 +++++++++++++++++++++++++++++++------------------- 3 files changed, 48 insertions(+), 31 deletions(-) diff --git a/manifest b/manifest index cc6fb3b030..b0b1dd761d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Doc\stypo\sfix. -D 2025-11-24T13:22:26.057 +C In\sthe\sCLI\son\sthe\s".mode"\scommand,\sreplace\sthe\srecently\sadded\s--no-limits\soption\swith\n"--limits\sL,C".\s\sAnd\sadd\s--sw\sas\san\salias\sfor\s--screenwidth. +D 2025-11-24T13:24:58.335 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 5616fbcf3b833c7c705b24371828215ad0925d0c0073216c4f153348d5753f0a F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c ba9cd07ffa3277883c1986085f6ddc4320f4d35d5f212ab58df79a7ecc1a576a -F src/shell.c.in 7f4a56ac62b5030755e72c5a9598b45782a0deccba350605b13d6d7b48e58b2d +F src/shell.c.in bc2185e0e988f93643dbaac3c8f190b3687475cd7ac802c035d20347b8e27fbb F src/sqlite.h.in f1363321ca55cc2feaa289e9fe6dfb08102a28c54edf005564711a2348b06eef F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 F src/sqlite3ext.h 5d5330f5f8461f5ce74960436ddcfa53ecd09c2b8b23901e22ae38aec3243998 @@ -2179,8 +2179,9 @@ F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6dd F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 526b88fb9b270e780660b97fc14f41583885a3d801f0ed17e0e35ebd61749b26 -R 303b989f731f7a72bc186051f75f7c2a -U stephan -Z f553d8b6235263e64ab21b35c8f6d005 +P d96cc772f0423f3f2b6ee0b0fb3d7e133cc4981cc7be76527a6d43792ece74e2 +Q +caefe4c746599b22aec446f3aeb296e53edaf8c54f8ae803381e8c21d5e29ab4 +R d3f9408cc4e0564645dc312501bb3665 +U drh +Z 7aa8998c4c3a9b227543e2da76143342 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 79cbccac4b..7f15bec634 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d96cc772f0423f3f2b6ee0b0fb3d7e133cc4981cc7be76527a6d43792ece74e2 +cff0978587a4193b57b0384a587bf89174be2fd91cff4d40130babef1dc8431e diff --git a/src/shell.c.in b/src/shell.c.in index 1be0db50e3..bce4cde190 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -7653,9 +7653,9 @@ static int modeTitleDsply(ShellState *p, int bAll){ ** ** USAGE: .mode [MODE] [OPTIONS] ** -** Change the output mode to MODE and/or apply OPTIONS to the -** output mode. If no arguments, show the current output mode -** and relevant options. +** Change the output mode to MODE and/or apply OPTIONS to the output mode. +** Arguments are processed from left to right. If no arguments, show the +** current output mode and relevant options. ** ** Options: ** --align STRING Set the alignment of text in columnar modes @@ -7674,9 +7674,9 @@ static int modeTitleDsply(ShellState *p, int bAll){ ** any single SQL value to N. Longer values are ** truncated. Zero means "no limit". Only works ** in "line" mode and in columnar modes. +** --limits L,C Shorthand for "--linelimit L --charlimit C". +** Or "off" to mean "0,0". Or "on" for "5,300". ** --list List available modes -** --no-limits Shorthand to turn off --linelimit, --charlimit, -** and --screenwidth. ** --null STRING Render SQL NULL values as the given string ** --once Setting changes to the right are reverted after ** the next SQL command. @@ -7686,7 +7686,7 @@ static int modeTitleDsply(ShellState *p, int bAll){ ** "on and "sql" are synonyms. ** --reset Changes all mode settings back to their default. ** --rowsep STRING Use STRING as the row separator -** --screenwidth N Declare the screen width of the output device +** --sw|--screenwidth N Declare the screen width of the output device ** to be N characters. An attempt may be made to ** wrap output text to fit within this limit. Zero ** means "no limit". Or N can be "auto" to set the @@ -7694,7 +7694,7 @@ static int modeTitleDsply(ShellState *p, int bAll){ ** --tablename NAME Set the name of the table for "insert" mode. ** --tag NAME Save mode to the left as NAME. ** --textjsonb BOOLEAN If enabled, JSONB text is displayed as text JSON. -** --title ARG Whether or not to show column headers, and if so +** --title ARG Whether or not to show column headers, and if so ** how to encode them. ARG can be "off", "on", ** "sql", "csv", "html", "tcl", or "json". ** -v|--verbose Verbose output @@ -7798,11 +7798,10 @@ static int dotCmdMode(ShellState *p){ }else if( optionMatch(z,"escape") ){ /* See similar code at tag-20250224-1 */ char *zErr = 0; - if( i+1>=nArg ){ - dotCmdError(p, i, "missing argument", 0); + if( (++i)>=nArg ){ + dotCmdError(p, i-1, "missing argument", 0); return 1; - } - i++; /* 0 1 2 <-- One less than QRF_ESC_ */ + } /* 0 1 2 <-- One less than QRF_ESC_ */ k = pickStr(azArg[i],&zErr,"off","ascii","symbol",""); if( k<0 ){ dotCmdError(p, i, "unknown escape type", "%s", zErr); @@ -7811,6 +7810,30 @@ static int dotCmdMode(ShellState *p){ } p->mode.spec.eEsc = k+1; chng = 1; + }else if( optionMatch(z,"limits") ){ + if( (++i)>=nArg ){ + dotCmdError(p, i-1, "missing argument", 0); + return 1; + } + k = pickStr(azArg[i],0,"on","off",""); + if( k==0 ){ + p->mode.spec.nLineLimit = 5; + p->mode.spec.nCharLimit = 300; + }else if( k==1 ){ + p->mode.spec.nLineLimit = 0; + p->mode.spec.nCharLimit = 0; + }else{ + int L, C; + int nNum = sscanf(azArg[i], "%d,%d", &L, &C); + if( nNum!=2 || L<0 || C<0 ){ + dotCmdError(p, i, "bad argument", "Should be \"L,C\" where L and C" + " are unsigned integers"); + return 1; + } + p->mode.spec.nLineLimit = L; + p->mode.spec.nCharLimit = C; + } + chng = 1; }else if( optionMatch(z,"list") ){ int ii; cli_puts("available modes:", p->out); @@ -7831,12 +7854,6 @@ static int dotCmdMode(ShellState *p){ p->mode.spec.eText = QRF_TEXT_Plain; p->mode.spec.eBlob = QRF_BLOB_Text; chng = 1; - }else if( optionMatch(z,"no-limits") ){ - p->mode.spec.nLineLimit = 0; - p->mode.spec.nCharLimit = 0; - p->mode.spec.nScreenWidth = 0; - p->mode.bAutoScreenWidth = 0; - chng = 1; }else if( optionMatch(z,"quote") ){ if( i+1mode.eMode; modeFree(&p->mode); modeChange(p, saved_eMode); - }else if( optionMatch(z,"screenwidth") ){ - if( i+1>=nArg ){ - dotCmdError(p, i, "missing argument", 0); + }else if( optionMatch(z,"screenwidth") || optionMatch(z,"sw") ){ + if( (++i)>=nArg ){ + dotCmdError(p, i-1, "missing argument", 0); return 1; } - k = pickStr(azArg[i+1],0,"off","auto",""); + k = pickStr(azArg[i],0,"off","auto",""); if( k==0 ){ p->mode.bAutoScreenWidth = 0; p->mode.spec.nScreenWidth = 0; }else if( k==1 ){ p->mode.bAutoScreenWidth = 1; }else{ - i64 w = integerValue(azArg[i+1]); + i64 w = integerValue(azArg[i]); p->mode.bAutoScreenWidth = 0; if( w<0 ) w = 0; if( w>QRF_MAX_WIDTH ) w = QRF_MAX_WIDTH; p->mode.spec.nScreenWidth = w; } - i++; chng = 1; }else if( optionMatch(z,"tag") ){ size_t nByte; -- 2.47.3