Bug 497328 - Minimum "Variables" window size in the External Tools configuration can be arbitrarily large
Summary: Minimum "Variables" window size in the External Tools configuration can be ar...
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: scripting (other bugs)
Version First Reported In: 24.08.1
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-11 15:15 UTC by Thomas
Modified: 2024-12-14 20:34 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Minimum window width 29179 pixels (301.19 KB, image/png)
2024-12-11 15:15 UTC, Thomas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas 2024-12-11 15:15:11 UTC
Created attachment 176525 [details]
Minimum window width 29179 pixels

SUMMARY

Minimum width of the Variables selection window of the External tools "Edit Tool" window can depend on the longest line in the current document. With long line numbers, the minimum window width can be 100k+ pixels.

STEPS TO REPRODUCE
1. Have a document with a long line, for example a minified JSON without line breaks or whatever. 
  Use this Python one-liner to generate a 2k line to put into the editor: `python -c "import secrets; print(secrets.token_hex(2000))"`
2. Click on Tools menu → External Tools → Configure…
3. Click "Add" → "Add Tool…"
4. In the Edit Tool window, click "{}" (Insert Variable) next to "Input:" to configure the tools standard input
5. In the opened Variables window, click variable "Document:Text"
6. Observe that the minimum window width shoots up to accommodate the whole line

OBSERVED RESULT

See attached screenshot. Minimum window width of the Variables window shoots up to ~30k pixels when the document contains a line with 2k characters.

EXPECTED RESULT

The window should still fit on screen.

The window uses a QLabel to show the variable content. This label should either be embedded in a scroll area or be somewhat sanitized to not blow up window dimensions.

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 24.10
KDE Plasma Version: 6.1.5
KDE Frameworks Version: 6.6.0
Qt Version: 6.6.2
Kernel Version: 6.11.0-9-generic (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 3700X 8-Core Processor
Memory: 62.7 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1070/PCIe/SSE2


ADDITIONAL INFORMATION

Why I got that result: The PC game Factorio allows exporting designs via base64 encoded strings, which it outputs as a single line that can become quite large. It also accepts input with line breaks. In-/output is done via the clipboard, which encourages pasting into text editors. So I wanted to add a tool to automatically re-format these to a text block for easier sharing and posting online.
Comment 1 Christoph Cullmann 2024-12-14 20:34:57 UTC
Git commit 9548e531288897cebfd25be12aa9de06b439e088 by Christoph Cullmann.
Committed on 14/12/2024 at 20:29.
Pushed by cullmann into branch 'master'.

ensure content like from document doesn't make the dialog size explode

M  +11   -1    src/utils/katevariableexpansionhelpers.cpp

https://invent.kde.org/frameworks/ktexteditor/-/commit/9548e531288897cebfd25be12aa9de06b439e088