Changes formatters to print multiline text on one line

This commit is contained in:
Tarcisio Fedrizzi 2016-02-28 23:45:02 +01:00
parent a9fdf09a04
commit 25bc2dc1db
2 changed files with 6 additions and 7 deletions

View File

@ -818,8 +818,7 @@ class CommandDispatcher:
text = utils.get_clipboard(selection=sel) text = utils.get_clipboard(selection=sel)
if not text.strip(): if not text.strip():
raise cmdexc.CommandError("{} is empty.".format(target)) raise cmdexc.CommandError("{} is empty.".format(target))
log.misc.debug("{} contained: '{}'".format(target, log.misc.debug("{} contained: {!r}".format(target, text))
text.replace('\n', '\\n')))
text_urls = [u for u in text.split('\n') if u.strip()] text_urls = [u for u in text.split('\n') if u.strip()]
if (len(text_urls) > 1 and not urlutils.is_url(text_urls[0]) and if (len(text_urls) > 1 and not urlutils.is_url(text_urls[0]) and
urlutils.get_path_if_valid( urlutils.get_path_if_valid(

View File

@ -80,7 +80,7 @@ def _parse_search_term(s):
engine = None engine = None
term = s term = s
log.url.debug("engine {}, term '{}'".format(engine, term)) log.url.debug("engine {}, term {!r}".format(engine, term))
return (engine, term) return (engine, term)
@ -93,7 +93,7 @@ def _get_search_url(txt):
Return: Return:
The search URL as a QUrl. The search URL as a QUrl.
""" """
log.url.debug("Finding search engine for '{}'".format(txt)) log.url.debug("Finding search engine for {!r}".format(txt))
engine, term = _parse_search_term(txt) engine, term = _parse_search_term(txt)
assert term assert term
if engine is None: if engine is None:
@ -186,7 +186,7 @@ def fuzzy_url(urlstr, cwd=None, relative=False, do_search=True):
url = _get_search_url(urlstr) url = _get_search_url(urlstr)
except ValueError: # invalid search engine except ValueError: # invalid search engine
url = qurl_from_user_input(urlstr) url = qurl_from_user_input(urlstr)
log.url.debug("Converting fuzzy term {} to URL -> {}".format( log.url.debug("Converting fuzzy term {!r} to URL -> {}".format(
urlstr, url.toDisplayString())) urlstr, url.toDisplayString()))
if do_search and config.get('general', 'auto-search') and urlstr: if do_search and config.get('general', 'auto-search') and urlstr:
qtutils.ensure_valid(url) qtutils.ensure_valid(url)
@ -234,7 +234,7 @@ def is_url(urlstr):
""" """
autosearch = config.get('general', 'auto-search') autosearch = config.get('general', 'auto-search')
log.url.debug("Checking if '{}' is a URL (autosearch={}).".format( log.url.debug("Checking if {!r} is a URL (autosearch={}).".format(
urlstr, autosearch)) urlstr, autosearch))
urlstr = urlstr.strip() urlstr = urlstr.strip()
@ -351,7 +351,7 @@ def get_path_if_valid(pathstr, cwd=None, relative=False, check_exists=False):
The path if it is a valid path, None otherwise. The path if it is a valid path, None otherwise.
""" """
pathstr = pathstr.strip() pathstr = pathstr.strip()
log.url.debug("Checking if '{}' is a path".format(pathstr)) log.url.debug("Checking if {!r} is a path".format(pathstr))
expanded = os.path.expanduser(pathstr) expanded = os.path.expanduser(pathstr)
if os.path.isabs(expanded): if os.path.isabs(expanded):