[gedit-list] Getting started with the gedit source code



I have been meaning to start work on some ideas for improving gedit 
for several months now and finally got going a few days back.
I have yet to pluck up the courage to move to Gnome 2, and am
working with the Gnome 1.4  and gedit 0.9.7 source. From what I
have learned about the differences between 1.4 and 2.0, it should
be quite easy for me to migrate any work to 2.0 in a few months
time, when I can smoothly switch to 2.0 via Ximian's Red Carpet.

Here's what I have done so far.

Changed file menu "Revert" to "Reopen" as the file may have been
changed by another tool so that you are switching to a newer version
and not reverting to an old one. In particular I have been using
gedit to edit HTML files and running my HTML Tidy tool in a console
to tidy up the markup I have just saved. I hope to integrate Tidy as
a gedit plugin but that's a little way off yet.

Added Ctrl-G as an accelerator for the Search|Goto Line menu item.
I have done this by extending gedit_event_key_press in view.c.
What I am missing is how to get the accelerator shown in the
menu. Gedit doesn't appear to be using gtk_accel_group_add() and
I would very much appreciate some guidance as to the best way to
add new accelerators to gedit's menus.

Added a checkbox (Enable Wrap during entry) and a spin control
(Wrap margin) to the General tab of the gedit preferences. The
code to implement this has been added to auto.c. The idea is to
allow authors to use Ctrl-J to wrap the current paragraph. They
can also enable word wrapping during text entry. This then ensures
that the current paragraph is wrapped to the specified margin.
The code also works with gedit's auto-indent feature. If this is
enabled, the paragraph is wrapped left-justified to the starting
column for the first line of the paragraph.

The code iteracts with the auto_indent_cb() handler that is invoked
on every insertion to the text buffer. I take special care to
avoid infinite recursion when inserting a character triggers a
paragraph wrapping operation that itself involves insertion and
deletion operations on the text buffer. These can cause screen
flickering and I would be very interested if anyone knows of a
way to defer screen refresh while you are manipulating the text
widget.

Some further ideas I hope to explore include, making the search
dialog non-modal so that you can continue to scroll, and edit the
document while the search dialog is still visible. I would also
like to find a way to make the cursor more visible. It is often
very hard to spot after a goto operation. This probably will
involve a change to the text widget, but what do you think?
Another idea is to strip carriage returns when reading files
and to offer a config option to replace line feed with carriage
return line feed pairs when writing files.

p.s. I know the gtk text widget supports a soft word wrap mode,
but I want to hard wrap text to the desired margin with line
feeds at the end of each line.

-- 
 Dave Raggett <dsr w3 org> or <dave raggett openwave com>
 W3C lead for voice/multimodal. http://www.w3.org/People/Raggett 
 tel/fax: +44 1225 866240 (or 867351) +44 771 213 7629 (GSM)





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]