Commit bb4e9fec authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

for regexp based matches make sure we matched the whole string.


2005-05-12  Jody Goldberg <jody@gnome.org>

	* src/sheet-filter.c (filter_expr_eval) : for regexp based matches
	  make sure we matched the whole string.

2005-05-12  Jody Goldberg <jody@gnome.org>

	* sheet-order.glade : don't expand the buttons vertically that is just
	  ugly.

	* dialog-autofilter.c (map_op) : fix inversion of starts with and ends
	  with.
	(init_operator) : strip the leading and trailing '*' for
	  begins/ends/contains.

2005-05-10  Jody Goldberg <jody@gnome.org>

	* functions.c (gnumeric_asc) : quick stub
parent 70e8751e
......@@ -18,11 +18,8 @@ Release Critical
sumproduct(--(A1:A5>4),B1:B4)
: fix the row/col separators problem in array formula
: clearing autofilter (set to all) does not trigger a redraw of the row headers
Worries
-------
: buttons in sheet manager resize vertically
: provide undo for dropped objects from sheet_objects_clear
: undo of pasting copy/cut of objects
: Select graph, Copy, and paste to Emacs: used to crash, but now it
......
2005-05-12 Jody Goldberg <jody@gnome.org>
* src/sheet-filter.c (filter_expr_eval) : for regexp based matches
make sure we matched the whole string.
2005-05-10 Jean Brefort <jean.brefort@normalesup.org>
* src/value.c: (value_get_as_gstring): exchange row_sep and col_sep
......
Gnumeric 1.5.2
Jody:
* Autofilter string equality is stronger than containment [#172355]
* Buttons in sheet manager dialog should not strech vertically.
* Stub for MS Excel's ASC function, which is unncessary in gnumeric.
Morten:
* Fix SUMIF even more. [Debian #308346]
......
2005-05-12 Jody Goldberg <jody@gnome.org>
* src/sheet-filter.c (filter_expr_eval) : for regexp based matches
make sure we matched the whole string.
2005-05-10 Jean Brefort <jean.brefort@normalesup.org>
* src/value.c: (value_get_as_gstring): exchange row_sep and col_sep
......
2005-05-10 Jody Goldberg <jody@gnome.org>
* functions.c (gnumeric_asc) : quick stub
2005-05-10 Jody Goldberg <jody@gnome.org>
* Release 1.5.1
......
......@@ -1199,7 +1199,34 @@ gnumeric_search (FunctionEvalInfo *ei, GnmValue **argv)
/***************************************************************************/
static GnmFuncHelp const help_asc[] = {
{ GNM_FUNC_HELP_OLD,
F_("@FUNCTION=ASC\n"
"@SYNTAX=ASC(string)\n"
"@DESCRIPTION="
"ASC a compatibility function that is meaningless in Gnumeric. "
"In MS Excel (tm) it converts 2 byte @string into single byte text.\n"
"\n"
"@EXAMPLES=\n"
"CHAR(\"Foo\") equals \"Foo\".\n"
"\n"
"@SEEALSO=")
},
{ GNM_FUNC_HELP_END }
};
static GnmValue *
gnumeric_asc (FunctionEvalInfo *ei, GnmValue **argv)
{
return value_new_string (value_peek_string (argv[0]));
}
/***************************************************************************/
const GnmFuncDescriptor string_functions[] = {
{ "asc", "s", N_("string"), help_asc,
gnumeric_asc, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
{ "char", "f", N_("number"), help_char,
gnumeric_char, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
......
......@@ -11,6 +11,7 @@
<service type="function_group" id="string">
<_category>String</_category>
<functions>
<function name="asc"/>
<function name="char"/>
<function name="clean"/>
<function name="code"/>
......
2005-05-12 Jody Goldberg <jody@gnome.org>
* sheet-order.glade : don't expand the buttons vertically that is just
ugly.
* dialog-autofilter.c (map_op) : fix inversion of starts with and ends
with.
(init_operator) : strip the leading and trailing '*' for
begins/ends/contains.
2005-05-10 Jody Goldberg <jody@gnome.org>
* Release 1.5.1
......
......@@ -92,12 +92,12 @@ map_op (AutoFilterState *state, GnmFilterOp *op,
case 7:
case 8: *op = (i == 8) ? GNM_FILTER_OP_NOT_EQUAL : GNM_FILTER_OP_EQUAL;
v = value_new_string_nocopy (g_strconcat ("*", txt, NULL));
v = value_new_string_nocopy (g_strconcat (txt, "*", NULL));
break;
case 9:
case 10: *op = (i == 10) ? GNM_FILTER_OP_NOT_EQUAL : GNM_FILTER_OP_EQUAL;
v = value_new_string_nocopy (g_strconcat (txt, "*", NULL));
v = value_new_string_nocopy (g_strconcat ("*", txt, NULL));
break;
case 11:
......@@ -187,6 +187,8 @@ init_operator (AutoFilterState *state, GnmFilterOp op, GnmValue const *v,
char const *op_widget, char const *val_widget)
{
GtkWidget *w = glade_xml_get_widget (state->gui, op_widget);
char const *str = v ? value_peek_string (v) : NULL;
char *content = NULL;
int i;
switch (op) {
......@@ -201,23 +203,27 @@ init_operator (AutoFilterState *state, GnmFilterOp op, GnmValue const *v,
};
if (v != NULL && v->type == VALUE_STRING && (i == 1 || i == 2)) {
char const *str = v->v_str.val->str;
unsigned const len = strlen (str);
/* there needs to be at least 1 letter */
gboolean starts = (len > 1 && str[0] == '*');
gboolean ends = (len > 1 && str[len-1] == '*' && str[len-2] != '~');
int ends = (len > 1 && str[0] == '*') ? 1 : 0; /* as a bool and offset */
if (starts)
if (len > 1 && str[len-1] == '*' && str[len-2] != '~') {
content = g_strdup (str + ends);
content[len - ends - 1] = '\0';
i += (ends ? 10 : 6);
else if (ends)
} else if (ends) {
str += 1;
i += 8;
}
}
gtk_combo_box_set_active (GTK_COMBO_BOX (w), i);
if (v != NULL) {
w = glade_xml_get_widget (state->gui, val_widget);
gtk_entry_set_text (GTK_ENTRY (w), value_peek_string (v));
gtk_entry_set_text (GTK_ENTRY (w), content ? content : str);
}
g_free (content);
}
void
......
......@@ -13,6 +13,11 @@
<property name="default_height">200</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
......@@ -34,6 +39,7 @@
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
</widget>
</child>
......@@ -46,6 +52,7 @@
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
</widget>
</child>
......@@ -59,6 +66,7 @@
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
</widget>
</child>
......@@ -108,10 +116,11 @@
<property name="label">gtk-go-up</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
......@@ -123,11 +132,12 @@
<property name="label">gtk-go-down</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
......@@ -138,10 +148,11 @@
<property name="label">gtk-add</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
......@@ -154,10 +165,11 @@
<property name="label" translatable="yes">_Duplicate</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
......@@ -170,10 +182,11 @@
<property name="label">gtk-undelete</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
......
......@@ -39,14 +39,15 @@
#include "dialogs.h"
#include "style-color.h"
#include "gutils.h"
#include <goffice/utils/regutf8.h>
#include <goffice/utils/regutf8.h>
#include <goffice/cut-n-paste/foocanvas/foo-canvas-widget.h>
#include <gtk/gtk.h>
#include <gdk/gdkevents.h>
#include <gdk/gdkkeysyms.h>
#include <gsf/gsf-impl-utils.h>
#include <glib/gi18n.h>
#include <string.h>
typedef struct {
SheetObject parent;
......@@ -674,8 +675,13 @@ filter_expr_eval (GnmFilterOp op, GnmValue const *src, GORegexp const *regexp,
regmatch_t rm;
switch (go_regexec (regexp, str, 1, &rm, 0)) {
case REG_NOMATCH: return op == GNM_FILTER_OP_NOT_EQUAL;
case REG_OK: return op == GNM_FILTER_OP_EQUAL;
case REG_OK:
if (rm.rm_so == 0 && strlen (str) == (size_t)rm.rm_eo)
return op == GNM_FILTER_OP_EQUAL;
/* fall through */
case REG_NOMATCH:
return op == GNM_FILTER_OP_NOT_EQUAL;
default:
g_warning ("Unexpected regexec result");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment