patch dev fix

This commit is contained in:
Henrik Lemke committed 2026-09-21 15:49:33 +02:00
1 parent 630b6dc7d9
commit 2a5ef0ec63
2 files changed
+18 -36

No files matched your search

+1 -29
View File
@@ -7,33 +7,5 @@
},
"python.formatting.provider": "none",
"python-envs.defaultEnvManager": "ms-python.python:system",
"peacock.remoteColor": "#009900",
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#00cc00",
"activityBar.activeBorder": "#e7e7e7",
"activityBar.background": "#00cc00",
"activityBar.foreground": "#e7e7e7",
"activityBar.inactiveForeground": "#e7e7e799",
"activityBarBadge.background": "#6060ff",
"activityBarBadge.foreground": "#e7e7e7",
"activityBarTop.activeBackground": "#00cc00",
"activityBarTop.activeBorder": "#e7e7e7",
"activityBarTop.background": "#00cc00",
"activityBarTop.foreground": "#e7e7e7",
"activityBarTop.inactiveForeground": "#e7e7e799",
"commandCenter.border": "#e7e7e799",
"commandCenter.foreground": "#e7e7e7",
"sash.hoverBorder": "#00cc00",
"statusBar.background": "#009900",
"statusBar.debuggingBackground": "#009900",
"statusBar.debuggingForeground": "#e7e7e7",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#00cc00",
"statusBarItem.remoteBackground": "#2020ff",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#009900",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#00990099",
"titleBar.inactiveForeground": "#e7e7e799"
}
"peacock.remoteColor": "#009900"
}
+17 -7
View File
@@ -104,13 +104,23 @@ def _capture_current_input():
ip = get_ipython()
if ip is None:
return None
parent = ip.get_parent() or {}
code = parent.get("content", {}).get("code")
if code:
return code
hist = list(ip.history_manager.get_range(raw=True))
if hist:
return hist[-1][2]
# `get_parent` only exists on ipykernel's shell; the terminal shell
# has no such method, and letting that AttributeError escape used to
# skip the history fallback below -- i.e. capture never worked in a
# terminal session.
get_parent = getattr(ip, "get_parent", None)
if get_parent is not None:
try:
code = (get_parent() or {}).get("content", {}).get("code")
except Exception:
code = None
if code:
return code
# The cell being executed is already stored in the raw input history
# (store_inputs runs before execution), so the last entry is it.
hist = ip.history_manager.input_hist_raw
if len(hist) > 1 and hist[-1]:
return hist[-1]
except Exception:
pass
return None