Rename history.exclude to completion.web_history.exclude
If the blacklist is only valid for the completion, the setting should also be under completion. This also un-renames history.gap_interval and renames completion.web_history_max_items.
This commit is contained in:
parent
4f56355fbe
commit
dbdeb6a9c7
@ -25,8 +25,8 @@ Added
|
|||||||
- When `:spawn --userscript` is called with a count, that count is now
|
- When `:spawn --userscript` is called with a count, that count is now
|
||||||
passed to userscripts as `$QUTE_COUNT`.
|
passed to userscripts as `$QUTE_COUNT`.
|
||||||
- New `content.mouse_lock` setting to handle HTML5 pointer locking.
|
- New `content.mouse_lock` setting to handle HTML5 pointer locking.
|
||||||
- New `history.exclude` setting which hides a list of URL patterns from the
|
- New `completion.web_history.exclude` setting which hides a list of URL
|
||||||
completion and `qute://history`.
|
patterns from the completion.
|
||||||
|
|
||||||
Changed
|
Changed
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
@ -39,7 +39,8 @@ Changed
|
|||||||
- The `app_id` is now set to `qutebrowser` for Wayland.
|
- The `app_id` is now set to `qutebrowser` for Wayland.
|
||||||
- `Command` or `Cmd` can now be used (instead of `Meta`) to map the Command key
|
- `Command` or `Cmd` can now be used (instead of `Meta`) to map the Command key
|
||||||
on macOS.
|
on macOS.
|
||||||
- The `history_gap_interval` setting got renamed to `history.gap_interval`.
|
- The `completion.web_history_max_items` setting got renamed to
|
||||||
|
`completion.web_history.max_items`.
|
||||||
|
|
||||||
v1.4.2 (unreleased)
|
v1.4.2 (unreleased)
|
||||||
-------------------
|
-------------------
|
||||||
|
@ -453,7 +453,7 @@ or always navigate through command history with
|
|||||||
:bind -m command <Down> command-history-next
|
:bind -m command <Down> command-history-next
|
||||||
----
|
----
|
||||||
|
|
||||||
- The default for `completion.web_history_max_items` is now set to `-1`, showing
|
- The default for `completion.web_history.max_items` is now set to `-1`, showing
|
||||||
an unlimited number of items in the completion for `:open` as the new
|
an unlimited number of items in the completion for `:open` as the new
|
||||||
sqlite-based completion is much faster. If the `:open` completion is too slow
|
sqlite-based completion is much faster. If the `:open` completion is too slow
|
||||||
on your machine, set an appropriate limit again.
|
on your machine, set an appropriate limit again.
|
||||||
|
@ -107,7 +107,8 @@
|
|||||||
|<<completion.shrink,completion.shrink>>|Shrink the completion to be smaller than the configured size if there are no scrollbars.
|
|<<completion.shrink,completion.shrink>>|Shrink the completion to be smaller than the configured size if there are no scrollbars.
|
||||||
|<<completion.timestamp_format,completion.timestamp_format>>|Format of timestamps (e.g. for the history completion).
|
|<<completion.timestamp_format,completion.timestamp_format>>|Format of timestamps (e.g. for the history completion).
|
||||||
|<<completion.use_best_match,completion.use_best_match>>|Execute the best-matching command on a partial match.
|
|<<completion.use_best_match,completion.use_best_match>>|Execute the best-matching command on a partial match.
|
||||||
|<<completion.web_history_max_items,completion.web_history_max_items>>|Number of URLs to show in the web history.
|
|<<completion.web_history.exclude,completion.web_history.exclude>>|A list of patterns which should not be shown in the history.
|
||||||
|
|<<completion.web_history.max_items,completion.web_history.max_items>>|Number of URLs to show in the web history.
|
||||||
|<<confirm_quit,confirm_quit>>|Require a confirmation before quitting the application.
|
|<<confirm_quit,confirm_quit>>|Require a confirmation before quitting the application.
|
||||||
|<<content.autoplay,content.autoplay>>|Automatically start playing `<video>` elements.
|
|<<content.autoplay,content.autoplay>>|Automatically start playing `<video>` elements.
|
||||||
|<<content.cache.appcache,content.cache.appcache>>|Enable support for the HTML 5 web application cache feature.
|
|<<content.cache.appcache,content.cache.appcache>>|Enable support for the HTML 5 web application cache feature.
|
||||||
@ -205,8 +206,7 @@
|
|||||||
|<<hints.prev_regexes,hints.prev_regexes>>|Comma-separated list of regular expressions to use for 'prev' links.
|
|<<hints.prev_regexes,hints.prev_regexes>>|Comma-separated list of regular expressions to use for 'prev' links.
|
||||||
|<<hints.scatter,hints.scatter>>|Scatter hint key chains (like Vimium) or not (like dwb).
|
|<<hints.scatter,hints.scatter>>|Scatter hint key chains (like Vimium) or not (like dwb).
|
||||||
|<<hints.uppercase,hints.uppercase>>|Make characters in hint strings uppercase.
|
|<<hints.uppercase,hints.uppercase>>|Make characters in hint strings uppercase.
|
||||||
|<<history.exclude,history.exclude>>|A list of patterns which should not be shown in the history.
|
|<<history_gap_interval,history_gap_interval>>|Maximum time (in minutes) between two history items for them to be considered being from the same browsing session.
|
||||||
|<<history.gap_interval,history.gap_interval>>|Maximum time (in minutes) between two history items for them to be considered being from the same browsing session.
|
|
||||||
|<<input.escape_quits_reporter,input.escape_quits_reporter>>|Allow Escape to quit the crash reporter.
|
|<<input.escape_quits_reporter,input.escape_quits_reporter>>|Allow Escape to quit the crash reporter.
|
||||||
|<<input.forward_unbound_keys,input.forward_unbound_keys>>|Which unbound keys to forward to the webview in normal mode.
|
|<<input.forward_unbound_keys,input.forward_unbound_keys>>|Which unbound keys to forward to the webview in normal mode.
|
||||||
|<<input.insert_mode.auto_enter,input.insert_mode.auto_enter>>|Enter insert mode if an editable element is clicked.
|
|<<input.insert_mode.auto_enter,input.insert_mode.auto_enter>>|Enter insert mode if an editable element is clicked.
|
||||||
@ -1448,8 +1448,19 @@ Type: <<types,Bool>>
|
|||||||
|
|
||||||
Default: +pass:[false]+
|
Default: +pass:[false]+
|
||||||
|
|
||||||
[[completion.web_history_max_items]]
|
[[completion.web_history.exclude]]
|
||||||
=== completion.web_history_max_items
|
=== completion.web_history.exclude
|
||||||
|
A list of patterns which should not be shown in the history.
|
||||||
|
This only affects the completion. Matching URLs are still saved in the history (and visible on the qute://history page), but hidden.
|
||||||
|
Changing this setting will cause the completion history to be regenerated on the next start, which will take a short while.
|
||||||
|
This setting requires a restart.
|
||||||
|
|
||||||
|
Type: <<types,List of UrlPattern>>
|
||||||
|
|
||||||
|
Default: empty
|
||||||
|
|
||||||
|
[[completion.web_history.max_items]]
|
||||||
|
=== completion.web_history.max_items
|
||||||
Number of URLs to show in the web history.
|
Number of URLs to show in the web history.
|
||||||
0: no history / -1: unlimited
|
0: no history / -1: unlimited
|
||||||
|
|
||||||
@ -2510,19 +2521,8 @@ Type: <<types,Bool>>
|
|||||||
|
|
||||||
Default: +pass:[false]+
|
Default: +pass:[false]+
|
||||||
|
|
||||||
[[history.exclude]]
|
[[history_gap_interval]]
|
||||||
=== history.exclude
|
=== history_gap_interval
|
||||||
A list of patterns which should not be shown in the history.
|
|
||||||
This only affects the completion and qute://history page. Matching URLs are still saved in the history, but hidden.
|
|
||||||
Changing this setting will cause the completion history to be regenerated on the next start, which will take a short while.
|
|
||||||
This setting requires a restart.
|
|
||||||
|
|
||||||
Type: <<types,List of UrlPattern>>
|
|
||||||
|
|
||||||
Default: empty
|
|
||||||
|
|
||||||
[[history.gap_interval]]
|
|
||||||
=== history.gap_interval
|
|
||||||
Maximum time (in minutes) between two history items for them to be considered being from the same browsing session.
|
Maximum time (in minutes) between two history items for them to be considered being from the same browsing session.
|
||||||
Items with less time between them are grouped when being displayed in `:history`. Use -1 to disable separation.
|
Items with less time between them are grouped when being displayed in `:history`. Use -1 to disable separation.
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ class WebHistory(sql.SqlTable):
|
|||||||
def __contains__(self, url):
|
def __contains__(self, url):
|
||||||
return self._contains_query.run(val=url).value()
|
return self._contains_query.run(val=url).value()
|
||||||
|
|
||||||
@config.change_filter('history.exclude')
|
@config.change_filter('completion.web_history.exclude')
|
||||||
def _on_config_changed(self):
|
def _on_config_changed(self):
|
||||||
self.metainfo['force_rebuild'] = True
|
self.metainfo['force_rebuild'] = True
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ class WebHistory(sql.SqlTable):
|
|||||||
for entry in q.run():
|
for entry in q.run():
|
||||||
url = QUrl(entry.url)
|
url = QUrl(entry.url)
|
||||||
if any(pattern.matches(url)
|
if any(pattern.matches(url)
|
||||||
for pattern in config.val.history.exclude):
|
for pattern in config.val.completion.web_history.exclude):
|
||||||
continue
|
continue
|
||||||
data['url'].append(self._format_completion_url(url))
|
data['url'].append(self._format_completion_url(url))
|
||||||
data['title'].append(entry.title)
|
data['title'].append(entry.title)
|
||||||
@ -270,7 +270,7 @@ class WebHistory(sql.SqlTable):
|
|||||||
'redirect': redirect})
|
'redirect': redirect})
|
||||||
|
|
||||||
if any(pattern.matches(url)
|
if any(pattern.matches(url)
|
||||||
for pattern in config.val.history.exclude):
|
for pattern in config.val.completion.web_history.exclude):
|
||||||
return
|
return
|
||||||
if redirect:
|
if redirect:
|
||||||
return
|
return
|
||||||
|
@ -276,7 +276,7 @@ def qute_history(url):
|
|||||||
return 'text/html', jinja.render(
|
return 'text/html', jinja.render(
|
||||||
'history.html',
|
'history.html',
|
||||||
title='History',
|
title='History',
|
||||||
gap_interval=config.val.history.gap_interval
|
gap_interval=config.val.history_gap_interval
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class HistoryCategory(QSqlQueryModel):
|
|||||||
|
|
||||||
def _atime_expr(self):
|
def _atime_expr(self):
|
||||||
"""If max_items is set, return an expression to limit the query."""
|
"""If max_items is set, return an expression to limit the query."""
|
||||||
max_items = config.val.completion.web_history_max_items
|
max_items = config.val.completion.web_history.max_items
|
||||||
# HistoryCategory should not be added to the completion in that case.
|
# HistoryCategory should not be added to the completion in that case.
|
||||||
assert max_items != 0
|
assert max_items != 0
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ def url(*, info):
|
|||||||
model.add_category(listcategory.ListCategory(
|
model.add_category(listcategory.ListCategory(
|
||||||
'Bookmarks', bookmarks, delete_func=_delete_bookmark, sort=False))
|
'Bookmarks', bookmarks, delete_func=_delete_bookmark, sort=False))
|
||||||
|
|
||||||
if info.config.get('completion.web_history_max_items') != 0:
|
if info.config.get('completion.web_history.max_items') != 0:
|
||||||
hist_cat = histcategory.HistoryCategory(delete_func=_delete_history)
|
hist_cat = histcategory.HistoryCategory(delete_func=_delete_history)
|
||||||
model.add_category(hist_cat)
|
model.add_category(hist_cat)
|
||||||
return model
|
return model
|
||||||
|
@ -802,7 +802,26 @@ completion.timestamp_format:
|
|||||||
default: '%Y-%m-%d'
|
default: '%Y-%m-%d'
|
||||||
desc: Format of timestamps (e.g. for the history completion).
|
desc: Format of timestamps (e.g. for the history completion).
|
||||||
|
|
||||||
|
completion.web_history.exclude:
|
||||||
|
type:
|
||||||
|
name: List
|
||||||
|
valtype: UrlPattern
|
||||||
|
none_ok: true
|
||||||
|
default: []
|
||||||
|
restart: true
|
||||||
|
desc: >-
|
||||||
|
A list of patterns which should not be shown in the history.
|
||||||
|
|
||||||
|
This only affects the completion. Matching URLs are still saved in the
|
||||||
|
history (and visible on the qute://history page), but hidden.
|
||||||
|
|
||||||
|
Changing this setting will cause the completion history to be regenerated
|
||||||
|
on the next start, which will take a short while.
|
||||||
|
|
||||||
completion.web_history_max_items:
|
completion.web_history_max_items:
|
||||||
|
renamed: completion.web_history.max_items
|
||||||
|
|
||||||
|
completion.web_history.max_items:
|
||||||
default: -1
|
default: -1
|
||||||
type:
|
type:
|
||||||
name: Int
|
name: Int
|
||||||
@ -1043,9 +1062,6 @@ hints.uppercase:
|
|||||||
## history
|
## history
|
||||||
|
|
||||||
history_gap_interval:
|
history_gap_interval:
|
||||||
renamed: history.gap_interval
|
|
||||||
|
|
||||||
history.gap_interval:
|
|
||||||
type: Int
|
type: Int
|
||||||
default: 30
|
default: 30
|
||||||
desc: >-
|
desc: >-
|
||||||
@ -1055,22 +1071,6 @@ history.gap_interval:
|
|||||||
Items with less time between them are grouped when being displayed in
|
Items with less time between them are grouped when being displayed in
|
||||||
`:history`. Use -1 to disable separation.
|
`:history`. Use -1 to disable separation.
|
||||||
|
|
||||||
history.exclude:
|
|
||||||
type:
|
|
||||||
name: List
|
|
||||||
valtype: UrlPattern
|
|
||||||
none_ok: true
|
|
||||||
default: []
|
|
||||||
restart: true
|
|
||||||
desc: >-
|
|
||||||
A list of patterns which should not be shown in the history.
|
|
||||||
|
|
||||||
This only affects the completion. Matching URLs are still saved in the
|
|
||||||
history (and visible on the qute://history page), but hidden.
|
|
||||||
|
|
||||||
Changing this setting will cause the completion history to be regenerated
|
|
||||||
on the next start, which will take a short while.
|
|
||||||
|
|
||||||
## input
|
## input
|
||||||
|
|
||||||
input.escape_quits_reporter:
|
input.escape_quits_reporter:
|
||||||
|
@ -226,7 +226,8 @@ class TestAdd:
|
|||||||
|
|
||||||
def test_exclude(self, hist, config_stub):
|
def test_exclude(self, hist, config_stub):
|
||||||
"""Excluded URLs should be in the history but not completion."""
|
"""Excluded URLs should be in the history but not completion."""
|
||||||
config_stub.set_obj('history.exclude', ['*.example.org'])
|
config_stub.set_obj('completion.web_history.exclude',
|
||||||
|
['*.example.org'])
|
||||||
url = QUrl('http://www.example.org/')
|
url = QUrl('http://www.example.org/')
|
||||||
hist.add_from_tab(url, url, 'title')
|
hist.add_from_tab(url, url, 'title')
|
||||||
assert list(hist)
|
assert list(hist)
|
||||||
@ -484,8 +485,12 @@ class TestRebuild:
|
|||||||
assert not hist3.metainfo['force_rebuild']
|
assert not hist3.metainfo['force_rebuild']
|
||||||
|
|
||||||
def test_exclude(self, config_stub, hist):
|
def test_exclude(self, config_stub, hist):
|
||||||
"""Ensure that patterns in history.exclude are ignored."""
|
"""Ensure that patterns in completion.web_history.exclude are ignored.
|
||||||
config_stub.set_obj('history.exclude', ['*.example.org'])
|
|
||||||
|
This setting should only be used for the completion.
|
||||||
|
"""
|
||||||
|
config_stub.set_obj('completion.web_history.exclude',
|
||||||
|
['*.example.org'])
|
||||||
assert hist.metainfo['force_rebuild']
|
assert hist.metainfo['force_rebuild']
|
||||||
|
|
||||||
hist.add_url(QUrl('http://example.com'), redirect=False, atime=1)
|
hist.add_url(QUrl('http://example.com'), redirect=False, atime=1)
|
||||||
@ -495,7 +500,7 @@ class TestRebuild:
|
|||||||
assert list(hist2.completion) == [('http://example.com', '', 1)]
|
assert list(hist2.completion) == [('http://example.com', '', 1)]
|
||||||
|
|
||||||
def test_unrelated_config_change(self, config_stub, hist):
|
def test_unrelated_config_change(self, config_stub, hist):
|
||||||
config_stub.set_obj('history.gap_interval', 1234)
|
config_stub.set_obj('history_gap_interval', 1234)
|
||||||
assert not hist.metainfo['force_rebuild']
|
assert not hist.metainfo['force_rebuild']
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,8 +135,8 @@ class TestHistoryHandler:
|
|||||||
assert item['time'] > end_time
|
assert item['time'] > end_time
|
||||||
|
|
||||||
def test_exclude(self, fake_web_history, now, config_stub):
|
def test_exclude(self, fake_web_history, now, config_stub):
|
||||||
"""Make sure the history.exclude setting does not apply."""
|
"""Make sure the completion.web_history.exclude setting is not used."""
|
||||||
config_stub.set_obj('history.exclude', ['www.x.com'])
|
config_stub.set_obj('completion.web_history.exclude', ['www.x.com'])
|
||||||
|
|
||||||
url = QUrl("qute://history/data?start_time={}".format(now))
|
url = QUrl("qute://history/data?start_time={}".format(now))
|
||||||
_mimetype, data = qutescheme.qute_history(url)
|
_mimetype, data = qutescheme.qute_history(url)
|
||||||
|
@ -30,7 +30,7 @@ from qutebrowser.completion.models import histcategory
|
|||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def hist(init_sql, config_stub):
|
def hist(init_sql, config_stub):
|
||||||
config_stub.val.completion.timestamp_format = '%Y-%m-%d'
|
config_stub.val.completion.timestamp_format = '%Y-%m-%d'
|
||||||
config_stub.val.completion.web_history_max_items = -1
|
config_stub.val.completion.web_history.max_items = -1
|
||||||
return sql.SqlTable('CompletionHistory', ['url', 'title', 'last_atime'])
|
return sql.SqlTable('CompletionHistory', ['url', 'title', 'last_atime'])
|
||||||
|
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ def test_set_pattern_repeated(model_validator, hist):
|
|||||||
])
|
])
|
||||||
def test_sorting(max_items, before, after, model_validator, hist, config_stub):
|
def test_sorting(max_items, before, after, model_validator, hist, config_stub):
|
||||||
"""Validate the filtering and sorting results of set_pattern."""
|
"""Validate the filtering and sorting results of set_pattern."""
|
||||||
config_stub.val.completion.web_history_max_items = max_items
|
config_stub.val.completion.web_history.max_items = max_items
|
||||||
for url, title, atime in before:
|
for url, title, atime in before:
|
||||||
timestamp = datetime.datetime.strptime(atime, '%Y-%m-%d').timestamp()
|
timestamp = datetime.datetime.strptime(atime, '%Y-%m-%d').timestamp()
|
||||||
hist.insert({'url': url, 'title': title, 'last_atime': timestamp})
|
hist.insert({'url': url, 'title': title, 'last_atime': timestamp})
|
||||||
|
@ -172,7 +172,7 @@ def bookmarks(bookmark_manager_stub):
|
|||||||
def web_history(init_sql, stubs, config_stub):
|
def web_history(init_sql, stubs, config_stub):
|
||||||
"""Fixture which provides a web-history object."""
|
"""Fixture which provides a web-history object."""
|
||||||
config_stub.val.completion.timestamp_format = '%Y-%m-%d'
|
config_stub.val.completion.timestamp_format = '%Y-%m-%d'
|
||||||
config_stub.val.completion.web_history_max_items = -1
|
config_stub.val.completion.web_history.max_items = -1
|
||||||
stub = history.WebHistory()
|
stub = history.WebHistory()
|
||||||
objreg.register('web-history', stub)
|
objreg.register('web-history', stub)
|
||||||
yield stub
|
yield stub
|
||||||
@ -518,7 +518,7 @@ def test_url_completion_delete_history(qtmodeltester, info,
|
|||||||
def test_url_completion_zero_limit(config_stub, web_history, quickmarks, info,
|
def test_url_completion_zero_limit(config_stub, web_history, quickmarks, info,
|
||||||
bookmarks):
|
bookmarks):
|
||||||
"""Make sure there's no history if the limit was set to zero."""
|
"""Make sure there's no history if the limit was set to zero."""
|
||||||
config_stub.val.completion.web_history_max_items = 0
|
config_stub.val.completion.web_history.max_items = 0
|
||||||
model = urlmodel.url(info=info)
|
model = urlmodel.url(info=info)
|
||||||
model.set_pattern('')
|
model.set_pattern('')
|
||||||
category = model.index(2, 0) # "History" normally
|
category = model.index(2, 0) # "History" normally
|
||||||
|
Loading…
Reference in New Issue
Block a user