summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrés <andmarti@gmail.com>2021-06-12 23:02:14 -0300
committerAndrés <andmarti@gmail.com>2021-06-12 23:02:14 -0300
commitf09a534443af14b53d1dfe9e209928af6dca3c6f (patch)
treed39c4503fad53e4aef41d5a4abdd57db5160a656 /src
parenta5dfc099393bb834432d6d572a73ec9ac1bf1350 (diff)
work on issue 575. handle search of strings and numbers with multisheet
Diffstat (limited to 'src')
-rw-r--r--src/cmds/cmds_normal.c24
-rw-r--r--src/interp.c13
-rw-r--r--src/interp.h8
-rw-r--r--src/sc.h2
4 files changed, 36 insertions, 11 deletions
diff --git a/src/cmds/cmds_normal.c b/src/cmds/cmds_normal.c
index d60a011..d572e79 100644
--- a/src/cmds/cmds_normal.c
+++ b/src/cmds/cmds_normal.c
@@ -411,14 +411,34 @@ void do_normalmode(struct block * buf) {
// repeat last goto command - backwards
case L'N':
- go_previous();
+ {
+ struct roman * roman = session->cur_doc;
+ struct sheet * sh = roman->cur_sh;
+ extern struct go_save gs;
+ if (gs.g_sheet == sh)
+ go_previous();
+ else if (gs.g_type == G_NUM)
+ num_search(sh, gs.g_n, 0, 0, sh->maxrow, sh->maxcol, 0, gs.g_flow);
+ else if (gs.g_type == G_STR)
+ str_search(sh, gs.g_s, 0, 0, sh->maxrow, sh->maxcol, 0, gs.g_flow);
ui_update(TRUE);
+ }
break;
// repeat last goto command
case L'n':
- go_last();
+ {
+ struct roman * roman = session->cur_doc;
+ struct sheet * sh = roman->cur_sh;
+ extern struct go_save gs;
+ if (gs.g_sheet == sh)
+ go_last();
+ else if (gs.g_type == G_NUM)
+ num_search(sh, gs.g_n, 0, 0, sh->maxrow, sh->maxcol, 0, gs.g_flow);
+ else if (gs.g_type == G_STR)
+ str_search(sh, gs.g_s, 0, 0, sh->maxrow, sh->maxcol, 0, gs.g_flow);
ui_update(TRUE);
+ }
break;
// END OF MOVEMENT COMMANDS
diff --git a/src/interp.c b/src/interp.c
index eb202ae..20f5001 100644
--- a/src/interp.c
+++ b/src/interp.c
@@ -84,14 +84,6 @@
#endif
#include "graph.h"
-/* g_type can be: */
-#define G_NONE 0 /* Starting value - must be 0 */
-#define G_NUM 1
-#define G_STR 2
-#define G_NSTR 3
-#define G_XSTR 4
-#define G_CELL 5
-
extern int find_range(char * name, int len, struct ent * lmatch, struct ent * rmatch, struct range ** rng);
extern bool decimal; /* Set if there was a decimal point in the number */
extern struct session * session;
@@ -1086,14 +1078,15 @@ void num_search(struct sheet * sh, double n, int firstrow, int firstcol, int las
//if (!loading) remember(0);
g_free();
+ gs.g_sheet = sh;
gs.g_type = G_NUM;
gs.g_n = n;
gs.g_row = firstrow;
-
gs.g_col = firstcol;
gs.g_lastrow = lastrow_;
gs.g_lastcol = lastcol_;
gs.errsearch = errsearch;
+ gs.g_flow = flow;
if (sh->currow >= firstrow && sh->currow <= lastrow_ && sh->curcol >= firstcol && sh->curcol <= lastcol_) {
endr = sh->currow;
endc = sh->curcol;
@@ -1191,12 +1184,14 @@ void str_search(struct sheet * sh, char * s, int firstrow, int firstcol, int las
}
g_free();
+ gs.g_sheet = sh;
gs.g_type = G_STR + num;
gs.g_s = s;
gs.g_row = firstrow;
gs.g_col = firstcol;
gs.g_lastrow = lastrow_;
gs.g_lastcol = lastcol_;
+ gs.g_flow = flow;
if (sh->currow >= firstrow && sh->currow <= lastrow_ && sh->curcol >= firstcol && sh->curcol <= lastcol_) {
endr = sh->currow;
diff --git a/src/interp.h b/src/interp.h
index 46db7cc..bbadc2a 100644
--- a/src/interp.h
+++ b/src/interp.h
@@ -93,3 +93,11 @@ int dateformat(struct sheet * sh, struct ent *v1, struct ent *v2, char * fmt);
extern void EvalAllVertexs();
extern void EvalJustOneVertex(struct sheet * sh, struct ent * p, int rebuild_graph);
+
+/* g_type can be: */
+#define G_NONE 0 /* Starting value - must be 0 */
+#define G_NUM 1
+#define G_STR 2
+#define G_NSTR 3
+#define G_XSTR 4
+#define G_CELL 5
diff --git a/src/sc.h b/src/sc.h
index 781d661..ea643a0 100644
--- a/src/sc.h
+++ b/src/sc.h
@@ -257,11 +257,13 @@ struct enode {
/* Use this structure to save the last 'g' command */
struct go_save {
+ struct sheet * g_sheet;
int g_type;
double g_n;
char * g_s;
int g_row;
int g_col;
+ int g_flow;
int g_lastrow;
int g_lastcol;
int strow;