Skip to content

Commit

Permalink
sniffen fix blog post
Browse files Browse the repository at this point in the history
  • Loading branch information
markersniffen committed May 25, 2024
1 parent 7b07bfe commit 9b7b212
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions content/news/2024-06.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ The problem with this approach is that if you have a large text file, there are

<video class="ratio ratio-16x9 mb-1 rounded" controls src="images/news/2024-06-codin_too-many-boxes.mp4"></video>

My solution to this problem was to only create boxes for visible lines of text. However, I needed to create a spacer box before the visible boxes to account for the offscreen boxes that are no longer created:
My solution to this problem was to only create boxes for visible lines of text. However, this breaks the scrollbox - the scrollbox needs a full set of children to determine the proper height for it's own box. What I needed to do was create a spacer box before the visible boxes to account for the offscreen boxes that are no longer created, and *also* manually calculate the height of the scrollbox, since we don't have the children boxes that appear *after* the last visible line:
- First calculate the number of visible rows
- Then calculate what the height of the scrollbox would be if I created boxes for all the rows
- Then create the scrollbox widget, telling it exactly how tall to be in pixels
Expand Down Expand Up @@ -186,7 +186,7 @@ edit_multiline :: proc(..., cursor:^Txt_Pt, ...)

<video class="ratio ratio-16x9 mb-1 rounded" controls src="images/news/2024-06-codin_auto-scroll.mp4"></video>

One thing I realized was that we don't always want to auto scroll...often I scroll around a file and the cursor goes off screen. So I added a `scroll_trigger:^bool` as an input to let us specific triggers to auto scroll:
One thing I realized was that we don't always want to auto scroll...often I manually scroll around a file and let the cursor go off screen. So I added a `scroll_trigger:^bool` as an input to give us a way to limit the auto scroll:

```
edit_multiline :: proc(..., cursor:^Txt_Pt, auto_scroll:^bool ...)
Expand Down

0 comments on commit 9b7b212

Please sign in to comment.