Skip to content

/files truncates filenames when status description is present #8

@tzonghao

Description

@tzonghao

The /files SelectList uses the description field for git status ([M], [??]), which causes the component to reserve space and aggressively truncate the label (file path) from the right:

  scripts/visualize_support_r3_m [??]
→ src/gcode_generator/support/co [M]
  scripts/visualize_r3_toy_modes [??]
  src/gcode_generator/support/gc [M]

Fix: Append the status to the label instead of using description, so SelectList treats it as a single string and gives maximum width to the path:

 const items: SelectItem[] = files.map((file) => {
     const directoryLabel = file.isDirectory ? " [directory]" : "";
-    return {
-        value: file.canonicalPath,
-        label: `${file.displayPath}${directoryLabel}`,
-        description: file.status ? `[${file.status}]` : undefined,
-    };
+    const statusSuffix = file.status ? ` [${file.status}]` : "";
+    return {
+        value: file.canonicalPath,
+        label: `${file.displayPath}${directoryLabel}${statusSuffix}`,
+    };
 });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions