diff options
author | Vincent Sanders <vince@kyllikki.org> | 2020-05-23 22:59:40 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2020-05-23 23:00:08 +0100 |
commit | 6108d210d508e754904c46f687adbc87ab98dc78 (patch) | |
tree | a4eb69842a1f3add488def75c9c88e384e5257da /content/handlers/text | |
parent | 1161029d2952e5e11062d750a0a681643574428e (diff) | |
download | netsurf-6108d210d508e754904c46f687adbc87ab98dc78.tar.gz netsurf-6108d210d508e754904c46f687adbc87ab98dc78.tar.bz2 |
remove all direct access to selection structure
Diffstat (limited to 'content/handlers/text')
-rw-r--r-- | content/handlers/text/textplain.c | 34 |
1 files changed, 10 insertions, 24 deletions
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; } - - - - - - |