commit ce7de3d9a50ea2f500573ee1db1527a3f2bc97c6
parent d8639a3bbcfff52999055fe529cc95b690657763
Author: bsandro <[email protected]>
Date: Wed, 11 Sep 2024 19:09:25 +0300
Fixed the truncated names issue
Diffstat:
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/gui/main.c b/gui/main.c
@@ -225,11 +225,12 @@ int ButtonDialogOpenEvent(UIElement *element, UIMessage msg, int di, void *dp) {
+ sort directories before files in list
+ do not display "." item
+ filter files to only show those with .webp extension
-- (bug) displayed file name is truncated
++ (bug) displayed file name is truncated
- move the whole subroutine into a separate file
- (bug) reset scroll on directory change
- sort filenames alphabetically
+ (bug) path and name are being concatenated during copying
+- prohibit interaction with parent window
*/
static int FilelistFilter(const struct dirent *f) {
@@ -260,14 +261,16 @@ int TableEvent(UIElement *element, UIMessage msg, int di, void *dp) {
UITable *table = (UITable *)element;
if (filelist==NULL) {
table->itemCount = scandir(dir_name, &filelist, FilelistFilter, FilelistCompare);
- printf("populated dir %s with %d items\n", dir_name, table->itemCount);
+ //printf("populated dir %s with %d items\n", dir_name, table->itemCount);
}
if (msg==UI_MSG_TABLE_GET_ITEM) {
UITableGetItem *m = (UITableGetItem *)dp;
m->isSelected = selected==m->index;
bool is_dir = filelist[m->index]->d_type==DT_DIR;
//printf("render %s (%d)\n", filelist[m->index]->d_name, m->bufferBytes);
- return snprintf(m->buffer, m->bufferBytes, is_dir?"[%s]":"%s", filelist[m->index]->d_name);
+ int ret = snprintf(m->buffer, m->bufferBytes, is_dir?"[%s]":"%s", filelist[m->index]->d_name);
+ //printf("%s - %d (%d)\n", filelist[m->index]->d_name, ret, m->bufferBytes);
+ return ret;
} else if (msg==UI_MSG_CLICKED) {
int hit = UITableHitTest(table, element->window->cursorX, element->window->cursorY);
if (hit!=-1 && selected==hit) {
@@ -320,6 +323,9 @@ int TableEvent(UIElement *element, UIMessage msg, int di, void *dp) {
printf("destroy table\n");
filelist = NULL;
selected = -1;
+ } else if (msg==UI_MSG_UPDATE) {
+ //printf("processing table signal %d\n", msg);
+ UITableResizeColumns(table);
}
return 0;
}