unsigned char bWordWrap; /* Try to wrap on word boundaries */
unsigned char bTextJsonb; /* Render JSONB blobs as JSON text */
short int mxColWidth; /* Maximum width of any individual column */
- short int mxTotalWidth; /* Maximum overall table width */
+ short int nScreenWidth; /* Try to keep output short so that it fits */
short int mxRowHeight; /* Maximum number of lines for any row */
int mxLength; /* Maximum content to display per element */
int nWidth; /* Number of entries in aWidth[] */
> ~~~
#define QRF_TEXT_Auto 0 /* Choose text encoding automatically */
-#define QRF_TEXT_Off 1 /* Literal text */
+#define QRF_TEXT_Plain 1 /* Literal text */
#define QRF_TEXT_Sql 2 /* Quote as an SQL literal */
#define QRF_TEXT_Csv 3 /* CSV-style quoting */
#define QRF_TEXT_Html 4 /* HTML-style quoting */
A value of QRF_TEXT_Auto means that the query result formatter will choose
what it thinks will be the best text encoding.
-A value of QRF_TEXT_Off means that text values appear in the output exactly
+A value of QRF_TEXT_Plain means that text values appear in the output exactly
as they are found in the database file, with no translation.
A value of QRF_TEXT_Sql means that text values are escaped so that they
As for 2025-11-07, the mxLength constraint is not yet implemented.
The current behavior is always as if mxLength where zero.*
-### 2.9 Word Wrapping In Columnar Styles (mxColWidth, mxTotalWidth, bWordWrap)
+### 2.9 Word Wrapping In Columnar Styles (mxColWidth, bWordWrap)
When using columnar formatting modes (QRF_STYLE_Box, QRF_STYLE_Column,
QRF_STYLE_Markdown, or QRF_STYLE_Table), the formatter attempts to limit
the width of any individual column to sqlite3_qrf_spec.mxColWidth characters
if mxColWidth is non-zero. A zero value for mxColWidth means "unlimited".
-The formatter also attempts to limit the width of the entire table to
-no more than sqlite3_qrf_spec.mxTotalWidth characters. Again, a zero
-value means "no-limit".
-
The mxColWidth limit might be exceeded if the limit is very small.
-The mxTotalWidth is "best effort"; the formatter might go significantly
-beyond the mxTotalWidth if the table has too many columns
-to squeeze into the specified space.
-
-In order to keep individual columns, or the entire table, within
-requested width limits, it is sometimes necessary to wrap the content
-for a single row of a single column across multiple lines. When this
-becomes necessary and if the bWordWrap setting is QRF_SW_On, then the
+
+In order to keep individual columns within requested width limits,
+it is sometimes necessary to wrap the content for a single row of
+a single column across multiple lines. When this
+becomes necessary and if the bWordWrap setting is QRF_Yes, then the
formatter attempts to split the content on whitespace or at a word boundary.
-If bWordWrap is QRF_SW_Off, then the formatter is free to split content
+If bWordWrap is QRF_No, then the formatter is free to split content
anywhere, including in the middle of a word.
For narrow columns and wide words, it might sometimes be necessary to split
-a column in the middle of a word, even when bWordWrap is QRF_SW_On.
+a column in the middle of a word, even when bWordWrap is QRF_Yes.
+
+### 2.10 Helping The Output To Fit On The Terminal (nScreenWidth)
+
+The sqlite3_qrf_spec.nScreenWidth field can be set the number of
+characters that will fit on one line on the viewer output device.
+This is typically a number like 80 or 132. The formatter will attempt
+to reduce the length of output lines, depending on the style, so
+that all output fits on that screen.
+
+A value of zero for nScreenWidth means "unknown" or "no width limit".
+When the value is zero, the formatter makes no attempt to keep the
+lines of output short.
-*The mxTotalWidth setting is a place-holder.
-As for 2025-11-07, the mxTotalWidth constraint is not yet implemented.
-The current behavior is always as if mxTotalWidth where zero.*
+The nScreenWidth is a hint to the formatter, not a requirement.
+The formatter trieds to keep lines below the nScreenWidth limit,
+but it does not guarantee that it will.
-### 2.10 Individual Column Width (nWidth and aWidth)
+### 2.11 Individual Column Width (nWidth and aWidth)
The sqlite3_qrf_spec.aWidth field is a pointer to an array of
signed 16-bit integers that control the width of individual columns
backwards compatibility only, and are not recommended for new
applications.
-### 2.11 Alignment (nAlignment, aAlignment, eDfltAlign, eTitleAlign)
+### 2.12 Alignment (nAlignment, aAlignment, eDfltAlign, eTitleAlign)
Some cells in a display table might contain a lot of text and thus
be wide, or they might contain newline characters or be wrapped by
The vertical alignment settings are currently ignored and
the vertical alignment is always QRF_ALIGN_Top.*
-### 2.12 Row and Column Separator Strings
+### 2.13 Row and Column Separator Strings
The sqlite3_qrf_spec.zColumnSep and sqlite3_qrf_spec.zRowSep strings
are alternative column and row separator character sequences. If not
are used. Some output styles have hard-coded column and row separators
and these settings are ignored for those styles.
-### 2.13 The Output Table Name
+### 2.14 The Output Table Name
The sqlite3_qrf_spec.zTableName value is the name of the output table
when eStyle is QRF_STYLE_Insert.
-### 2.14 The Rendering Of NULL
+### 2.15 The Rendering Of NULL
If a value is NULL then show the NULL using the string
found in sqlite3_qrf_spec.zNull. If zNull is itself a NULL pointer
then NULL values are rendered as an empty string.
-### 2.15 Optional Value Rendering Callback
+### 2.16 Optional Value Rendering Callback
If the sqlite3_qrf_spec.xRender field is not NULL, then each
sqlite3_value coming out of the query is first passed to the
terminated by a single newline (\\u000a or \\n). These column
and row separator choices can be overridden using the zColumnSep
and zRowSep fields of the `sqlite3_qrf_spec` structure. The text
-formatting is QRF_TEXT_Off, and BLOB encoding is QRF_BLOB_Text. So
+formatting is QRF_TEXT_Plain, and BLOB encoding is QRF_BLOB_Text. So
characters appear in the output exactly as they appear in the database.
Except the eEsp mode defaults to `QRF_ESC_On`, so that control
characters are escaped, for safety.
data.aiCol[i] = w;
}
- /* TBD: Narrow columns so that the total is less than p->spec.mxTotalWidth */
+ /* TBD: Narrow columns so that the total is less than p->spec.nScreenWidth */
/* Draw the line across the top of the table. Also initialize
** the row boundary and column separator texts. */
p->spec.eEsc = QRF_ESC_Ascii;
}
if( p->spec.eText==QRF_Auto ){
- p->spec.eText = QRF_TEXT_Off;
+ p->spec.eText = QRF_TEXT_Plain;
}
if( p->spec.eTitle==QRF_Auto ){
switch( p->spec.eStyle ){
case QRF_STYLE_Box:
case QRF_STYLE_Column:
case QRF_STYLE_Table:
- p->spec.eTitle = QRF_TEXT_Off;
+ p->spec.eTitle = QRF_TEXT_Plain;
break;
default:
p->spec.eTitle = p->spec.eText;
}
if( p->nRow ) sqlite3_str_append(p->pOut, "\n", 1);
pVal = sqlite3_str_new(p->db);
- mxW = p->spec.mxTotalWidth ? p->spec.mxTotalWidth : QRF_MAX_WIDTH;
+ mxW = p->spec.nScreenWidth ? p->spec.nScreenWidth : QRF_MAX_WIDTH;
mxW -= 3 + p->u.sLine.mxColWth;
bWW = p->spec.bWordWrap==QRF_Yes;
for(i=0; i<p->nCol; i++){
unsigned char eDfltAlign; /* Default alignment, no covered by aAlignment */
unsigned char eTitleAlign; /* Alignment for column headers */
short int mxColWidth; /* Maximum width of any individual column */
- short int mxTotalWidth; /* Maximum overall table width */
+ short int nScreenWidth; /* Maximum overall table width */
short int mxRowHeight; /* Maximum number of lines for any row */
int mxLength; /* Maximum content to display per element */
int nWidth; /* Number of entries in aWidth[] */
/*
** Range of values for sqlite3_qrf_spec.aWidth[] entries and for
-** sqlite3_qrf_spec.mxColWidth and .mxTotalWidth
+** sqlite3_qrf_spec.mxColWidth and .nScreenWidth
*/
#define QRF_MAX_WIDTH 10000
#define QRF_MIN_WIDTH 0
** Allowed values for sqlite3_qrf_spec.eText
*/
#define QRF_TEXT_Auto 0 /* Choose text encoding automatically */
-#define QRF_TEXT_Off 1 /* Literal text */
+#define QRF_TEXT_Plain 1 /* Literal text */
#define QRF_TEXT_Sql 2 /* Quote as an SQL literal */
#define QRF_TEXT_Csv 3 /* CSV-style quoting */
#define QRF_TEXT_Html 4 /* HTML-style quoting */
-C Improvements\sto\sQRF_STYLE_Line.\s\sMake\sit\sresponsive\sto\smxTotalWidth\sand\nmxRowHeight.\s\sIndent\ssubsequent\slines\sappropriately.\s\sAdd\scorresponding\ntest\scases.
-D 2025-11-08T18:31:57.772
+C Name\schanges.\s\sQRF_TEXT_Off\sbecomes\sQRF_TEXT_Plain.\s\smxTotalWidth\sbecomes\nnScreenWidth.
+D 2025-11-08T22:46:29.898
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F ext/misc/windirent.h 02211ce51f3034c675f2dbf4d228194d51b3ee05734678bad5106fff6292e60c
F ext/misc/zipfile.c 09e6e3a3ff40a99677de3c0bc6569bd5f4709b1844ac3d1c1452a456c5a62f1c
F ext/misc/zorder.c bddff2e1b9661a90c95c2a9a9c7ecd8908afab5763256294dd12d609d4664eee
-F ext/qrf/README.md 7c32e08e1cc5bb704f243a641ddfaf2f00152bbeb62c3a621efcf9371e6b156b
-F ext/qrf/qrf.c d3e4b93a3324d904f0e56eb198caac51d361aa0f6df5bc89433a445517321205
-F ext/qrf/qrf.h 3917767fdd7547bded156327f2b6bf3e1dbf6c7ea787f67f31453815986fe780
+F ext/qrf/README.md 5011393a53bfb26b59488e5d8d8576de521058876b61318d4fe476375a4ae9a2
+F ext/qrf/qrf.c aefc0febac369be026fb91830112c6ccec9f63c457bda0a502d69e123d89c8bd
+F ext/qrf/qrf.h 49a106a7484c9761bb66bebe0043fbf43302624734a9f9734e0fa410a908e525
F ext/rbu/rbu.c 801450b24eaf14440d8fd20385aacc751d5c9d6123398df41b1b5aa804bf4ce8
F ext/rbu/rbu1.test 25870dd7db7eb5597e2b4d6e29e7a7e095abf332660f67d89959552ce8f8f255
F ext/rbu/rbu10.test 7c22caa32c2ff26983ca8320779a31495a6555737684af7aba3daaf762ef3363
F src/sqliteLimit.h fe70bd8983e5d317a264f2ea97473b359faf3ebb0827877a76813f5cf0cdc364
F src/status.c 7565d63a79aa2f326339a24a0461a60096d0bd2bce711fefb50b5c89335f3592
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
-F src/tclsqlite.c c2b9e546a4bf533de0a3a45c05823132f3affe013ac2cd21825ef28125acd162
+F src/tclsqlite.c 667adb8b432f95ca79a86024fff4fd76f503fc8db72ea29b6f4d0b0d4382518a
F src/tclsqlite.h 614b3780a62522bc9f8f2b9fb22689e8009958e7aa77e572d0f3149050af348a
F src/test1.c f880ab766eeedf2c063662bd9538b923fd42c4341b7bfc2150a6d93ab8b9341c
F src/test2.c 62f0830958f9075692c29c6de51b495ae8969e1bef85f239ffcd9ba5fb44a5ff
F test/progress.test ebab27f670bd0d4eb9d20d49cef96e68141d92fb
F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
F test/pushdown.test 46a626ef1c0ca79b85296ff2e078b9da20a50e9b804b38f441590c3987580ddd
-F test/qrf01.test 7c7727c6b2c0e142f2c6a580244dc9e2252a0388ef3482b07d1a8eb61b0ed3ae
+F test/qrf01.test 8553f38836e3ea3320dd0ff908ee166e48ec6c1d7fc9ee81fd10c865fdc7e393
F test/qrf02.test 39b4afdc000bedccdafc0aecf17638df67a67aaa2d2942865ae6abcc48ba0e92
F test/queryonly.test 5f653159e0f552f0552d43259890c1089391dcca
F test/quick.test 1681febc928d686362d50057c642f77a02c62e57
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 712b890531d351cf19d57d8cc6dced5cdd2c394d69fd1ace98298d79ddca269a
-R ac97135f8cce6d7345e47fd96772396a
+P 23ddc38cf19845a385c8b33002805c3c864ab9b2e36c3d609794444b06d20c89
+R b6f6aa554fc5421ef5be83514503ceb2
U drh
-Z 9b6bf880f890c81874b8c914cec4e44f
+Z 55336ab4764d6f83d6e0beaecb47e53f
# Remove this line to create a well-formed Fossil manifest.
-23ddc38cf19845a385c8b33002805c3c864ab9b2e36c3d609794444b06d20c89
+871567e377e976e0bb191d466019d1d4abe126f2da1880f1e25cd92b06a666d1
** -defaultalign ("auto"|"left"|...) Default alignment
** -titalalign ("auto"|"left"|"right"|...) Default column name alignment
** -maxcolwidth NUMBER Max width of any single column
-** -maxtotalwidth NUMBER Max width of the entire table
+** -screenwidth NUMBER Width of the display TTY
** -maxrowheight NUMBER Max height of a row in a table
** -maxlength NUMBER Content truncated to this size
** -align LIST-OF-ALIGNMENT Alignment of columns
** -defaultalign eDfltAlign
** -titlealign eTitleAlign
** -maxcolwidth mxColWidth
-** -maxtotalwidth mxTotalWidth
+** -screenwidth nScreenWidth
** -maxrowheight mxRowHeight
** -maxlength mxLength
** -align nAlign, aAlign
}else if( strcmp(zArg,"-text")==0 || strcmp(zArg, "-title")==0 ){
static const char *azText[] = {
"auto", "csv", "html",
- "json", "off", "sql",
+ "json", "plain", "sql",
"tcl", 0
};
static unsigned char aTextMap[] = {
QRF_TEXT_Auto, QRF_TEXT_Csv, QRF_TEXT_Html,
- QRF_TEXT_Json, QRF_TEXT_Off, QRF_TEXT_Sql,
+ QRF_TEXT_Json, QRF_TEXT_Plain, QRF_TEXT_Sql,
QRF_TEXT_Tcl
};
int txt;
}
i++;
}else if( strcmp(zArg,"-maxcolwidth")==0
- || strcmp(zArg,"-maxtotalwidth")==0
+ || strcmp(zArg,"-screenwidth")==0
|| strcmp(zArg,"-maxrowheight")==0
){
int v = 0;
}else if( zArg[4]=='r' ){
qrf.mxRowHeight = v;
}else{
- qrf.mxTotalWidth = v;
+ qrf.nScreenWidth = v;
}
i++;
}else if( strcmp(zArg,"-maxlength")==0 ){
do_test 1.14 {
catch {db format -text unk -blob hex {SELECT * FROM t1}} res
set res
-} {bad text encoding (-text) "unk": must be auto, csv, html, json, off, sql, or tcl}
+} {bad text encoding (-text) "unk": must be auto, csv, html, json, plain, sql, or tcl}
do_test 1.15 {
catch {db format -text sql -blob unk {SELECT * FROM t1}} res
set res
}
do_test 1.112 {
set result "\n[db format -style list -columnnames on -text sql -null NULL \
- -title off {SELECT * FROM t1}]"
+ -title plain {SELECT * FROM t1}]"
} {
a|b|c
1|2.5|'three'
└─────────────────┴─────────────────┴────┘
}
do_test 4.3 {
- set result "\n[db format -text off -textjsonb on -maxcolwidth 11 \
+ set result "\n[db format -text plain -textjsonb on -maxcolwidth 11 \
{SELECT a AS json, b AS jsonb, c AS num FROM t1}]"
} {
┌─────────────┬─────────────┬─────┐
do_test 5.1 {
set sql {SELECT name, mtime, datetime(mtime,'unixepoch') AS time,
value FROM t1 ORDER BY mtime}
- set result "\n[db format -style line -maxtotalwidth 60 -blob sql \
+ set result "\n[db format -style line -screenwidth 60 -blob sql \
-text sql -wordwrap off -maxrowheight 77 $sql]"
} {
name = unistr('one\u000atwo\u000athree')
0000000000000000000000000000000000000000000000000000
000000000000000000000000000000'
}
-do_test 5.1 {
+do_test 5.2 {
set sql {SELECT name, mtime, datetime(mtime,'unixepoch') AS time,
value FROM t1 ORDER BY mtime}
- set result "\n[db format -style line -maxtotalwidth 60 -blob sql \
- -text off -esc off -textjsonb yes \
+ set result "\n[db format -style line -screenwidth 60 -blob sql \
+ -text plain -esc off -textjsonb yes \
-wordwrap yes -maxrowheight 3 $sql]"
} {
name = one