Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrapping Compiler and Messages lines #3834

Open
ntrel opened this issue Apr 13, 2024 · 4 comments
Open

Wrapping Compiler and Messages lines #3834

ntrel opened this issue Apr 13, 2024 · 4 comments

Comments

@ntrel
Copy link
Member

ntrel commented Apr 13, 2024

It would be good to have a popup menu check box to wrap lines.

There is a wrap property to render treeview lines, but I can't get that to work. Here's my branch:
https://github.com/ntrel/geany/commits/msgwin-wrap/

Even if you call g_object_set when the cell renderer is created, it still doesn't work because of a GTK bug:
https://stackoverflow.com/questions/17597043/gtk-cellrenderertext-makes-itself-really-tall-when-i-wrap-it

It was closed as won't fix:
https://gitlab.gnome.org/GNOME/gtk/-/issues/12

@ntrel
Copy link
Member Author

ntrel commented Apr 13, 2024

Apparently it is possible to do - python code, not tested:
kennydude/reference-cat@af79b56#diff-c333d6b766d6183dd76878d3003eb61b4f7c35b13a796c33ba05ab400e2ecbaa

@elextr
Copy link
Member

elextr commented Apr 13, 2024

According to the GTK wrap-mode link in your OP the wrap-width property also needs to be set as well, its not in your WIP commit so unless its already set somewhere else in Geany it needs to be added.

Note the Python code sets wrap-width.

@ntrel
Copy link
Member Author

ntrel commented Apr 13, 2024

@elextr No, it's in the WIP commit.

g_object_set(cell_renderers[type], "wrap-mode", PANGO_WRAP_WORD,
"wrap-width", set ? 30 : -1, NULL);

The python tree view callback didn't work.

@elextr
Copy link
Member

elextr commented Apr 14, 2024

I had a short time to try things.

Based on your status window code, set wrap-mode and wrap-width (which is pixels not characters).

Testing with status window on the right so the width can be changed with the pane separator sees wrapping happen fine at the set wrap-width or the window width if it is greater than wrap-width. So wrap-width sets the minimum wrap width in pixels, if less space is available it simply hides part of the column like normal.

But row heights are not recalculated, it is calculated when data is first added to the row and left at the height needed for wrap-width since this is big enough to contain the worst case. That is why various examples on the web show massive blank space when wrap-width was set small (like 50 in one example) and so the row height was calculated based on that value but he text wrapped based on the actual widget width.

Your attempt to use the callback to reset wrap-width seemed a good idea, but for me it is never called with signal check-resize (printf debugging :-). Maybe another signal could work better?

Alternatively given the uses it should be enough if we can calculate the right value for wrap-width based on the layout and just leave it since none of the message windows change their existing contents and new lines added (eg in status) get their height based on the wrap-width. This won't change the height if the window is resized after it has content, but that won't matter so much for compiler and messages which are reset regularly, so long as the new wrap-width is used when the new data is added. With this model status probably should be left unwrapped and of course its irrelevant to scribble and terminal.

I have run out of time now, over to you.

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

No branches or pull requests

2 participants