Google Summer of Code 2013 proposal, by SébastienWilmet
GtkSourceView: add regex search and modernize existing features
The higher-level API for the search and replace has been merged to GtkSourceView. It includes the regex search.
- gedit has been adapted accordingly.
- Some various bugs have been fixed along the way.
The second part of the GSoC (rework the color schemes to use CSS) has been dropped. This is not a high-priority task for GtkSourceView, and the first part of the GSoC took longer than expected (but the result is better than expected, at least for me).
Instead of the second part of the GSoC, I polish the search and replace, and fix various bugs in GtkSourceView and gedit.
- GSoC successfully finished.
What is your e-mail address and IRC nick?
IRC nick: swilmet
Do you have a web page, blog, or microblog?
What is your academic background?
I study computer science at the Université Catholique de Louvain (Belgium). I'm currently at the first year of the master degree.
What is the ultimate goal of your proposal?
Broadly speaking, the purpose is to improve the developer experience when editing source code. The proposal involves primarily GtkSourceView, but some changes in other places of the stack are planned too. More precisely, here are what I would like to achieve:
- Higher level API for the search of text
The current API for searching text is basically two functions: forward_search() and backward_search(), with some flags. Lots of work is delegated to the application, such as highlighting the matches.
The idea is to have a higher level API in GtkSourceView, to asynchronously highlight the matches and report some pieces of information, like the total number of occurrences, and on which occurrence we are (to display something like "3 of 10" in the search entry).
- Regex search
It is currently not possible to perform a regular expression search (or a search and replace). I would like to add this feature to GTK+.
- Adapt the search and replace in gedit accordingly
Use the new API in gedit, and be able to perform regex searches.
- Rework the color schemes to use CSS
Currently the color scheme definitions (for syntax highlighting, background colors, …) are written in XML. The files are read by GtkSourceView and the data is exposed through an API. But this API is not really flexible. For example, it is not possible to override styles with user configurable settings.
We live in the GTK+ 3 era now, so it would be great to take advantage of all the goodness of the CSS machinery. The color scheme definitions would be converted to CSS (with a script), and it would be possible to override the styles.
What components/modules will the proposed work modify or create?
It will modify GtkSourceView, gedit and GTK+.
What benefits does your proposed work have for GNOME and its community?
Why are you the right person to work on this project?
Although it would be my first GSoC, I already have some years of experience in GNOME development. I co-maintain GtkSourceView, and I'm the main developer of LaTeXila, a LaTeX editor that uses GtkSourceView. I'm also a member of the GNOME Foundation since 2012.
How do you plan to achieve completion of your project?
Discuss API changes before the GSoC begins (at least for the first tasks). During the GSoC:
Weeks 1 & 2 & 3: Implement higher level API for the search of text.
Weeks 4 & 5: Regex search.
- Week 6: Adapt gedit accordingly.
Weeks 7 & 8 & 9: Begin the rework of the color schemes to use CSS.
The first step is to have a GtkSourceTag class, a subclass of GtkTextTag, that has an associated style context. The CSS styles must be converted to the GtkTextTag properties (foreground and background colors, …). And use GtkSourceTag for the syntax highlighting.
- Week 10:
Define a format for the style schemes (it must be valid CSS, but also carry some metadata like the author and the theme name). Write a script to convert the current style schemes from XML to CSS.
Weeks 11 -> end:
The priority is to finish the previous points, and make sure it is stable. But if time permits, I can investigate the required modifications to feed back GtkTextTag CSS styling in GTK+ itself.
What will be showable at mid-term?
The new search API in action in gedit, with the regex search.
What are your past experiences with the open source world as a user and as a contributor?
I've discovered GNU/Linux and GNOME in 2005. Apart from reporting bugs, my first contribution was to help the French translation of klavaro.
In 2009 I began LaTeXila during the summer. I made the mistake to begin a personal project instead of contributing to an existing one, so after several months, a rewrite was necessary. But I've learned lots of things, a big part of the code is in a good shape now (from my point of view), and users are happy with the features.
What other relevant projects have you worked on previously and what knowledge you gained from working on them?
LaTeXila: developing an application for GNOME (in Vala).
GtkSourceView: developing a GNOME library (in C).
Will you have any other time commitments, such as school work, another job, planned vacation, etc., between June 17 and September 23?
I have exams during the first week of the GSoC.