After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 633284 - Scintilla plugin crashes Anjuta when opening a file with syntax highlighting
Scintilla plugin crashes Anjuta when opening a file with syntax highlighting
Status: RESOLVED FIXED
Product: anjuta
Classification: Applications
Component: plugins: editor: scintilla
2.32.x
Other Linux
: Normal major
: ---
Assigned To: Sébastien Granjoux
Anjuta maintainers
Depends on:
Blocks:
 
 
Reported: 2010-10-27 19:15 UTC by John
Modified: 2011-09-29 20:44 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description John 2010-10-27 19:15:57 UTC
I was getting slightly frustrated with the artificial intelligence of
GtkSourceView when auto-indenting, spaces, tabs, etc. Finally I decided
to try Scintilla, which I believe has external configuration files. 

So, I compiled and installed the -extras package, removed GSV from
'preferred plugins', restarted Anjuta (both 2.32.0).

When opening config.h (just to try something), I could select Scintilla
as editor, but then Anjuta just crashed. Attaching gdb while running, I
get the backtrace below.

If I open INSTALL first (any file without highlighting), then I can config.h 
next without crash...

Don't know if related: Configuring the editor font fails:

1) Scintilla seems to be using a monospaced font by default, but in the 
Preferences dialog 'Sans 12' appears.

2) Changeing Sans 12 to something else is not saved - reopening
Preferences shows Sans 12 again.

Returning to GtkSourceView, everything is normal again.

John

Program received signal SIGSEGV, Segmentation fault.
0x00007f879af073ae in IA__gtk_widget_get_toplevel (widget=0x20) at
gtkwidget.c:8132 8132	gtkwidget.c: No such file or directory.
	in gtkwidget.c

(gdb) bt
  • #0 IA__gtk_widget_get_toplevel
    at gtkwidget.c line 8132
  • #1 gtk_main_get_window_group
    at gtkmain.c line 1718
  • #2 IA__gtk_main_do_event
    at gtkmain.c line 1505
  • #3 gdk_event_dispatch
    at gdkevents-x11.c line 2372
  • #4 g_main_dispatch
    at gmain.c line 2149
  • #5 g_main_context_dispatch
    at gmain.c line 2702
  • #6 g_main_context_iterate
    at gmain.c line 2780
  • #7 g_main_loop_run
    at gmain.c line 2988
  • #8 IA__gtk_main
    at gtkmain.c line 1219
  • #9 main
    at main.c line 265

Comment 1 Sébastien Granjoux 2010-10-27 19:33:29 UTC
(In reply to comment #0)
> When opening config.h (just to try something), I could select Scintilla
> as editor, but then Anjuta just crashed. Attaching gdb while running, I
> get the backtrace below.

I have recompile Anjuta 2.32 and try here but I don't get any crash using Scintilla. In your trace the widget address is obviously wrong, but I have no idea why it happens.


> Don't know if related: Configuring the editor font fails:
> 1) Scintilla seems to be using a monospaced font by default, but in the 
> Preferences dialog 'Sans 12' appears.
> 2) Changeing Sans 12 to something else is not saved - reopening
> Preferences shows Sans 12 again.

It is possible to change and save fonts. The issue is that you have to select the style you want to modify. By default, there is no style selected (not even the default one) so the value fonts, attributes, colors don't correspond to anything and are not saved. You need to first select the style "Normal" by example, then you can select a different fonts, the change is saved and taken into account when you reload Anjuta.
Comment 2 John 2010-10-27 20:48:31 UTC
>I have recompile Anjuta 2.32 and try here but I don't get any crash using
>Scintilla. In your trace the widget address is obviously wrong, but I have no
>idea why it happens.

After an hour or so with Anjuta, with GtkSourceView, I found this in the terminal window where Anjuta started:

=======
(anjuta:1924): Gtk-CRITICAL **: IA__gtk_container_remove: assertion `GTK_IS_TOOLBAR (container) || widget->parent == GTK_WIDGET (container)' failed

(anjuta:1924): Gtk-WARNING **: Attempting to add a widget with type GtkHBox to a container of type GtkFrame, but the widget is already inside a container of type GtkFrame, the GTK+ FAQ at http://library.gnome.org/devel/gtk-faq/stable/ explains how to reparent a widget.
=======

I'm not sure when it appeared, and it's only a warning.

About the font selection. I understand what you are saying. I'll try that again later with Scintilla. I can't recall a way to select styles. But anyway, should the font selection be desensitized if no style is selected? To avoid confusion such as mine ;-)

Thanks,
John
Comment 3 Sébastien Granjoux 2010-10-27 20:59:04 UTC
(In reply to comment #2)
> After an hour or so with Anjuta, with GtkSourceView, I found this in the
> terminal window where Anjuta started:
> =======
> (anjuta:1924): Gtk-CRITICAL **: IA__gtk_container_remove: assertion
> `GTK_IS_TOOLBAR (container) || widget->parent == GTK_WIDGET (container)' failed
> 
> (anjuta:1924): Gtk-WARNING **: Attempting to add a widget with type GtkHBox to
> a container of type GtkFrame, but the widget is already inside a container of
> type GtkFrame, the GTK+ FAQ at http://library.gnome.org/devel/gtk-faq/stable/
> explains how to reparent a widget.
> =======

