Revert fixes for quotes/spaces in maxsplit cmds.

Revert "Fix maxsplit-splitting with empty args (""/'')."
This reverts commit 46396cce1e.

Revert "Remove quotes with split=False commands."
This reverts commit 81bc5dae94.

See #564 and #453.
This commit is contained in:
Florian Bruhin 2015-04-03 14:44:44 +02:00
parent 7e51addeb0
commit 0b26e295bc

View File

@ -19,8 +19,6 @@
"""Module containing command managers (SearchRunner and CommandRunner).""" """Module containing command managers (SearchRunner and CommandRunner)."""
import re
from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject, QUrl from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject, QUrl
from PyQt5.QtWebKitWidgets import QWebPage from PyQt5.QtWebKitWidgets import QWebPage
@ -266,16 +264,8 @@ class CommandRunner(QObject):
else: else:
self._args = [] self._args = []
maxsplit = i + self._cmd.maxsplit + flag_arg_count maxsplit = i + self._cmd.maxsplit + flag_arg_count
args = split.simple_split(argstr, keep=keep, self._args = split.simple_split(argstr, keep=keep,
maxsplit=maxsplit) maxsplit=maxsplit)
for s in args:
# remove quotes and replace \" by "
if s == '""' or s == "''":
s = ''
else:
s = re.sub(r"""(^|[^\\])["']""", r'\1', s)
s = re.sub(r"""\\(["'])""", r'\1', s)
self._args.append(s)
break break
else: else:
# If there are only flags, we got it right on the first try # If there are only flags, we got it right on the first try