Within `editor_goto_pos()`, `document_show_tab()` is called which realizes the 
Scintilla widget.

This change:
1. Makes the code more similar to `document_open_file_full()` where 
`editor_goto_pos()` is called at the end as well.
2. Ensures that the editor is focused after creating a new file (which 
didn't get focused before).
3. Fixes the Overview plugin crash for when creating empty document made Geany 
crash after editor click.

To (3): I don't know how exactly this is fixed but when debugging the 
issue, I noticed that Scintilla's `realize()` gets called 3 times for new 
documents while only 2 times when opening existing documents (2 times makes 
sense - once for the editor widget, once for the overview view). After adding 
some traces, one `realize()` gets called when `editor_goto_pos()` is invoked 
and the other two after sending the `"document-new"` signal. I 
haven't investigated what exactly happens but since moving 
`editor_goto_pos()` fixes the problem and makes the code work more like 
`document_open_file_full()`, it's probably a "good" solution.

Fixes https://github.com/geany/geany-plugins/issues/1354 (by the means of magic)
You can view, comment on, or merge this pull request online at:

  https://github.com/geany/geany/pull/4348

-- Commit Summary --

  * Move editor_goto_pos() to the end of document_new_file()

-- File Changes --

    M src/document.c (5)

-- Patch Links --

https://github.com/geany/geany/pull/4348.patch
https://github.com/geany/geany/pull/4348.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/4348
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/pull/[email protected]>

Reply via email to