I don't have this message here, it perhaps depends on the layout of Anjuta windows.
 

> About the font selection. I understand what you are saying. I'll try that
> again later with Scintilla. I can't recall a way to select styles. But
> anyway, should the font selection be desensitized if no style is selected?
> To avoid confusion such as mine ;-)

Sure, the interface here is confusing at least. It's not used very often neither so I have rather worked on something more visible.
Comment 4 John 2010-10-28 16:33:23 UTC
> Sure, the interface here is confusing at least. It's not used very often
> neither so I have rather worked on something more visible.

Sebastien,

I started Anjuta with Scintilla today, and tried the font configuration again.

1) I selected 'normal <default>', as you indicated.

2) I selected 'monospace italic', just to test if it was accepted.
   On clicking 'Apply', the selection went back to 'monospace'.
   I tested this several times... Maybe italics are not accepted?

3) Selecting another font entirely was accepted correctly, and was
   saved too, but 'Apply' didn't apply the font. I had to restart Anjuta
   completely to get the font working.

4) Another strange item. Changing the fold style doesn't work either.
   It always returns to Plus/Minus.


Though Anjuta started out with Scintilla as editor - is there a shift in 
preference towards GtkSourceView now?

John
Comment 5 Sébastien Granjoux 2010-10-28 17:30:55 UTC
(In reply to comment #4)
> 2) I selected 'monospace italic', just to test if it was accepted.
>    On clicking 'Apply', the selection went back to 'monospace'.
>    I tested this several times... Maybe italics are not accepted?

Yes, I think italics is not taken into account. In order to use italics, you need to check the attribute check box just below.

I have worked on this part of the code, the selection of the font is done by scintilla itself. So this dialog, just get the font name and update the scintilla properties file. I'm quite sure, I haven't taken care of the font attribute that's why you cannot set italic font here.


> 3) Selecting another font entirely was accepted correctly, and was
>    saved too, but 'Apply' didn't apply the font. I had to restart Anjuta
>    completely to get the font working.

Yes, I get the same here, it's the normal behavior. It can be improved.


> 4) Another strange item. Changing the fold style doesn't work either.
>    It always returns to Plus/Minus.

It works here. It is applied immediately and saved correctly (I have tried Arrows).


> Though Anjuta started out with Scintilla as editor - is there a shift in 
> preference towards GtkSourceView now?

Yes.

Comparing to GtkSourceView, Scintilla is less integrated with GNOME. I mean, some things are coming for free on GtkSourceView, like using GNOME blinking cursor preferences, choose of fonts, copy/paste using the middle button... while it has to be implemented in Scintilla. On the other hand, I think Scintilla has still more function: folding, column editing, custom syntax highlight....

Both editors are in active development but while GtkSourceView will probably support folding, I don't think Scintilla will be more integrated in GNOME if we don't write the patch ourselves. With the coming of GNOME 3, it's even possible that Scintilla will be dropped if it doesn't compile with Gtk 3.

Anjuta starts with Scintilla then Johannes writes the GtkSourceView plugin. We get several persons asking to chose a single main editor for Anjuta and GkSourceView has been chosen. Anyway, this is a free software so the decisions are taken by the one who work on it. Within the main developers, I think it's split almost in half with perhaps a small advantage for GtkSourceView now. I'm using Scintilla and I find it good enough so I will continue to fix it but I spend a lots of time on the project manager.

Thanks already for your bug reports. I will try to fix a few of them for the next release. Then if you like Scintilla and you can write a patch, send it and I will review it. I think the fixes shouldn't be very difficult, ask me if you need.
Comment 6 John 2010-10-28 21:50:17 UTC
>> 4) Another strange item. Changing the fold style doesn't work either.
>>    It always returns to Plus/Minus.
>
>It works here. It is applied immediately and saved correctly (I have tried
>Arrows).

Mmmm. With another font active, it works, but still only _after_ restarting
Anjuta.

> GtkSourceView will probably support folding,

According to what I read, it _is_ already working, and awaiting approval for
release.

> Within the main developers, I think it's split almost in half...

I have little preference for either. I've found that if I remove the modelines
from the files, the editor starts behaving as I like. I still haven't found
a decent explication of what is possible (or not) with modelines, and have the
impression that, appart from three options, the rest is considered 
editor-specific. And no specs on what GtkSourceView accepts.

Thanks for the attention. If I can be of help, gladly, though my programming
skills are somewhat limited.

