summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/handlers/html/interaction.c9
-rw-r--r--content/handlers/html/redraw.c3
-rw-r--r--content/handlers/text/textplain.c34
-rw-r--r--content/textsearch.c2
4 files changed, 13 insertions, 35 deletions
diff --git a/content/handlers/html/interaction.c b/content/handlers/html/interaction.c
index 0a963dd54..79846ae6a 100644
--- a/content/handlers/html/interaction.c
+++ b/content/handlers/html/interaction.c
@@ -1247,7 +1247,7 @@ default_mouse_action(html_content *html,
selection_clear(&html->sel, true);
}
- if (selection_defined(&html->sel)) {
+ if (selection_active(&html->sel)) {
sel_owner.none = false;
html_set_selection(html,
HTML_SELECTION_SELF,
@@ -1586,13 +1586,8 @@ bool html_keypress(struct content *c, uint32_t key)
return true;
case NS_KEY_ESCAPE:
- if (selection_defined(sel)) {
- selection_clear(sel, true);
- return true;
- }
-
/* if there's no selection, leave Escape for the caller */
- return false;
+ return selection_clear(sel, true);
}
return false;
diff --git a/content/handlers/html/redraw.c b/content/handlers/html/redraw.c
index 7c96c908a..08a284b57 100644
--- a/content/handlers/html/redraw.c
+++ b/content/handlers/html/redraw.c
@@ -184,8 +184,7 @@ text_redraw(const char *utf8_text,
unsigned end_idx;
/* first try the browser window's current selection */
- if (selection_defined(sel) &&
- selection_highlighted(sel,
+ if (selection_highlighted(sel,
offset,
offset + len,
&start_idx,
diff --git a/content/handlers/text/textplain.c b/content/handlers/text/textplain.c
index 6f034669a..8bc05e6d0 100644
--- a/content/handlers/text/textplain.c
+++ b/content/handlers/text/textplain.c
@@ -810,21 +810,14 @@ static bool textplain_keypress(struct content *c, uint32_t key)
return true;
case NS_KEY_ESCAPE:
- if (selection_defined(sel)) {
- selection_clear(sel, true);
- return true;
- }
-
/* if there's no selection, leave Escape for the caller */
- return false;
+ return selection_clear(sel, true);
}
return false;
}
-
-
/**
* Redraw a text string with highlighting
* (for selection/search)
@@ -871,8 +864,7 @@ text_draw(const char *utf8_text,
unsigned end_idx;
/* first try the browser window's current selection */
- if (selection_defined(sel) &&
- selection_highlighted(sel,
+ if (selection_highlighted(sel,
offset,
offset + len,
&start_idx,
@@ -1167,16 +1159,16 @@ textplain_redraw(struct content *c,
struct selection *sel = &text->sel;
bool highlighted = false;
- if (selection_defined(sel)) {
- unsigned start_idx, end_idx;
- if (selection_highlighted(sel,
- tab_ofst,
- tab_ofst + 1,
- &start_idx,
- &end_idx))
- highlighted = true;
+ unsigned start_idx, end_idx;
+ if (selection_highlighted(sel,
+ tab_ofst,
+ tab_ofst + 1,
+ &start_idx,
+ &end_idx)) {
+ highlighted = true;
}
+
if (!highlighted &&
(c->textsearch.context != NULL)) {
unsigned start_idx, end_idx;
@@ -1682,9 +1674,3 @@ size_t textplain_size(struct content *c)
return text->utf8_data_size;
}
-
-
-
-
-
-
diff --git a/content/textsearch.c b/content/textsearch.c
index 056da2bf6..18f9073dc 100644
--- a/content/textsearch.c
+++ b/content/textsearch.c
@@ -165,7 +165,6 @@ static void free_matches(struct textsearch_context *textsearch)
static void search_show_all(bool all, struct textsearch_context *context)
{
struct list_entry *a;
- nserror res;
for (a = context->found->next; a; a = a->next) {
bool add = true;
@@ -628,7 +627,6 @@ content_textsearch_ishighlighted(struct textsearch_context *textsearch,
for (cur = textsearch->found->next; cur != NULL; cur = cur->next) {
if (cur->sel &&
- selection_defined(cur->sel) &&
selection_highlighted(cur->sel,
start_offset,
end_offset,