about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarco Peereboom <marco@conformal.com>2011-10-06 15:52:15 -0500
committerMarco Peereboom <marco@conformal.com>2011-10-06 15:52:15 -0500
commit090bc388080187aca96c2ac70b3b36af6a725967 (patch)
tree754e1eb2f53ebdb6049efc9e04534c49ebba67a6
parent48c99ae40c6188e3c289172e58be38912749ac36 (diff)
downloadxombrero-090bc388080187aca96c2ac70b3b36af6a725967.tar.gz
fix search direction on new page
When on a new page a search is resumed the search used to go backward
instead of forward.  This has been plenty irritating for a while.
-rw-r--r--xxxterm.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/xxxterm.c b/xxxterm.c
index 15357d5..5da6079 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -5087,16 +5087,29 @@ xtp_page_dl(struct tab *t, struct karg *args)
 int
 search(struct tab *t, struct karg *args)
 {
-	gboolean		d;
+	gboolean	d;
 
 	if (t == NULL || args == NULL) {
 		show_oops(NULL, "search invalid parameters");
 		return (1);
 	}
+
+	switch (args->i) {
+	case  XT_SEARCH_NEXT:
+		d = t->search_forward;
+		break;
+	case  XT_SEARCH_PREV:
+		d = !t->search_forward;
+		break;
+	default:
+		return (XT_CB_PASSTHROUGH);
+	}
+
 	if (t->search_text == NULL) {
 		if (global_search == NULL)
 			return (XT_CB_PASSTHROUGH);
 		else {
+			d = t->search_forward = TRUE;
 			t->search_text = g_strdup(global_search);
 			webkit_web_view_mark_text_matches(t->wv, global_search, FALSE, 0);
 			webkit_web_view_set_highlight_text_matches(t->wv, TRUE);
@@ -5106,17 +5119,6 @@ search(struct tab *t, struct karg *args)
 	DNPRINTF(XT_D_CMD, "search: tab %d opc %d forw %d text %s\n",
 	    t->tab_id, args->i, t->search_forward, t->search_text);
 
-	switch (args->i) {
-	case  XT_SEARCH_NEXT:
-		d = t->search_forward;
-		break;
-	case  XT_SEARCH_PREV:
-		d = !t->search_forward;
-		break;
-	default:
-		return (XT_CB_PASSTHROUGH);
-	}
-
 	webkit_web_view_search_text(t->wv, t->search_text, FALSE, d, TRUE);
 
 	return (XT_CB_HANDLED);
t&id=7a5832204a80ff43d23c3a384c26e2217ef5908b'>7a583220 ^
96838051 ^














7dac9ade ^
96838051 ^






































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121