[Github-comments] [geany/geany] Gtk-Warning at startup when opened file contains a long line (#2700)

nomadbyte notifications at xxxxx
Tue Dec 22 21:21:02 UTC 2020


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/src/keyfile.c#L1237

>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/src/editor.c#L4921

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.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/2700#issuecomment-749781483
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20201222/4ec4653c/attachment.htm>


More information about the Github-comments mailing list