File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -203,6 +203,11 @@ class ChunkSplitter:
203203 """
204204
205205 def __init__ (self , chunk : Chunk ) -> None :
206+ self .reinit (chunk )
207+
208+ def reinit (self , chunk : Chunk ) -> None :
209+ """Reuse an existing Splitter instance for speed."""
210+ # TODO benchmark to prove this is worthwhile
206211 self .chunk = chunk
207212 self .internal_offset = 0 # index into chunk.s
208213 self .internal_width = 0 # width of chunks.s[:self.internal_offset]
@@ -211,11 +216,6 @@ def __init__(self, chunk: Chunk) -> None:
211216 divides .append (divides [- 1 ] + wcwidth (c ))
212217 self .divides = divides
213218
214- def reinit (self , chunk : Chunk ) -> None :
215- """Reuse an existing Splitter instance for speed."""
216- # TODO benchmark to prove this is worthwhile
217- self .__init__ (chunk ) # type: ignore
218-
219219 def request (self , max_width : int ) -> Optional [Tuple [int , Chunk ]]:
220220 """Requests a sub-chunk of max_width or shorter. Returns None if no chunks left."""
221221 if max_width < 1 :
You can’t perform that action at this time.
0 commit comments