Skip to content

Commit 52be978

Browse files
authored
Merge pull request #1363 from WolframResearch/bugfix/Sidebar6
Bugfix/sidebar6
2 parents eaacb38 + bbc1eef commit 52be978

File tree

4 files changed

+30
-13
lines changed

4 files changed

+30
-13
lines changed
1.44 KB
Loading

Source/Chatbook/Actions.wl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ regenerateAssistantMessage[ chatOutput_CellObject, True(*sidebarCellQ_*) ] := En
118118

119119
With[ { sbc = sidebarCell, cic = chatInputCell }, (* "Set" is HoldFirst so we must inject values *)
120120
FrontEndExecute[ {
121-
FrontEnd`SelectionMove[ chatOutput, Before, Cell ],
122-
FrontEnd`FrontEndToken[ nbo, "DeletePrevious" ], (* remove the newline character before the sub-cell *)
121+
FrontEnd`SetOptions[ chatOutput, Deletable -> True ],
123122
FrontEnd`NotebookDelete @ chatOutput,
124123
FrontEnd`SetValue @ FEPrivate`Set[ FrontEnd`CurrentValue[ sbc, { TaggingRules, "ChatEvaluationCell" } ], cic ], (* use TaggingRules to pass CellObject around *)
125124
FrontEnd`SetOptions[ chatInputFieldCell, CellTags -> { "SidebarChatInputCell", "RegenerateChatOutput" } ] (* backdoor to re-evaluation in side bar *)

Source/Chatbook/ChatModes/UI.wl

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,12 @@ removeSidebarChatSubDockedCell // beginDefinition;
152152

153153
removeSidebarChatSubDockedCell[ nbo_NotebookObject, sidebarCell_CellObject ] := Module[ { subDockedCell },
154154
subDockedCell = First[ Cells[ sidebarCell, CellTags -> "SidebarSubDockedCell" ], Missing @ "NoSidebarSubDockedCell" ];
155-
If[ ! MissingQ @ subDockedCell, NotebookDelete @ subDockedCell ]
155+
If[ ! MissingQ @ subDockedCell,
156+
FrontEndExecute[ {
157+
FrontEnd`SetOptions[ subDockedCell, Deletable -> True ],
158+
FrontEnd`NotebookDelete @ subDockedCell
159+
} ]
160+
]
156161
];
157162

158163
removeSidebarChatSubDockedCell // endDefinition;
@@ -162,7 +167,11 @@ removeSidebarChatSubDockedCell // endDefinition;
162167
(*removeSidebarTopCell*)
163168
removeSidebarTopCell // beginDefinition;
164169

165-
removeSidebarTopCell[ nbo_NotebookObject, sidebarTopCell_CellObject ] := NotebookDelete @ sidebarTopCell;
170+
removeSidebarTopCell[ nbo_NotebookObject, sidebarTopCell_CellObject ] :=
171+
FrontEndExecute[ {
172+
FrontEnd`SetOptions[ sidebarTopCell, Deletable -> True ],
173+
FrontEnd`NotebookDelete @ sidebarTopCell
174+
} ];
166175

167176
removeSidebarTopCell // endDefinition;
168177

@@ -173,7 +182,12 @@ removeSidebarScrollingContentCell // beginDefinition;
173182

174183
removeSidebarScrollingContentCell[ nbo_NotebookObject, sidebarCell_CellObject ] := Module[ { scrollablePaneCell },
175184
scrollablePaneCell = First[ Cells[ sidebarCell, CellTags -> "SidebarScrollingContentCell" ], Missing @ "NoScrollingSidebarCell" ];
176-
If[ ! MissingQ @ scrollablePaneCell, NotebookDelete @ scrollablePaneCell ]
185+
If[ ! MissingQ @ scrollablePaneCell,
186+
FrontEndExecute[ {
187+
FrontEnd`SetOptions[ scrollablePaneCell, Deletable -> True ],
188+
FrontEnd`NotebookDelete @ scrollablePaneCell
189+
} ]
190+
]
177191
];
178192

179193
removeSidebarScrollingContentCell // endDefinition;
@@ -536,9 +550,10 @@ toolbarButtonLabel0[ iconName_String, None, color_, {styleOpts___}, {gridOpts___
536550
Grid[
537551
{ { chatbookIcon[ "WorkspaceToolbarIcon"<>iconName, False, color ] } },
538552
gridOpts,
539-
Spacings -> 0.25,
540-
Alignment -> { {Left, Right}, Baseline },
541-
BaselinePosition -> { 1, 1 }
553+
Alignment -> { {Left, Right}, Baseline },
554+
BaseStyle -> { LineBreakWithin -> False },
555+
BaselinePosition -> { 1, 1 },
556+
Spacings -> 0.25
542557
];
543558

544559
toolbarButtonLabel0[ iconName_String, label_, color_, {styleOpts___}, {gridOpts___}] :=
@@ -548,9 +563,10 @@ toolbarButtonLabel0[ iconName_String, label_, color_, {styleOpts___}, {gridOpts_
548563
Style[ label, If[ $AppType === "SidebarChat", "NotebookAssistant`Sidebar`ToolbarButtonLabel", "WorkspaceChatToolbarButtonLabel" ], styleOpts ]
549564
} },
550565
gridOpts,
551-
Spacings -> 0.25,
552-
Alignment -> { {Left, Right}, Baseline },
553-
BaselinePosition -> { 1, 2 }
566+
Alignment -> { {Left, Right}, Baseline },
567+
BaseStyle -> { LineBreakWithin -> False },
568+
BaselinePosition -> { 1, 2 },
569+
Spacings -> 0.25
554570
];
555571

556572
toolbarButtonLabel0 // endDefinition;
@@ -1614,7 +1630,7 @@ DynamicModule[ { Typeset`menuActiveQ = False },
16141630
CellTags -> "CustomActionMenu",
16151631
Magnification -> AbsoluteCurrentValue[ EvaluationNotebook[ ], Magnification ]*If[ cellTaggedQ[ topParentCell @ EvaluationCell[ ], "SidebarTopCell" ], 0.85, 1. ]
16161632
],
1617-
{ Left, Bottom }, 0, { Left, Top },
1633+
Sequence @@ If[ Last[ MousePosition[ "ViewScaled" ], 0 ] > 0.78, { { Left, Top }, 0, { Left, Bottom } }, { { Left, Bottom }, 0, { Left, Top } } ],
16181634
RemovalConditions -> "MouseExit" ]) },
16191635
PassEventsDown -> True,
16201636
Method -> "Preemptive",

Source/Chatbook/SendChat.wl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,7 @@ splitDynamicContent[ container_, { static__String, dynamic_String }, cell_CellOb
14361436
None,
14371437
AutoScroll -> False
14381438
]
1439-
]
1439+
];
14401440

14411441
$dynamicTrigger++;
14421442
$lastDynamicUpdate = AbsoluteTime[ ];
@@ -3178,6 +3178,8 @@ restoreLastPage // endDefinition;
31783178
(*attachChatOutputMenu*)
31793179
attachChatOutputMenu // beginDefinition;
31803180

3181+
attachChatOutputMenu[ None ] := Null;
3182+
31813183
attachChatOutputMenu[ cell_CellObject ] /; $cloudNotebooks || $WorkspaceChat || $InlineChat || $SidebarChat := Null;
31823184

31833185
attachChatOutputMenu[ cell_CellObject ] := (

0 commit comments

Comments
 (0)