ELinks 0.16.1.1
|
Searching in the HTML document. More...
#include <ctype.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include "elinks.h"
#include "bfu/dialog.h"
#include "config/kbdbind.h"
#include "document/document.h"
#include "document/view.h"
#include "intl/charsets.h"
#include "intl/libintl.h"
#include "main/event.h"
#include "main/module.h"
#include "session/session.h"
#include "terminal/screen.h"
#include "terminal/terminal.h"
#include "util/color.h"
#include "util/error.h"
#include "util/memory.h"
#include "util/string.h"
#include "viewer/action.h"
#include "viewer/text/draw.h"
#include "viewer/text/link.h"
#include "viewer/text/search.h"
#include "viewer/text/view.h"
#include "viewer/text/vs.h"
Data Structures | |
struct | search_dlg_hop |
Macros | |
#define | _GNU_SOURCE /* XXX: we _WANT_ strcasestr() ! */ |
#define | SEARCH_HISTORY_FILENAME "searchhist" |
#define | UCHAR unicode_val_T |
#define | PATTERN const wchar_t |
#define | Regcomp tre_regwcomp |
#define | Regexec tre_regwexec |
#define | maybe_tolower(c) |
#define | realloc_points(pts, size) |
#define | maybe_tolower(c) |
#define | maybe_tolower(c) |
#define | HASH_SIZE 4096 |
#define | HASH(p) |
#define | SEARCH_WIDGETS_COUNT 5 |
Enumerations | |
enum | find_error { FIND_ERROR_NONE , FIND_ERROR_NO_PREVIOUS_SEARCH , FIND_ERROR_HIT_TOP , FIND_ERROR_HIT_BOTTOM , FIND_ERROR_NOT_FOUND , FIND_ERROR_MEMORY , FIND_ERROR_REGEX } |
enum | search_option { SEARCH_OPT_CASE , SEARCH_OPTIONS } |
Functions | |
static | INIT_INPUT_HISTORY (search_history) |
static UCHAR * | memacpy_u (char *text, int textlen, int utf8) |
static enum frame_event_status | move_search_do (struct session *ses, struct document_view *doc_view, int direction) |
static void | add_srch_chr (struct document *document, UCHAR c, int x, int y, int nn) |
static void | sort_srch (struct document *document) |
static int | get_srch (struct document *document) |
static void | get_search_data (struct document *document) |
static int | get_range (struct document *document, int y, int height, int l, struct search **s1, struct search **s2) |
Assign s1 and s2 the first search node and the last search node needed to form the region starting at line y and ending at the greater of y + height and the end of the document, with allowance at the start to allow for multi-line matches that would otherwise be partially outside of the region. | |
static int | strlen_u (char *text, int utf8) |
static UCHAR * | lowered_string (char *text, int textlen, int utf8) |
Returns an allocated string which is a lowered copy of passed one. | |
static int | is_in_range_plain (struct document *document, int y, int height, char *text, int textlen, int *min, int *max, struct search *s1, struct search *s2, int utf8) |
static int | is_in_range (struct document *document, int y, int height, char *text, int *min, int *max) |
static void | get_searched_plain (struct document_view *doc_view, struct point **pt, int *pl, int l, struct search *s1, struct search *s2, int utf8) |
static void | get_searched_plain_all (struct document_view *doc_view, struct point **pt, int *pl, int l, struct search *s1, struct search *s2, int utf8) |
static void | get_searched (struct document_view *doc_view, struct point **pt, int *pl, int utf8) |
void | draw_searched (struct terminal *term, struct document_view *doc_view) |
Highlighting of searched strings. | |
static enum find_error | find_next_do (struct session *ses, struct document_view *doc_view, int direction) |
static void | print_find_error (struct session *ses, enum find_error find_error) |
static enum find_error | get_searched_all (struct session *ses, struct document_view *doc_view, struct point **pt, int *pl, int utf8) |
static enum find_error | search_for_do (struct session *ses, const char *str, int direction, int report_errors) |
static void | search_for_back (struct session *ses, const char *str) |
void | search_for (struct session *ses, const char *str) |
static int | point_intersect (struct point *p1, int l1, struct point *p2, int l2) |
static int | find_next_link_in_search (struct document_view *doc_view, int direction) |
static void | print_find_error_not_found (struct session *ses, char *title, char *message, char *search_string) |
static void | print_find_error (struct session *ses, enum find_error find_error) |
static enum find_error | move_search_number (struct session *ses, struct document_view *doc_view, int number) |
static int | is_y_on_screen (struct document_view *doc_view, int y) |
static void | find_first_search_in_view (struct session *ses, struct document_view *doc_view) |
enum frame_event_status | move_search_next (struct session *ses, struct document_view *doc_view) |
enum frame_event_status | move_search_prev (struct session *ses, struct document_view *doc_view) |
enum frame_event_status | find_next (struct session *ses, struct document_view *doc_view, int direction) |
static widget_handler_status_T | search_dlg_cancel (struct dialog_data *dlg_data, struct widget_data *widget_data) |
static widget_handler_status_T | search_dlg_ok (struct dialog_data *dlg_data, struct widget_data *widget_data) |
static void | search_dlg_do (struct terminal *term, struct memory_list *ml, char *title, void *data, struct input_history *history, void(*fn)(void *, char *)) |
enum frame_event_status | search_dlg (struct session *ses, struct document_view *doc_view, int direction) |
static enum evhook_status | search_history_write_hook (va_list ap, void *data) |
static void | init_search_history (struct module *module) |
static void | done_search_history (struct module *module) |
Typeahead | |
static enum input_line_code | text_typeahead_handler (struct input_line *line, int action_id) |
action_id can be a value from enum edit_action, in which case the approriate action is performed; -1, which indicates to search and report any errors; or -2, which indicates to search without reporting any errors. | |
static enum input_line_code | link_typeahead_handler (struct input_line *line, int action_id) |
enum frame_event_status | search_typeahead (struct session *ses, struct document_view *doc_view, action_id_T action_id) |
Variables | |
static struct option_resolver | resolvers [] |
static struct event_hook_info | search_history_hooks [] |
struct module | search_history_module |
Link typeahead | |
enum | typeahead_code { TYPEAHEAD_MATCHED , TYPEAHEAD_ERROR , TYPEAHEAD_ERROR_NO_FURTHER , TYPEAHEAD_CANCEL } |
static void | typeahead_error (struct session *ses, char *typeahead, int no_further) |
static const char * | get_link_typeahead_text (struct link *link) |
static int | match_link_text (struct link *link, char *text, int textlen, int case_sensitive) |
static int | search_link_text (struct document *document, int current_link, int i, char *text, int direction, int *offset) |
static void | fixup_typeahead_match (struct session *ses, struct document_view *doc_view) |
static UCHAR | get_document_char (struct document *document, int x, int y) |
static void | draw_typeahead_match (struct terminal *term, struct document_view *doc_view, int chars, int offset) |
static enum typeahead_code | do_typeahead (struct session *ses, struct document_view *doc_view, char *text, int action_id, int *offset) |
Searching in the HTML document.
#define _GNU_SOURCE /* XXX: we _WANT_ strcasestr() ! */ |
#define HASH_SIZE 4096 |
#define maybe_tolower | ( | c | ) |
#define maybe_tolower | ( | c | ) |
#define maybe_tolower | ( | c | ) |
#define PATTERN const wchar_t |
#define realloc_points | ( | pts, | |
size ) |
#define Regcomp tre_regwcomp |
#define Regexec tre_regwexec |
#define SEARCH_HISTORY_FILENAME "searchhist" |
#define SEARCH_WIDGETS_COUNT 5 |
#define UCHAR unicode_val_T |
enum find_error |
enum search_option |
enum typeahead_code |
|
static |
|
static |
void draw_searched | ( | struct terminal * | term, |
struct document_view * | doc_view ) |
Highlighting of searched strings.
|
static |
|
static |
enum frame_event_status find_next | ( | struct session * | ses, |
struct document_view * | doc_view, | ||
int | direction ) |
|
static |
|
static |
|
inlinestatic |
|
inlinestatic |
|
static |
Assign s1 and s2 the first search node and the last search node needed to form the region starting at line y and ending at the greater of y + height and the end of the document, with allowance at the start to allow for multi-line matches that would otherwise be partially outside of the region.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Returns an allocated string which is a lowered copy of passed one.
|
static |
|
static |
|
static |
enum frame_event_status move_search_next | ( | struct session * | ses, |
struct document_view * | doc_view ) |
|
static |
enum frame_event_status move_search_prev | ( | struct session * | ses, |
struct document_view * | doc_view ) |
|
static |
|
static |
|
static |
enum frame_event_status search_dlg | ( | struct session * | ses, |
struct document_view * | doc_view, | ||
int | direction ) |
|
static |
|
static |
|
static |
void search_for | ( | struct session * | ses, |
const char * | str ) |
|
static |
|
static |
|
static |
|
inlinestatic |
enum frame_event_status search_typeahead | ( | struct session * | ses, |
struct document_view * | doc_view, | ||
action_id_T | action_id ) |
|
static |
|
static |
|
static |
action_id can be a value from enum edit_action, in which case the approriate action is performed; -1, which indicates to search and report any errors; or -2, which indicates to search without reporting any errors.
|
static |
|
static |
|
static |