Skip to content

Commit

Permalink
Don't animate edited line
Browse files Browse the repository at this point in the history
  • Loading branch information
mhoran committed Dec 7, 2024
1 parent 963f7a4 commit 0815d47
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class ChatLinesAdapter @MainThread constructor(
private var style = 0

@AnyThread @Synchronized private fun onLinesChanged(
animation: Animation = Animation.Default,
animation: Animation? = Animation.Default,
diffLineContents: Boolean = false
) = ulet(buffer) { buffer ->
val thisUpdateStep = synchronized (updateLock) { ++updateStep }
Expand All @@ -238,7 +238,7 @@ class ChatLinesAdapter @MainThread constructor(

diffResult.dispatchUpdatesTo(this@ChatLinesAdapter)

uiLines.setAnimation(animation)
if (animation != null) uiLines.setAnimation(animation)

if (uiLines.onBottom) {
uiLines.scrollToPosition(itemCount - 1)
Expand Down Expand Up @@ -267,6 +267,10 @@ class ChatLinesAdapter @MainThread constructor(
onLinesChanged(Animation.LastLineAdded)
}

@WorkerThread override fun onLineReplaced() {
onLinesChanged(null, diffLineContents = true)
}

@WorkerThread override fun onTitleChanged() {
onLinesChanged()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,10 @@ class BufferFragment : Fragment(), BufferEye {
linesAdapter?.onLineAdded()
}

@WorkerThread override fun onLineReplaced() {
linesAdapter?.onLineReplaced()
}

@MainThread override fun onGlobalPreferencesChanged(numberChanged: Boolean) {
linesAdapter?.onGlobalPreferencesChanged(numberChanged)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ class Buffer @WorkerThread constructor(
bufferEyes.forEach { it.onLineAdded() }
}

@WorkerThread fun onLineReplaced() {
bufferEyes.forEach { it.onLineReplaced() }
}

var style = 0

@MainThread fun onGlobalPreferencesChanged(numberChanged: Boolean) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ interface BufferEye {
// 1 line added on bottom
@WorkerThread fun onLineAdded()

// line was replaced via _buffer_line_data_changed
@WorkerThread fun onLineReplaced()

// indicates changed title
@WorkerThread fun onTitleChanged()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ object BufferList {
val spec = LineSpec(entry)
findByPointer(spec.bufferPointer)?.let { buffer ->
buffer.replaceLine(spec.toLine())
buffer.onLinesListed()
buffer.onLineReplaced()
}
}
}
Expand Down

0 comments on commit 0815d47

Please sign in to comment.