Skip to content

Commit 9c77e64

Browse files
committed
words
1 parent a75ef63 commit 9c77e64

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/blog/posts/release1.0.0.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Some characters such as those in Asian languages and many emoji are double the w
6565

6666
Textual's way of handling this is inherited from [Rich](https://github.com/Textualize/rich).
6767
Anything you print in Rich, first generates a list of [Segments](https://github.com/Textualize/rich/blob/master/rich/segment.py) which consist of a string and associated style.
68-
These Segments are only converted into text with [ansi escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) at the very end of the process.
68+
These Segments are converted into text with [ansi escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) at the very end of the process.
6969

7070

7171
The compositor takes lists of segments generated by widgets and further processes them, by dividing and combining, to produce the final output.
@@ -157,7 +157,7 @@ Widgets may contain other widgets which are clipped to their *parent's* boundari
157157

158158
Not to mention there can be multiple "screens" of widgets stacked on top of each other, with a modal fade effect applied to lower screens.
159159

160-
The compositor can do partial updates.
160+
The compositor can also do partial updates.
161161
In other words, if you click a button and it changes color, the compositor can update just the region occupied by the button.
162162

163163
The compositor does all of this fast enough to enable smooth scrolling, even with a metric tonne of widgets on screen.
@@ -190,7 +190,7 @@ Consider the following arrangement of widgets:
190190
--8<-- "docs/blog/images/compositor/spatial-map.excalidraw.svg"
191191
</div>
192192

193-
Here we have 8 widgets, where only around 4 will be visible at any given time, depending on the position of the scrollbar.
193+
Here we have 8 widgets, where only 3 or 4 will be visible at any given time, depending on the position of the scrollbar.
194194
We want to avoid doing work on widgets which will not be seen in the next frame.
195195

196196
A naive solution to this would be to check each widget's [Region][textual.geometry.Region] to see if it overlaps with the visible area.
@@ -199,7 +199,7 @@ If we get in to the 1000s of widgets territory, it may become significant &mdash
199199

200200
### The Grid
201201

202-
The first step in the spatial map is associate every widget with a tile in a regular grid[^2].
202+
The first step in the spatial map is to associate every widget with a tile in a regular grid[^2].
203203

204204
<div class="excalidraw">
205205
--8<-- "docs/blog/images/compositor/spatial-map-grid.excalidraw.svg"
@@ -222,8 +222,8 @@ At the end of that process we have a dict that maps every grid coordinate on to
222222
}
223223
```
224224

225-
This data is cacheable.
226-
If the widgets don't change their position or size such as when user is *scrolling*, then we can reuse the information.
225+
If the widgets don't change their position or size (such as when user is *scrolling*) then we can re-use this data.
226+
The up-front cost of [calculating](https://github.com/Textualize/textual/blob/main/src/textual/_spatial_map.py) this data is fairly low.
227227

228228
### Search the grid
229229

@@ -236,7 +236,7 @@ In the following illustration we have scrolled the screen up[^3] a little so tha
236236
--8<-- "docs/blog/images/compositor/spatial-map-view1.excalidraw.svg"
237237
</div>
238238

239-
We then determine which grid tiles overlap by the viewable area.
239+
We then determine which grid tiles overlap the viewable area.
240240
In the above examples that would be the tiles with coordinates `(0,0)`, `(1,0)`, `(0,1)`, and `(1,1)`.
241241
Once we have that information, we can then then look up those coordinates in the spatial map data structure, which would retrieve 4 lists:
242242

0 commit comments

Comments
 (0)