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



On Fri, 2002-08-09 at 06:14, Dave Raggett wrote:
> 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.
> 

Depending on what you did, it might not be that easy -- gedit2 has
changed quite a bit.

> 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

Do other applications use "Revert" or "Reopen"?  I think we would want
to stay consistent...

> 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.
> 

That sounds like a great idea.  Also, Paolo and I have the intention to
write a "Tools" plugin, which would likely allow you to use tidy without
having to write a plugin.

> 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.
> 

In gedit2, Ctrl-G is bound to "Search->Find Next".  I guess we would
have to pick a different one for Goto Line.  Also, gedit2 uses a much
better menu system (bonoboui), so adding menu items is really easy now.

> 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.
> 

Hmmm...I'm not sure how this would be done in gedit2.  We are now using
the GtkTextView widget, which is a LOT different than the old text
widget (but also much more powerful).  It is possible though that your
code will be easy to port.  We don't yet have auto-indent in gedit2, but
it is something we want to add (along with syntax highlighting).

> 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

This is fixed in gedit2

> 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?

I have also noticed that the cursor is a little hard to see.  I wouldn't
mind if we had a "cursor color" preference, so we could make the cursor
green or red or something.....that would be nice.

> 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.

Hmmm.....like a unix2dos thing?  This could be implemented with a
plugin.....

I highly suggest you upgrade to gnome2 ASAP, as it is really a lot
better, and it is where the current development of gedit is happening. 
However, maybe Paolo (the maintainer) will want to take your changes and
include them in one last gnome1.x release.  Thanks a lot for your work!

Thanks,
James





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