From: drh <> Date: Tue, 7 Jul 2026 12:24:50 +0000 (+0000) Subject: Improved title separator in QRF when using "-title always" on an empty row. X-Git-Url: http://git.ipfire.org/index.cgi?a=commitdiff_plain;h=9c202c32c16a8154abac2b2b2d261fc68c9d65fa;p=thirdparty%2Fsqlite.git Improved title separator in QRF when using "-title always" on an empty row. Improved comments on the mode matrix in the CLI code. Additional test cases. FossilOrigin-Name: a102d28fca6376da670b274d3d733da2c73da9abe3e7128defd04b4015b03a48 --- diff --git a/ext/qrf/qrf.c b/ext/qrf/qrf.c index 6efb1c8ada..c90a134c13 100644 --- a/ext/qrf/qrf.c +++ b/ext/qrf/qrf.c @@ -1648,6 +1648,10 @@ static void qrfRowSeparator(sqlite3_str *pOut, qrfColData *p, char cSep){ #define DBL_123 "\342\225\236" /* U+255e |= */ #define DBL_134 "\342\225\241" /* U+2561 =| */ #define DBL_1234 "\342\225\252" /* U+256a =|= */ +#define DBL_12 "\342\225\230" /* U+2558 `= */ +#define DBL_14 "\342\225\233" /* U+255b =' */ +#define DBL_124 "\342\225\247" /* U+2567 ='= */ + /* Draw horizontal line N characters long using unicode box ** characters @@ -1670,12 +1674,12 @@ static void qrfBoxLine(sqlite3_str *pOut, int N, int bDbl){ ** Draw a horizontal separator for a QRF_STYLE_Box table. */ static void qrfBoxSeparator( - sqlite3_str *pOut, - qrfColData *p, - const char *zSep1, - const char *zSep2, - const char *zSep3, - int bDbl + sqlite3_str *pOut, /* Output to this sqlite3_str */ + qrfColData *p, /* Columnar data */ + const char *zSep1, /* Left margin */ + const char *zSep2, /* Column separator */ + const char *zSep3, /* Right margin */ + int bDbl /* True for double-lines */ ){ int i; if( p->nCol>0 ){ @@ -1695,6 +1699,32 @@ static void qrfBoxSeparator( sqlite3_str_append(pOut, "\n", 1); } +/* +** Draw a horizontal separator for a QRF_STYLE_Column table. +** This style of separator is only used for separating the title +** from the content. +*/ +static void qrfColumnSeparator( + sqlite3_str *pOut, /* Output to this sqlite3_str */ + qrfColData *p, /* Columnar data */ + const char *colSep, /* Column separator text */ + int szColSep, /* Size of zColSep in bytes */ + const char *rowSep, /* Row separator text */ + int szRowSep /* Size of zRowSep in bytes */ +){ + int j; + int nColumn = p->nCol; + for(j=0; ja[j].w, '-'); + if( jpOut, data.a[j].w, '-'); - if( jpOut, colSep, szColSep); - }else{ - qrfRTrim(p->pOut); - sqlite3_str_append(p->pOut, rowSep, szRowSep); - } - } + qrfColumnSeparator(p->pOut, &data, colSep, szColSep, + rowSep, szRowSep); }else if( data.bMultiRow ){ qrfRTrim(p->pOut); sqlite3_str_append(p->pOut, "\n", 1); @@ -2292,11 +2315,21 @@ static void qrfColumnar(Qrf *p){ if( p->spec.bBorder!=QRF_No || p->nRow==0 ){ switch( p->spec.eStyle ){ case QRF_STYLE_Box: - qrfBoxSeparator(p->pOut, &data, BOX_R12, BOX_124, BOX_R14, 0); + if( p->nRow>0 ){ + qrfBoxSeparator(p->pOut, &data, BOX_R12, BOX_124, BOX_R14, 0); + }else{ + qrfBoxSeparator(p->pOut, &data, DBL_12, DBL_124, DBL_14, 1); + } break; case QRF_STYLE_Table: qrfRowSeparator(p->pOut, &data, '+'); break; + case QRF_STYLE_Column: + if( p->nRow==0 ){ + qrfColumnSeparator(p->pOut, &data, colSep, szColSep, + rowSep, szRowSep); + } + break; } } if( p->spec.bRowCount==QRF_Yes ){ diff --git a/manifest b/manifest index 61f6efa70e..e516045294 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Show\s--rowcount\sfor\s"--style\sinsert".\s\sNew\stest\scases. -D 2026-07-07T11:00:10.684 +C Improved\stitle\sseparator\sin\sQRF\swhen\susing\s"-title\salways"\son\san\sempty\srow.\nImproved\scomments\son\sthe\smode\smatrix\sin\sthe\sCLI\scode.\s\sAdditional\stest\ncases. +D 2026-07-07T12:24:50.291 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -425,7 +425,7 @@ F ext/misc/zipfile.c 5cf901996c840b32a5c03d947c4ee86bda166f6e595a41871840df85204 F ext/misc/zorder.c bddff2e1b9661a90c95c2a9a9c7ecd8908afab5763256294dd12d609d4664eee F ext/qrf/README.md 3dfd5de860cdc0c572d8926ba0c1b3cc8925487dfbda10e63af66a8811907687 F ext/qrf/dev-notes.md e68a6d91ce4c7eb296ef2daadc2bb79c95c317ad15b9fafe40850c67b29c2430 -F ext/qrf/qrf.c 660da110dcf6e0b458fba4ac5d6609b633efc6dddd64e2bc5af7f8a0579b7475 +F ext/qrf/qrf.c e8c8ff93bb834c28921e6b021922750f4fa6ed929f39b95c1137029e141ef25e F ext/qrf/qrf.h fcbc33578176b2fd9dda8310d8f6ba4eaf4f75052f466dfe682802e6664df8bd F ext/rbu/rbu.c 801450b24eaf14440d8fd20385aacc751d5c9d6123398df41b1b5aa804bf4ce8 F ext/rbu/rbu1.test 25870dd7db7eb5597e2b4d6e29e7a7e095abf332660f67d89959552ce8f8f255 @@ -743,7 +743,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 54395ee97eb710e695202d4112cf2b1c1c7767a57afcea745df71abb1c917768 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c f553420eaf5c72a49cef786621eea79dd8c4411671839fb05250bb49ca74a0a0 -F src/shell.c.in ad7b45289ca6867ca2d87230aefc5acc63b86511f9605f23765b0129105e5576 +F src/shell.c.in c6ec9326fff4986734aa00d5aa38d4cf486f651a6765aceb04e30cda580d0810 F src/sqlite.h.in d9ec41feb4cd804e68b174328b43beb3f1f71bba13e1c7a439efb826d301cccc F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 F src/sqlite3ext.h 0efd4723bad9124ea1f581d9f1ea0254ac1c6f3e5fb29e4f3dcf36c72485a456 @@ -1461,7 +1461,7 @@ F test/mmap4.test 2e2b4e32555b58da15176e6fe750f17c9dcf7f93 F test/mmapcorrupt.test 470fb44fe92e99c1d23701d156f8c17865f5b027063c9119dcfdb842791f4465 F test/mmapfault.test d4c9eff9cd8c2dc14bc43e71e042f175b0a26fe3 F test/mmapwarm.test 2272005969cd17a910077bd5082f70bc1fefad9a875afec7fc9af483898ecaf3 -F test/modeA.sql eda688a95bfed5da5b8516ada67db3b696e903cd5bd2a0b900300cb2e5f64451 +F test/modeA.sql 07e757d4e28ab20217d4350544cb752845886807bfd5a4c2ccc3c471340fd797 F test/multiplex.test d74c034e52805f6de8cc5432cef8c9eb774bb64ec29b83a22effc8ca4dac1f08 F test/multiplex2.test 580ca5817c7edbe4cc68fa150609c9473393003a F test/multiplex3.test fac575e0b1b852025575a6a8357701d80933e98b5d2fe6d35ddaa68f92f6a1f7 @@ -1533,7 +1533,7 @@ F test/printf2.test 3f55c1871a5a65507416076f6eb97e738d5210aeda7595a74ee895f2224c F test/progress.test ebab27f670bd0d4eb9d20d49cef96e68141d92fb F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc F test/pushdown.test 46a626ef1c0ca79b85296ff2e078b9da20a50e9b804b38f441590c3987580ddd -F test/qrf01.test dafebb59e6aa6523b5bf6ff64d1992bbf869be9c221fb18567a67d04874f69ca +F test/qrf01.test 6fcb3d252d2a855eba4fa5d64002286fdafe40b8fb608337c041b60865f9f636 F test/qrf02.test 39b4afdc000bedccdafc0aecf17638df67a67aaa2d2942865ae6abcc48ba0e92 F test/qrf03.test e7efe46d204671726b4707585126cd78d107368de4a7d0c7b8d5157cdd8624ed F test/qrf04.test 0894692c998d2401dcc33449c02051b503ecce0c94217be54fb007c82d2d1379 @@ -2213,8 +2213,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c -P adeb4fbb86a8a781d7efb0eecb9c84ce605d0bd45f63992bf2ecd60765a60d2c -R f7fdf80c6283e7cb9c051183725987bf +P 386c40e3a9706111542b7f336e82f7bb6e9f43c6056185f9f3bd9aae1159070a +R 97c4c759605f34012aa08b81926f369d U drh -Z 2ec65d5f66458affd3eb44f92e876b01 +Z 0742604b3741cfad8c5b1bef622a5b3f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index cffa2e7ba8..b12c53f667 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -386c40e3a9706111542b7f336e82f7bb6e9f43c6056185f9f3bd9aae1159070a +a102d28fca6376da670b274d3d733da2c73da9abe3e7128defd04b4015b03a48 diff --git a/src/shell.c.in b/src/shell.c.in index c9ebae848c..5536ab32fc 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -602,19 +602,19 @@ static const ModeInfo aModeInfo[] = { { "tabs", 8, 1, 9, 3, 3, 0, 1, 12, 0, 0 }, { "tcl", 3, 1, 12, 5, 5, 4, 1, 12, 0, 0 }, { "www", 0, 0, 9, 4, 4, 0, 2, 7, 0, 0 } -}; /* | / / | / / | | \ - ** | / / | / / | | \_ 2: columnar - ** Index into aModeStr[] | / / | | 1: line - ** | / / | | 0: other - ** | / / | \ - ** text encoding |/ | show | \ - ** v-------------------' | hdrs? | The QRF style - ** 0: n/a blob | v-----' - ** 1: plain v----------' 0: n/a - ** 2: sql 0: auto 1: no - ** 3: csv 1: as-text 2: yes - ** 4: html 2: sql 3: always - ** 5: c 3: hex +}; /* | / / | / / | | / \____ + ** | / / | / / | | / | + ** Index into aModeStr[] | / / | | 2: columnar | + ** | / / | | 1: line | + ** | / / | | 0: other | + ** text encoding |/ | show | | | + ** v-------------------' | hdrs? | The QRF style | + ** 0: n/a blob | v-----' / + ** 1: plain v----------' 0: n/a _________/ + ** 2: sql 0: auto 1: no | + ** 3: csv 1: as-text 2: yes 1: border-off + + ** 4: html 2: sql 3: always title-always + ** 5: c 3: hex 2: split-column ** 6: json 4: c ** 5: json ** 6: size diff --git a/test/modeA.sql b/test/modeA.sql index 02199b5005..d7c969c8c4 100644 --- a/test/modeA.sql +++ b/test/modeA.sql @@ -377,3 +377,32 @@ END .check <