Skip to content

Commit 9f29073

Browse files
committed
2 parents f9be169 + c39a9ab commit 9f29073

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,18 @@ def find_distributions(self, context):
287287

288288
return None
289289

290+
def find_spec(self, fullname, path, target=None):
291+
for finder in self.old_meta_path:
292+
# Consider the finder only if it implements find_spec
293+
if not getattr(finder, "find_spec", None):
294+
continue
295+
# Attempt to find the spec
296+
spec = finder.find_spec(fullname, path, target)
297+
if spec is not None:
298+
# Patch the loader to enable reloading
299+
spec.__loader__ = ImportLoader(self.watcher, spec.__loader__)
300+
return spec
301+
290302
def find_module(self, fullname, path=None):
291303
for finder in self.old_meta_path:
292304
loader = finder.find_module(fullname, path)
@@ -1026,7 +1038,7 @@ def send_session_to_external_editor(self, filename=None):
10261038
current_line = lines[-1][4:]
10271039
else:
10281040
current_line = ""
1029-
from_editor = [line for line in lines if line[:6] != "# OUT:"]
1041+
from_editor = [line for line in lines if line[:6] != "# OUT:" and line[:3] != "###"]
10301042
if all(not line.strip() for line in from_editor):
10311043
self.status_bar.message(
10321044
_("Session not reevaluated because saved file was blank")

bpython/repl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ def process():
835835
yield line
836836
elif line.rstrip():
837837
yield "# OUT: %s" % line
838-
yield "###: %s" % self.current_line
838+
yield "### %s" % self.current_line
839839

840840
return "\n".join(process())
841841

bpython/sample-config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
# color_scheme = default
3737

3838
# External editor to use for editing the current line, block, or full history
39+
# Examples: vi (vim)
40+
# code --wait (VS Code) - in VS Code use the command pallete to:
41+
# Shell Command: Install 'code' command in PATH
42+
# atom -nw (Atom)
3943
# Default is to try $EDITOR and $VISUAL, then vi - but if you uncomment
4044
# the line below that will take precedence
4145
# editor = vi

0 commit comments

Comments
 (0)