mwh/dragon

Is resizing locked?

pvonmoradi opened this issue ยท 4 comments

Is it possible to resize the dragon window?
Currently, it prints the complete path of the file as entry. It makes it cumbersome to place the window around. Is it possible to somehow resize the window to line-wrap the entries (so window size is grown vertically not horizontally)?
Excellent project BTW ๐Ÿ’ฏ ๐Ÿ˜ƒ
image

mwh commented

Yes, the window is not resizable and just fits its contents exactly at their natural size. It doesn't handle extremely long file paths like this well. Word wrapping could be possible, or perhaps it should just truncate at a certain length; wrapping will fall over eventually too.

mwh commented

On reflection, it's not really the fact that it's set non-resizable that's an issue here, it's that it still wouldn't resize below the buttons' natural size anyway - you could only make the window bigger, not smaller. That means there's not a quick fix without deciding what the right behaviour is, and it probably needs to be flagged behind an option because it will be a substantive difference.

Abbreviating to only the basename is the simplest for many cases, but not useful for this actual situation, but cutting off either end is not generally right either. I'm not sure what the right path is here. I don't think GTK provides a "trim the middle to fit" option.

@mwh Some editors like VScode or Vim airline plugin have an option to "shorten" the file path:
https://stackoverflow.com/a/13168317/1506761

...
I.e. "/home/user/foo/bar/baz.vim" becomes "~/f/b/baz.vim" and
           "long/relative/path/foo/bar/baz.vim becomes
           "long/r/p/f/b/baz.vim"

Perhaps allowing to pass something like --trim-filename-to INT could be a reasonable simple solution? If present, will trim the filename to INT symbols from the end.