[gnumeric] Improve expression entry range selection. [#624581]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Improve expression entry range selection. [#624581]
- Date: Sat, 17 Jul 2010 00:26:29 +0000 (UTC)
commit ce951fa33e53f1fbb484aabdf7597cba9692164a
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Fri Jul 16 18:26:26 2010 -0600
Improve expression entry range selection. [#624581]
2010-07-16 Andreas J. Guelzow <aguelzow pyrshep ca>
* gnumeric-expr-entry.c (gnm_expr_entry_find_range): permit
range selection on an empty text.
NEWS | 2 +-
src/widgets/ChangeLog | 5 +++++
src/widgets/gnumeric-expr-entry.c | 22 +++++++++++++++++++---
3 files changed, 25 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index 0c499ff..0d6d0cb 100644
--- a/NEWS
+++ b/NEWS
@@ -29,7 +29,7 @@ Andreas:
* Add menu item to wrap SORT around an existing range.
* Show the number of rows filtered by the auto filter. [#346002]
* Improve function tooltips. [#623322]
- * Improve expression entry range selection. [#80725][#624288][#624289]
+ * Improve expression entry range selection. [#80725][#624288][#624289][#624581]
* Add preference setting to disable the extension check for the
configurable text exporter. [#594151]
* Add optional marker to indicate that a cell contains an expression. [#55124]
diff --git a/src/widgets/ChangeLog b/src/widgets/ChangeLog
index 5c25f7b..c0e1ec7 100644
--- a/src/widgets/ChangeLog
+++ b/src/widgets/ChangeLog
@@ -1,3 +1,8 @@
+2010-07-16 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * gnumeric-expr-entry.c (gnm_expr_entry_find_range): permit
+ range selection on an empty text.
+
2010-07-13 Andreas J. Guelzow <aguelzow pyrshep ca>
* gnumeric-expr-entry.h (gnm_expr_entry_find_range): return a
diff --git a/src/widgets/gnumeric-expr-entry.c b/src/widgets/gnumeric-expr-entry.c
index 8e1ae55..782545c 100644
--- a/src/widgets/gnumeric-expr-entry.c
+++ b/src/widgets/gnumeric-expr-entry.c
@@ -754,11 +754,10 @@ gee_set_tooltip (GnmExprEntry *gee, GnmFunc *fd, gint args, gboolean had_stuff)
static void
gee_dump_lexer (GnmLexerItem *gli) {
g_print ("************\n");
- while (gli->token != 0) {
+ do {
g_print ("%2d to %2d: %d\n",
gli->start, gli->end, gli->token);
- gli++;
- }
+ } while (gli++->token != 0);
g_print ("************\n");
}
@@ -1557,11 +1556,28 @@ gnm_expr_entry_find_range (GnmExprEntry *gee)
if (gnm_debug_flag ("rangeselection"))
g_print ("text: >%s< -- cursor: >%s<\n", text, cursor);
+ if (ptr[0] == '\0') {
+ rs->text_end = rs->text_start =
+ g_utf8_pointer_to_offset
+ (text, ptr);
+ return TRUE;
+ }
+
gli = gnm_expr_lex_all (ptr, &gee->pp,
GNM_EXPR_PARSE_UNKNOWN_NAMES_ARE_STRINGS,
NULL);
+
if (gnm_debug_flag ("rangeselection"))
gee_dump_lexer (gli);
+
+ if (gli->token == 0) {
+ rs->text_start = g_utf8_pointer_to_offset
+ (text, ptr);
+ rs->text_end = len;
+ g_free (gli);
+ return TRUE;
+ }
+
token_pos = cursor - ptr;
gee_find_lexer_token (gli, (guint)token_pos, &gli_before, &gli_after);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]