File tree Expand file tree Collapse file tree
app/src/main/java/com/ubergeek42/WeechatAndroid/relay Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -209,13 +209,9 @@ class Buffer @WorkerThread constructor(
209209 // ///////////////////////////////////////////////////////////// stuff called by message handlers
210210 // //////////////////////////////////////////////////////////////////////////////////////////////
211211
212- @WorkerThread @Synchronized fun replaceLines (newLines : Collection <Line >) {
213- if (isOpen) {
214- newLines.forEach { it.ensureSpannable() }
215- }
216-
212+ @WorkerThread @Synchronized fun clearLines () {
217213 synchronized(this ) {
218- lines.replaceLines(newLines )
214+ lines.clearLines( )
219215 }
220216 }
221217
Original file line number Diff line number Diff line change @@ -385,13 +385,12 @@ object BufferList {
385385 private class LineListingHandler (private val bufferPointer : Long ) : HdataHandler {
386386 override fun handleMessage (obj : Hdata , id : String ) {
387387 findByPointer(bufferPointer)?.let { buffer ->
388- val newLines = ArrayList <Line >(obj.count)
389388
389+ buffer.clearLines()
390390 obj.forEachReversed { entry ->
391- newLines.add (LineSpec (entry).toLine())
391+ buffer.addLineBottom (LineSpec (entry).toLine())
392392 }
393393
394- buffer.replaceLines(newLines)
395394 buffer.onLinesListed()
396395 }
397396 }
Original file line number Diff line number Diff line change @@ -87,14 +87,10 @@ class Lines {
8787 // in very rare cases status might not be FETCHING here, particularly when closing buffers
8888 // while the app is connecting and has already requested lines
8989
90- fun replaceLines ( lines : Collection < Line > ) {
90+ fun clearLines ( ) {
9191 if (status != Status .Fetching ) return
9292 unfiltered.clear()
9393 filtered.clear()
94- unfiltered.addAll(lines)
95- for (line in lines) {
96- if (line.isVisible) filtered.add(line)
97- }
9894 }
9995
10096 fun addLast (line : Line ) {
You can’t perform that action at this time.
0 commit comments