Skip to content

Fix grid textfield not displaying values longer than 633 characters#94

Open
MarekMudron wants to merge 1 commit into
litedb-org:masterfrom
MarekMudron:master
Open

Fix grid textfield not displaying values longer than 633 characters#94
MarekMudron wants to merge 1 commit into
litedb-org:masterfrom
MarekMudron:master

Conversation

@MarekMudron
Copy link
Copy Markdown

@MarekMudron MarekMudron commented Apr 22, 2026

Fixes #35

Summary by CodeRabbit

  • Style
    • Data grid columns now display with fixed width sizing (150px) instead of dynamically adjusting based on content, providing consistent and predictable layout across data tables
    • Long text values in grid cells are now truncated to 150 characters followed by ellipsis, improving visual clarity and preventing layout disruption caused by extended data entries

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

Caution

Review failed

Failed to post review comments

📝 Walkthrough

Walkthrough

The changes address data display issues in the LiteDB Studio UI by implementing fixed column widths and text truncation. Cell data handling is modified to store BSON values in both the Value and Tag properties, while formatted strings exceeding 150 characters are truncated with ellipsis during cell rendering.

Changes

Cohort / File(s) Summary
Column and Cell Data Handling
LiteDB.Studio/Classes/UIExtensions.cs
Modified column sizing from auto-fit to fixed 150-pixel width; updated cell assignment to store computed BSON values in both cell.Value and cell.Tag properties.
Cell Display Formatting
LiteDB.Studio/Forms/MainForm.cs
Added logic to truncate string values longer than 150 characters with ellipsis in grid cell display.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A curious carrot once hid from the view,
Buried in data—too much to break through!
Now columns stand steady at one-fifty wide,
And long strings get trimmed with "..." as our guide,
The database garden displays every prize! 🥕✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the fix: addressing grid textfield display failures for values longer than 633 characters, which directly resolves the core issue.
Linked Issues check ✅ Passed The code changes align with issue #35 requirements: they fix grid display for large JSON values by truncating display to 150 characters and storing full values in cell.Tag, enabling proper rendering of large datasets.
Out of Scope Changes check ✅ Passed All changes are scoped to grid display functionality in UIExtensions.cs and MainForm.cs, directly addressing the display truncation issue without introducing unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@LiteDB.Studio/Forms/MainForm.cs`:
- Around line 819-822: The CellFormatting handler in MainForm.cs is replacing
e.Value with a truncated string (the if block that uses str.Substring(0, 150)),
which prevents the grid from ever showing the full cell content even after
column resize; remove that truncation and leave e.Value unchanged (do not assign
the shortened string), so the grid will clip visually per UIExtensions' fixed
widths; if a hover preview is desired later, populate the cell's ToolTipText or
similar instead of modifying e.Value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1891355e-4b5c-4872-83cb-9e9d51863de5

📥 Commits

Reviewing files that changed from the base of the PR and between 58def09 and 102af29.

📒 Files selected for processing (2)
  • LiteDB.Studio/Classes/UIExtensions.cs
  • LiteDB.Studio/Forms/MainForm.cs

Comment on lines +819 to +822
if (e.Value is string str && str.Length > 150)
{
e.Value = str.Substring(0, 150) + "...";
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Don’t replace the formatted cell value with a truncated preview.

Line 821 makes the grid display only the first 150 characters, so long JSON/text still cannot be fully viewed in the grid after resizing the column. Since UIExtensions now uses fixed initial widths, keep e.Value intact and let the grid clip visually.

🐛 Proposed fix
-            if (e.Value is string str && str.Length > 150)
-            {
-                e.Value = str.Substring(0, 150) + "...";
-            }
+            // Keep the full formatted value available in the grid; the fixed
+            // column width clips the visual rendering without losing content.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (e.Value is string str && str.Length > 150)
{
e.Value = str.Substring(0, 150) + "...";
}
// Keep the full formatted value available in the grid; the fixed
// column width clips the visual rendering without losing content.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@LiteDB.Studio/Forms/MainForm.cs` around lines 819 - 822, The CellFormatting
handler in MainForm.cs is replacing e.Value with a truncated string (the if
block that uses str.Substring(0, 150)), which prevents the grid from ever
showing the full cell content even after column resize; remove that truncation
and leave e.Value unchanged (do not assign the shortened string), so the grid
will clip visually per UIExtensions' fixed widths; if a hover preview is desired
later, populate the cell's ToolTipText or similar instead of modifying e.Value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Column data not displayed

1 participant