Skip to content

Commit

Permalink
Merge pull request #518 from WolframResearch/bugfix/different-evaluat…
Browse files Browse the repository at this point in the history
…ion-cell-on-linux-and-mac

Bugfix: Fix for inconsistent EvaluationCell behavior on Linux and Mac
  • Loading branch information
rhennigan authored Jan 5, 2024
2 parents dd0fefc + 1ae3559 commit 21369a0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
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

0 comments on commit 21369a0

Please sign in to comment.