Geany 1.38 shows a Gtk-Warning at startup
``` (geany:29297): Gtk-WARNING **: 00:58:33.911: Negative content height -6 (allocation 1, extents 7x0) while allocating gadget (node scrollbar, owner GtkScrollbar) ``` This seems to be triggered when: 1. the file being opened at startup contains a long current (saved) line that stretches beyond the current window size (in this case it was maximized) 2. AND the Line wrapping is enabled in preferences (Preferences>Editor[Features]:Line wrapping)
Geany starts and opens the file Ok, however the line in question appears non-wrapped, yet it's expected to be.
---------------
``` geany -V geany 1.38 (built on 2020-12-19 with GTK 3.22.30, GLib 2.56.4)
uname -a Linux testbox 5.4.0-58-generic #64~18.04.1-Ubuntu SMP Wed Dec 9 17:11:11 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux ```
WFM
09:41:21: Geany INFO : Geany 1.37 (git >= 915cf6e8), en_AU.UTF-8 09:41:21: Geany INFO : GTK 3.24.20, GLib 2.64.3 09:41:21: Geany INFO : OS: Linux Mint 20 (ulyana)
PS please post the debug messages, they show the runtime versions being used, not the version Geany was compiled against, they need not be the same.
Below is a test file (test-long-line.txt) that produces the warning.
The steps to trigger the warning:
1. Start from a clean configuration, disable plugins ``` G_MESSAGES_DEBUG=all geany -v -p -c test-config ``` 2. Open the test-long-line.txt 3. Turn *Preferences>Editor[Features]:Line wrapping: ON* 4. Close Geany 5. Re-open Geany ``` G_MESSAGES_DEBUG=all geany -v -p -c test-config ``` The warning is shown ``` (geany:5387): Gtk-WARNING **: 02:41:25.761: Negative content height -6 (allocation 1, extents 7x0) while allocating gadget (node scrollbar, owner GtkScrollbar) ``` 6. Disable the line wrapping: *Preferences>Editor[Features]:Line wrapping: OFF* 7. Re-open Geany ``` G_MESSAGES_DEBUG=all geany -v -p -c test-config ``` NO warning is shown
----------- [test-long-line.txt](https://github.com/geany/geany/files/5728752/test-long-line.txt)
Still WFM, please provide the lines from your `help->debug messages` that I posted, and what desktop you are using.
Note that the line not being wrapped is correct, changing the preference does not wrap/unwrap already open files, and a file that is open has its state saved when Geany is closed and re-opens in the same state, in this case unwrapped. This is because wrapping is a per-file setting `Document->Line Wrapping` so a user can set it to be different from the preference, and that is respected. The preference will only apply to newly opened files.
In general, this issue results in incorrect intialisation of the editor's horizontal scrollbar (at least on my platform, see the Geany-INFO in OP)
Further debugging yields more pointers at the cause of this issue.
The warning seems to result from `Scintilla::ScintillaGTK::Resize()` call triggered by `sci_set_lines_wrapped()` during [`open_session_file()`](../geany/blob/402d277f80b508e89440fe3669ce3f2f45768cc7/src/keyfile.c#L1237) at start-up.
Precisely, the `editor_set_line_wrapping()` is what trips the warning:
https://github.com/geany/geany/blob/402d277f80b508e89440fe3669ce3f2f45768cc7...
From what I could understand, in this context the intent of this call is to properly configure the editor for each file re-loaded from the previous session. So the effect of this call should be setting of the `doc->editor->line_wrapping` from the previously saved state (from session file).
Indeed, amending this line into: ``` doc->editor->line_wrapping = line_wrapping ``` fixes the warning and corrects the initialisation of the scrollbar.
Looking closer at what this does, this change removes an extra Sci-call to `SSM(sci, SCI_SETWRAPMODE, SC_WRAP_WORD, 0)`, which requests a reset of the line-wrapping mode. In this context it appears to be unnecessary, as the correct line-wraping mode has been already set up during the creation of the document in `document_open_file_full()`, which subsequently calls `sci_set_lines_wrapped(sci, editor->line_wrapping)` from `create_new_sci()`:
https://github.com/geany/geany/blob/402d277f80b508e89440fe3669ce3f2f45768cc7...
Hope this is helpful. Perhaps, someone more familiar with this context could comment on the need for this seemingly redundant Sci-call. If this change indeed makes sense, I can produce a PR for it.
AFAICT `document_open_full()` does not set the _per file_ line wrapping, it uses the default wrapping setting because it is generally used to open new files, and they get the default setting as I explained above.
Then `open_session_file()` sets the wrapping to the value saved in the session and tells Scintilla to do that. Your suggested change (as I understand it) will not tell Scintilla, so the display won't be changed to match to the value saved in the session file.
Changing wrappings should not cause debug messages, and indeed does not do so here, so the thing to do is to find whats different about your setup that causes the problem. Do you get a message when you do `Menu->Document->Line Wrapping` which calls `editor_set_line_wrapping()`?
Do you get a message when you do `Menu->Document->Line Wrapping which calls editor_set_line_wrapping()`?
Same Gtk-Warning only when **unsetting** the "Line Wrapping". That is the wrapping activation works Ok and shows no warning, clearing the active wrapping produces the warning.
Apparently, the warning is triggered by the Scintilla's message `SSM(sci, SCI_SETWRAPMODE, SC_WRAP_NONE, 0)`
Weird, doesn't happen here, 1.37 release or git version. Maybe its something to do with the specific version of GTK you have. Not sure what I can tell you to help you track it down.
github-comments@lists.geany.org