Fossil SCM

Vary the number of columns of displayed files in the File List depending on the length of the longest filename in the list.

drh 2011-10-15 17:36 trunk
Commit ee723ed98ddb0a712da0521b0a0df1b64ddbd741
1 file changed +3 -1
+3 -1
--- src/browse.c
+++ src/browse.c
@@ -249,11 +249,13 @@
249249
/* Generate a multi-column table listing the contents of zD[]
250250
** directory.
251251
*/
252252
mxLen = db_int(12, "SELECT max(length(x)) FROM localfiles /*scan*/");
253253
cnt = db_int(0, "SELECT count(*) FROM localfiles /*scan*/");
254
- nCol = 4;
254
+ nCol = 100/mxLen;
255
+ if( nCol<1 ) nCol = 1;
256
+ if( nCol>5 ) nCol = 5;
255257
nRow = (cnt+nCol-1)/nCol;
256258
db_prepare(&q, "SELECT x, u FROM localfiles ORDER BY x /*scan*/");
257259
@ <table class="browser"><tr><td class="browser"><ul class="browser">
258260
i = 0;
259261
while( db_step(&q)==SQLITE_ROW ){
260262
--- src/browse.c
+++ src/browse.c
@@ -249,11 +249,13 @@
249 /* Generate a multi-column table listing the contents of zD[]
250 ** directory.
251 */
252 mxLen = db_int(12, "SELECT max(length(x)) FROM localfiles /*scan*/");
253 cnt = db_int(0, "SELECT count(*) FROM localfiles /*scan*/");
254 nCol = 4;
 
 
255 nRow = (cnt+nCol-1)/nCol;
256 db_prepare(&q, "SELECT x, u FROM localfiles ORDER BY x /*scan*/");
257 @ <table class="browser"><tr><td class="browser"><ul class="browser">
258 i = 0;
259 while( db_step(&q)==SQLITE_ROW ){
260
--- src/browse.c
+++ src/browse.c
@@ -249,11 +249,13 @@
249 /* Generate a multi-column table listing the contents of zD[]
250 ** directory.
251 */
252 mxLen = db_int(12, "SELECT max(length(x)) FROM localfiles /*scan*/");
253 cnt = db_int(0, "SELECT count(*) FROM localfiles /*scan*/");
254 nCol = 100/mxLen;
255 if( nCol<1 ) nCol = 1;
256 if( nCol>5 ) nCol = 5;
257 nRow = (cnt+nCol-1)/nCol;
258 db_prepare(&q, "SELECT x, u FROM localfiles ORDER BY x /*scan*/");
259 @ <table class="browser"><tr><td class="browser"><ul class="browser">
260 i = 0;
261 while( db_step(&q)==SQLITE_ROW ){
262

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button