Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Fix for inconsistent EvaluationCell behavior on Linux and Mac #518

Merged
merged 4 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion FrontEnd/StyleSheets/Chatbook.nb
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ Notebook[
],
Cell[
StyleData["ChatStyleSheetInformation"],
TaggingRules -> <|"StyleSheetVersion" -> "1.3.7.3913365950"|>
TaggingRules -> <|"StyleSheetVersion" -> "1.3.8.3913394031"|>
],
Cell[
StyleData["Text"],
Expand Down
2 changes: 1 addition & 1 deletion PacletInfo.wl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PacletObject[ <|
"Name" -> "Wolfram/Chatbook",
"PublisherID" -> "Wolfram",
"Version" -> "1.3.7",
"Version" -> "1.3.8",
"WolframVersion" -> "13.3+",
"Description" -> "Wolfram Notebooks + LLMs",
"License" -> "MIT",
Expand Down
8 changes: 6 additions & 2 deletions Source/Chatbook/Actions.wl
Original file line number Diff line number Diff line change
Expand Up @@ -921,10 +921,14 @@ AttachCodeButtons[ attached_, cell_CellObject, string_, lang_ ] := Enclose[
If[ chatCodeBlockQ @ parent, Throw @ AttachCodeButtons[ attached, parent, string, lang ] ];

(* Otherwise, we have an EvaluationCell[] failure, so try to recover by retrying EvaluationCell[] *)
evalCell = ConfirmMatch[ (FinishDynamic[ ]; EvaluationCell[ ]), _CellObject, "EvaluationCell" ];
evalCell = ConfirmMatch[ (FinishDynamic[ ]; EvaluationCell[ ]), _CellObject, "EvaluationCell" ];

(* The chat code block should be the parent of the current evaluation cell *)
newParent = ConfirmBy[ parentCell @ evalCell, chatCodeBlockQ, "ParentCell" ];
newParent = ConfirmBy[
If[ chatCodeBlockQ @ evalCell, evalCell, parentCell @ evalCell ],
chatCodeBlockQ,
"ParentCell"
];

(* Finish attaching now that we have the correct cell *)
AttachCodeButtons[ attached, newParent, string, lang ]
Expand Down
2 changes: 1 addition & 1 deletion Source/Chatbook/SendChat.wl
Original file line number Diff line number Diff line change
Expand Up @@ -2301,7 +2301,7 @@ attachChatOutputMenu[ cell_CellObject ] /; $cloudNotebooks := Null;

attachChatOutputMenu[ cell_CellObject ] := (
$lastChatOutput = cell;
Block[ { EvaluationCell = cell & }, CurrentValue[ cell, Initialization ] ]
Lookup[ Options[ cell, Initialization ] /. HoldPattern @ EvaluationCell[ ] -> cell, Initialization ]
);

attachChatOutputMenu // endDefinition;
Expand Down