Re: GtkSourceSearchFlags problem
- From: Jeff Franks <jcf tpg com au>
- To: Gustavo Giráldez <gustavo giraldez gmx net>
- Cc: Gnome Devtools list <gnome-devtools gnome org>
- Subject: Re: GtkSourceSearchFlags problem
- Date: Sat, 14 Jun 2003 00:26:43 +1000
Gustavo Giráldez wrote:
Hi Jeff,
On Thu, 2003-06-12 at 22:52, Jeff Franks wrote:
Hi,
GtkSourceSearchFlags is declared in gtksourceiter.h like this:
typedef enum {
GTK_SOURCE_SEARCH_VISIBLE_ONLY,
GTK_SOURCE_SEARCH_TEXT_ONLY,
GTK_SOURCE_SEARCH_CASE_INSENSITIVE
} GtkSourceSearchFlags;
but because it's represents a bitmask field I think it should be
declared like this:
typedef enum {
GTK_SOURCE_SEARCH_VISIBLE_ONLY = 1 << 0,
GTK_SOURCE_SEARCH_TEXT_ONLY = 1 << 1,
GTK_SOURCE_SEARCH_CASE_INSENSITIVE = 1 << 2
} GtkSourceSearchFlags;
This wouldn't be correct, since for the current implementation, the
first two values should match those in GtkTextSearchFlags.
GTK_TEXT_SEARCH_VISIBLE_ONLY is 0, while 1 << 0 yields 1.
Given the above, the values do not *strictly* represent a bit mask. So
I'm not sure we want to fix GtkSourceView while GtkTextSearchFlags is
still inconsistent.
I see you have reported the gtk+ issue to the gtk-devel list. Please do
let us know when you file the bug so we can track it.
Thanks,
Gustavo
Havoc's answer was Yes, the later is correct so I've filed a report in
bugzilla.
I think you should declared the GtkSourceSearchFlags enumerations as
bitmask now and wait for GTK+ to catch up. It shouldn't matter because
GtkSourceSearchFlags and the gtk_source_iter_forward_search and
gtk_source_iter_backward_search functions replace the ones for
GtkTextIter, reimplementing the default GtkTextIter behaviour and adding
a case-insensitive search. (Could your case-insensitive search code
could be applied to GtkTextIter as a patch since it seems to be a future
planned feature. This would remove the need for gtksourceiter.[ch].) As
things stand the flags don't work as they should because C++ has
difficulty setting and getting bitmask values declared as an integer. So
I have to declare the wrapped enumeration as bit values in my binding
and cast them to a GtkSourceSearchFlags.
Regards,
Jeff Franks.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]