parent
3306247ae5
commit
37a9691e29
@ -1619,6 +1619,8 @@ class CommandDispatcher:
|
|||||||
ed = editor.ExternalEditor(watch=True, parent=self._tabbed_browser)
|
ed = editor.ExternalEditor(watch=True, parent=self._tabbed_browser)
|
||||||
ed.file_updated.connect(functools.partial(
|
ed.file_updated.connect(functools.partial(
|
||||||
self.on_file_updated, elem))
|
self.on_file_updated, elem))
|
||||||
|
ed.editing_finished.connect(lambda: mainwindow.raise_window(
|
||||||
|
objreg.last_focused_window(), alert=False))
|
||||||
ed.edit(text, caret_position)
|
ed.edit(text, caret_position)
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', scope='window')
|
@cmdutils.register(instance='command-dispatcher', scope='window')
|
||||||
@ -1647,8 +1649,6 @@ class CommandDispatcher:
|
|||||||
except webelem.Error as e:
|
except webelem.Error as e:
|
||||||
raise cmdexc.CommandError(str(e))
|
raise cmdexc.CommandError(str(e))
|
||||||
|
|
||||||
mainwindow.raise_window(objreg.last_focused_window(), alert=False)
|
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', maxsplit=0,
|
@cmdutils.register(instance='command-dispatcher', maxsplit=0,
|
||||||
scope='window')
|
scope='window')
|
||||||
def insert_text(self, text):
|
def insert_text(self, text):
|
||||||
|
@ -42,9 +42,15 @@ class ExternalEditor(QObject):
|
|||||||
_proc: The GUIProcess of the editor.
|
_proc: The GUIProcess of the editor.
|
||||||
_watcher: A QFileSystemWatcher to watch the edited file for changes.
|
_watcher: A QFileSystemWatcher to watch the edited file for changes.
|
||||||
Only set if watch=True.
|
Only set if watch=True.
|
||||||
|
|
||||||
|
Signals:
|
||||||
|
file_updated: The text in the edited file was updated.
|
||||||
|
arg: The new text.
|
||||||
|
editing_finished: The editor process was closed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
file_updated = pyqtSignal(str)
|
file_updated = pyqtSignal(str)
|
||||||
|
editing_finished = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, parent=None, watch=False):
|
def __init__(self, parent=None, watch=False):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
@ -84,6 +90,7 @@ class ExternalEditor(QObject):
|
|||||||
return
|
return
|
||||||
# do a final read to make sure we don't miss the last signal
|
# do a final read to make sure we don't miss the last signal
|
||||||
self._on_file_changed(self._filename)
|
self._on_file_changed(self._filename)
|
||||||
|
self.editing_finished.emit()
|
||||||
self._cleanup()
|
self._cleanup()
|
||||||
|
|
||||||
@pyqtSlot(QProcess.ProcessError)
|
@pyqtSlot(QProcess.ProcessError)
|
||||||
|
Loading…
Reference in New Issue
Block a user