Improvments for hints/page-prev/page-next

This commit is contained in:
Florian Bruhin 2014-07-09 21:14:15 +02:00
parent 387ff8bbb6
commit 72b854049b
4 changed files with 8 additions and 11 deletions

View File

@ -5,8 +5,6 @@ Bugs
e.g. loading a page and immediately yanking the (non-resolved) URL should e.g. loading a page and immediately yanking the (non-resolved) URL should
work. work.
- page-forward clicks "Newest" on http://explosm.net/ instead of "Next".
- seir sometimes sees "-- COMMAND MODE --" even though that should never - seir sometimes sees "-- COMMAND MODE --" even though that should never
happen. happen.

View File

@ -375,7 +375,7 @@ class HintManager(QObject):
return None return None
for regex in config.get('hints', option): for regex in config.get('hints', option):
for e in elems: for e in elems:
if regex.match(e.toPlainText()): if regex.search(e.toPlainText()):
return e return e
return None return None

View File

@ -576,14 +576,13 @@ DATA = OrderedDict([
('next-regexes', ('next-regexes',
SettingValue(types.RegexList(flags=re.IGNORECASE), SettingValue(types.RegexList(flags=re.IGNORECASE),
r'\bnext\b,\bmore\b,\bnewer\b,^>$$,^(>>|»|→|≫)$$,' r'\bnext\b,\bmore\b,\bnewer\b,\b[>→≫]\b,\b(>>|»)\b'),
r'^(>|»|→|≫),(>|»|→|≫)$$'),
"A comma-separated list of regexes to use for 'next' links."), "A comma-separated list of regexes to use for 'next' links."),
('prev-regexes', ('prev-regexes',
SettingValue(types.RegexList(flags=re.IGNORECASE), SettingValue(types.RegexList(flags=re.IGNORECASE),
r'\bprev(ious)\b,\bback\b,\bolder\b,^<$$,^(<<|«|←|≪)$$,' r'\bprev(ious)?\b,\bback\b,\bolder\b,\b[<←≪]\b,'
r'^(<|«|←|≪),(<|«|←|≪)$$'), r'\b(<<|«)\b'),
"A comma-separated list of regexes to use for 'prev' links."), "A comma-separated list of regexes to use for 'prev' links."),
)), )),

View File

@ -40,10 +40,10 @@ Group = enum('all', 'links', 'images', 'editable', 'url', 'prevnext_rel',
SELECTORS = { SELECTORS = {
Group.all: ('a, textarea, select, input:not([type=hidden]), button, ' Group.all: ('a, area, textarea, select, input:not([type=hidden]), button, '
'frame, iframe, [onclick], [onmousedown], [role=link], ' 'frame, iframe, [onclick], [onmousedown], [role=link], '
'[role=option], [role=button], img'), '[role=option], [role=button], img'),
Group.links: 'a', Group.links: 'a, area, link',
Group.images: 'img', Group.images: 'img',
# This doesn't contain all the groups where we should switch to insert mode # This doesn't contain all the groups where we should switch to insert mode
# - it is just used when opening the external editor. # - it is just used when opening the external editor.
@ -56,8 +56,8 @@ SELECTORS = {
'input[type=search]:focus, ' 'input[type=search]:focus, '
'textarea:focus'), 'textarea:focus'),
Group.url: '[src], [href]', Group.url: '[src], [href]',
Group.prevnext_rel: 'link, [role=link]', Group.prevnext_rel: 'a, area, link, [role=link]',
Group.prevnext: 'a, button, [role=button]', Group.prevnext: 'a, area, button, [role=button]',
} }
FILTERS = { FILTERS = {