Skip to content

Commit d49dc33

Browse files
committed
One link transaction for calculating the sidebar scrolling cell height
1 parent 65aa2db commit d49dc33

File tree

1 file changed

+26
-10
lines changed
  • Source/Chatbook/ChatModes

1 file changed

+26
-10
lines changed

Source/Chatbook/ChatModes/UI.wl

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,19 @@ makeSidebarChatScrollingCell[ ] := With[ { nbo = EvaluationNotebook[ ] },
193193
{
194194
Scaled[ 1. ],
195195
Round[
196-
(AbsoluteCurrentValue[ "ViewSize" ][[2]]
197-
- 4 (* the top bar that better separates the sidebar from the default toolbar *)
198-
- If[ # === None, 0, AbsoluteCurrentValue[ #, { CellSize, 2 } ] ]&[ PreviousCell[ CellTags -> "SidebarSubDockedCell" ] ]
199-
- AbsoluteCurrentValue[ PreviousCell[ CellTags -> "SidebarDockedCell" ], { CellSize, 2 } ]
200-
- AbsoluteCurrentValue[ NextCell[ CellTags -> "SidebarChatInputCell" ], { CellSize, 2 } ])/(0.85*AbsoluteCurrentValue[ nbo, Magnification ])
196+
(#[[1]][[2]]
197+
- 7 (* the top bar that better separates the sidebar from the default toolbar *)
198+
- If[ NumericQ @ #[[2]], #[[2]], 0 ]
199+
- If[ NumericQ @ #[[3]], #[[3]], 0 ]
200+
- If[ NumericQ @ #[[4]], #[[4]], 0 ]
201+
)/(0.85*AbsoluteCurrentValue[ nbo, Magnification ])
202+
]&[
203+
FrontEndExecute[ {
204+
FrontEnd`Value @ FrontEnd`AbsoluteCurrentValue[ "ViewSize" ],
205+
FrontEnd`Value @ FrontEnd`AbsoluteCurrentValue[ FrontEnd`PreviousCell[ CellTags -> "SidebarSubDockedCell" ], { CellSize, 2 } ],
206+
FrontEnd`Value @ FrontEnd`AbsoluteCurrentValue[ FrontEnd`PreviousCell[ CellTags -> "SidebarDockedCell" ], { CellSize, 2 } ],
207+
FrontEnd`Value @ FrontEnd`AbsoluteCurrentValue[ FrontEnd`NextCell[ CellTags -> "SidebarChatInputCell" ], { CellSize, 2 } ]
208+
} ]
201209
] } ],
202210
Scrollbars -> { False, False }
203211
],
@@ -222,11 +230,19 @@ Module[ { dockedCellObj, chatInputCellObj },
222230
{
223231
Scaled[ 1. ],
224232
Round[
225-
(AbsoluteCurrentValue[ "ViewSize" ][[2]]
226-
- 4 (* the top bar that better separates the sidebar from the default toolbar *)
227-
- If[ # === None, 0, AbsoluteCurrentValue[ #, { CellSize, 2 } ] ]&[ PreviousCell[ CellTags -> "SidebarSubDockedCell" ] ]
228-
- AbsoluteCurrentValue[ dc, { CellSize, 2 } ]
229-
- AbsoluteCurrentValue[ cc, { CellSize, 2 } ])/(0.85*AbsoluteCurrentValue[ nbo, Magnification ])
233+
(#[[1]][[2]]
234+
- 7 (* the top bar that better separates the sidebar from the default toolbar *)
235+
- If[ NumericQ @ #[[2]], #[[2]], 0 ]
236+
- If[ NumericQ @ #[[3]], #[[3]], 0 ]
237+
- If[ NumericQ @ #[[4]], #[[4]], 0 ]
238+
)/(0.85*AbsoluteCurrentValue[ nbo, Magnification ])
239+
]&[
240+
FrontEndExecute[ {
241+
FrontEnd`Value @ FrontEnd`AbsoluteCurrentValue[ "ViewSize" ],
242+
FrontEnd`Value @ FrontEnd`AbsoluteCurrentValue[ FrontEnd`PreviousCell[ CellTags -> "SidebarSubDockedCell" ], { CellSize, 2 } ],
243+
FrontEnd`Value @ FrontEnd`AbsoluteCurrentValue[ dc, { CellSize, 2 } ],
244+
FrontEnd`Value @ FrontEnd`AbsoluteCurrentValue[ cc, { CellSize, 2 } ]
245+
} ]
230246
] } ],
231247
Scrollbars -> { False, Automatic }
232248
],

0 commit comments

Comments
 (0)