]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
CLI: Fix the new ".mode box" output so that it works with unicode characters.
authordrh <>
Mon, 31 Jan 2022 10:55:50 +0000 (10:55 +0000)
committerdrh <>
Mon, 31 Jan 2022 10:55:50 +0000 (10:55 +0000)
FossilOrigin-Name: 454af48724c78bf8e06379a426e01b1597f56fcc83211ee062ff0dbeb6a140b1

manifest
manifest.uuid
src/shell.c.in

index af137deae4813147f204901adbb4d9181bf8b533..0d0679fac4cdac4f22bce14496a62a055143b243 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C CLI:\sFor\scolumnar\smodes\s("box",\s"column",\s"table",\s"markdown")\sthe\s".width"\nis\snow\sboth\sthe\sminimum\sand\smaximum\swidth\sof\sthe\scolumn.\s\sText\sthat\sspans\nmultiple\slines\sor\sthat\scontains\stabs\sis\sproperly\sformatted.\s\sIf\sany\spart\sof\nthe\soutput\scontains\smulti-line\stext,\sthen\sextra\sseparators\sare\sprovided\sbetween\neach\srow.
-D 2022-01-30T21:09:03.044
+C CLI:\sFix\sthe\snew\s".mode\sbox"\soutput\sso\sthat\sit\sworks\swith\sunicode\scharacters.
+D 2022-01-31T10:55:50.702
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -553,7 +553,7 @@ F src/random.c 097dc8b31b8fba5a9aca1697aeb9fd82078ec91be734c16bffda620ced7ab83c
 F src/resolve.c 24032ae57aec10df2f3fa2e20be0aae7d256bc704124b76c52d763440c7c0fe9
 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
 F src/select.c a6d2d4bed279d7fe4fcedaf297eaf6441e8e17c6e3947a32d24d23be52ac02f2
-F src/shell.c.in b33ead0e7e22264d229ed7a5aa61a65c4564fd4ef21ff0321ff7b6f02ccf6c9b
+F src/shell.c.in c0fa21db3a4b0f6204b5cc6b14eb452933f5588ae0b4840144380ebd876e8e90
 F src/sqlite.h.in eaade58049152dac850d57415bcced885ca27ae9582f8aea2cfb7f1db78a521b
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h 5d54cf13d3406d8eb65d921a0d3c349de6126b732e695e79ecd4830ce86b4f8a
@@ -1942,8 +1942,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 8c9f350182140604a71e11d226acb3f80d1f2b4f75e5c3b55ec8f8a7c02941f3
-R 22a2c9cbde362213afbf92ae8fdaba40
+P c10ed4a7fe33fd9330967ab714b1f09ad57c972997160dfc71477e43b905f69c
+R 8e4ffa89b298574bd8cb466fdf156b79
 U drh
-Z 0aba3faa9f23b01df6c28283e34cf7d3
+Z 789ef5c7438d14872b9f52b0dc5ffba5
 # Remove this line to create a well-formed Fossil manifest.
index 39dcc4d130e7ecdd3c0535f8a8543fb49dd674d4..5355010056a9b759c910706a2315d3928efe2cdf 100644 (file)
@@ -1 +1 @@
-c10ed4a7fe33fd9330967ab714b1f09ad57c972997160dfc71477e43b905f69c
\ No newline at end of file
+454af48724c78bf8e06379a426e01b1597f56fcc83211ee062ff0dbeb6a140b1
\ No newline at end of file
index 7e1f504a95f8cb1108f169df4caa4346768b1966..73dee2dc8efb57bbd069e06824b0ecf8488b1841 100644 (file)
@@ -3180,7 +3180,7 @@ static char *translateForDisplayAndDup(
   const unsigned char **pzTail,
   int mxWidth
 ){
-  int i, n;
+  int i, j, n;
   unsigned char *zOut;
   if( z==0 ){
     *pzTail = 0;
@@ -3188,14 +3188,18 @@ static char *translateForDisplayAndDup(
   }
   if( mxWidth<0 ) mxWidth = -mxWidth;
   if( mxWidth==0 ) mxWidth = 1000000;
-  i = n = 0;
+  i = j= n = 0;
   while( n<mxWidth ){
     if( z[i]>=' ' ){
       n++;
-      i++;
+      do{ i++; j++; }while( (z[i]&0xc0)==0x80 );
       continue;
     }
     if( z[i]=='\t' ){
+      do{
+        n++;
+        j++;
+      }while( (n&7)!=0 && n<mxWidth );
       n += 8;
       n &= ~7;
       i++;
@@ -3207,29 +3211,31 @@ static char *translateForDisplayAndDup(
    *pzTail = &z[i];
   }else if( z[i]=='\r' && z[i+1]=='\n' ){
     *pzTail = z[i+2] ? &z[i+2] : 0;
-  }else if( z[i]==0 ){
+  }else if( z[i]==0 || z[i+1]==0 ){
     *pzTail = 0;
   }else{
     *pzTail = &z[i+1];
   }
-  zOut = malloc( n+1 );
+  zOut = malloc( j+1 );
   shell_check_oom(zOut);
-  i = n = 0;
+  i = j = n = 0;
   while( n<mxWidth ){
     if( z[i]>=' ' ){
-      zOut[n++] = z[i++];
+      n++;
+      do{ zOut[j++] = z[i++]; }while( (z[i]&0xc0)==0x80 );
       continue;
     }
     if( z[i]=='\t' ){
       do{
-        zOut[n++] = ' ';
+        n++;
+        zOut[j++] = ' ';
       }while( (n&7)!=0 && n<mxWidth );
       i++;
       continue;
     }
     break;
   }
-  zOut[n] = 0;
+  zOut[j] = 0;
   return (char*)zOut;  
 }