John
Comment 7 Sébastien Granjoux 2010-10-29 17:01:23 UTC
(In reply to comment #6)
> I have little preference for either. I've found that if I remove the modelines
> from the files, the editor starts behaving as I like. I still haven't found
> a decent explication of what is possible (or not) with modelines, and have the
> impression that, appart from three options, the rest is considered 
> editor-specific. And no specs on what GtkSourceView accepts.

The modeline support is added by Anjuta but I don't think there is an option to disable it. I'm afraid the documentation is missing too. 


> Thanks for the attention. If I can be of help, gladly, though my programming
> skills are somewhat limited.

Fine but programming is not the only way to contribute, reporting bugs is very important too else you can help for translations or correct grammatical errors in messages, improve the documentation (describe which options are supported in the modeline :)), draw new icons, help other users....
Comment 8 Johannes Schmid 2010-10-29 17:19:17 UTC
> The modeline support is added by Anjuta but I don't think there is an option to
> disable it. I'm afraid the documentation is missing too. 

There is a preference option in master to disable modeline parsing.
Comment 9 John 2010-10-29 18:09:22 UTC
> improve the documentation (describe which options are supported in
> the modeline :))

I went to the sources, I think I found the relevant info. 
I tried to go to 'Anjuta Wiki' from the Anjuta page, to add docs there, but no Wiki there... (There are instructions on how to edit wiki pages, but no wiki itself evident)

How do I suggest/add doc changes?

John
Comment 10 Johannes Schmid 2010-10-29 19:29:48 UTC
> I went to the sources, I think I found the relevant info. 
> I tried to go to 'Anjuta Wiki' from the Anjuta page, to add docs there, but no
> Wiki there... (There are instructions on how to edit wiki pages, but no wiki
> itself evident)

You should be able to edit pages after you register and login there. There are no restrictions in editing once you are logged in.
Comment 11 Sébastien Granjoux 2010-10-29 19:35:47 UTC
(In reply to comment #9)
> I went to the sources, I think I found the relevant info. 
> I tried to go to 'Anjuta Wiki' from the Anjuta page, to add docs there, but no
> Wiki there... (There are instructions on how to edit wiki pages, but no wiki
> itself evident)
> How do I suggest/add doc changes?

You can help us improving the Anjuta manual by attaching a patch here too. The source of the manual are in manuals/anjuta-manual/C directory in the git repository.

The manual uses the DocBook format, it's a xml format so editable with a text editor. After modifying it you can view it using:
  yelp ghelp:_absolute_path_name_of_your_xml_file_/_xml_file_
By example, here 
  yelp ghelp:/home/seb2010.1/Programmation/Anjuta/anjuta-npm_rw/manuals/anjuta-manual/C/anjuta-manual.xml

You can get more details here:
http://library.gnome.org/devel/gdp-handbook/stable/
Comment 12 John 2010-10-30 01:33:04 UTC
> You should be able to edit pages after you register and login there. There are
> no restrictions in editing once you are logged in.

Stupid me... Didn't see the 'Login' at all. My apologies.

Ok. Registered, logged in, but I have the impression that the Wiki is almost completely empty (except for the front page). So, I submit that adding info on the modelines there would not productive, unless the entire manual would be there to provide for context.

Are there plans to add the manual to the Wiki? Would there be a path to convert the manual back to DocBook format? (I suspect editing wiki pages would be a easier for casual contributors - like me - than trying to edit the DocBook XML directly, so I offer my help here).

This is straying way off the original topic here. Feel free to suggest another medium.

John
Comment 13 Johannes Schmid 2010-10-30 09:34:10 UTC
Actually we are planning to rewrite the documentation in mallard format which is far easier to maintain than docbook. The documentation will become more tutorial-style. But we will include any snippets that are put into the wiki in the documentation.

I don't think there is a tool to convert the docs to wiki or the other way round but a online editor for mallard is planned.

Let's discuss that on the mailing list.
Comment 14 Sébastien Granjoux 2011-09-22 19:25:07 UTC
I have fixed most of the issue on Scintilla reported here:

1. Changing font should work fine now.
2. Italic and bold attribute can be changed in the font selection dialog.
3. Apply button change the style immediately without needing to restart Anjuta.


The things remainings are

4. Changing the fold character does not seem to work here, I will look at this.
5. Changing cursor, selection or calltip color does not seem to work neither.
6. I think it would be better to remove the Apply button and apply change immediately so we can see exactly how the text is modified.
Comment 15 Sébastien Granjoux 2011-09-24 20:13:05 UTC
Setting of cursor, selection and calltip color is fixed. Scintilla plugin uses a mix of settings coming from .properties files and gconf. It needs some clean up here.
Comment 16 Sébastien Granjoux 2011-09-29 20:44:26 UTC
The fold character was not working here because donf-service was not running.

I have changed the dialog to remove the Apply button, so style change are applied immediately now. I think it's better to see the difference, the old style is saved at the beginning so you can restore old settings by clicking on cancel.

For the issue about the documentation, a part of the doc has already been rewritten in Mallard format, but help is always welcome. The editor part in particular is not documented at the moment.