mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[search] bool document.browse.search.beginning_only . Default 0
Whether typeahead searching should match only the beginnings of links.
This commit is contained in:
parent
81cd0282cf
commit
af9cf82e3d
@ -429,6 +429,10 @@ static union option_info config_options_info[] = {
|
||||
"search", 0,
|
||||
N_("Options for searching.")),
|
||||
|
||||
INIT_OPT_BOOL("document.browse.search", N_("Match beginning only"),
|
||||
"beginning_only", 0, 0,
|
||||
N_("Whether the search should match only the beginning of a link.")),
|
||||
|
||||
INIT_OPT_BOOL("document.browse.search", N_("Case sensitivity"),
|
||||
"case", 0, 0,
|
||||
N_("Whether the search should match the document text while "
|
||||
|
@ -1464,6 +1464,7 @@ search_link_text(struct document *document, int current_link, int i,
|
||||
char *text, int direction, int *offset)
|
||||
{
|
||||
int upper_link, lower_link;
|
||||
int beginning_only = get_opt_bool("document.browse.search.beginning_only", NULL);
|
||||
int case_sensitive = get_opt_bool("document.browse.search.case", NULL);
|
||||
int wraparound = get_opt_bool("document.browse.search.wraparound",
|
||||
NULL);
|
||||
@ -1486,7 +1487,12 @@ search_link_text(struct document *document, int current_link, int i,
|
||||
int match_offset = match_link_text(link, text, textlen,
|
||||
case_sensitive);
|
||||
|
||||
if (match_offset >= 0) {
|
||||
if (beginning_only) {
|
||||
if (match_offset == 0) {
|
||||
*offset = match_offset;
|
||||
return i;
|
||||
}
|
||||
} else if (match_offset >= 0) {
|
||||
*offset = match_offset;
|
||||
return i;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user