@@ -78,15 +78,15 @@ class T3ReviewDiffView(context: Context, appContext: AppContext) : ExpoView(cont
7878 if (tokensResetKey == value) return
7979 tokensResetKey = value
8080 canvasView.tokensByRowId = emptyMap()
81- canvasView.clearWordDiffRanges()
81+ canvasView.drawing. clearWordDiffRanges()
8282 }
8383
8484 fun setContentResetKey (value : String ) {
8585 if (contentResetKey == value) return
8686 contentResetKey = value
8787 tokensDecodeGeneration + = 1
8888 canvasView.tokensByRowId = emptyMap()
89- canvasView.clearWordDiffRanges()
89+ canvasView.drawing. clearWordDiffRanges()
9090 lastVisibleFileId = null
9191 pendingInitialScroll = true
9292 canvasView.setVerticalOffset(0 )
@@ -187,7 +187,8 @@ class T3ReviewDiffView(context: Context, appContext: AppContext) : ExpoView(cont
187187 canvasView.tokensByRowId = canvasView.tokensByRowId + decodedTokens
188188 }
189189 if (decodedWordDiffRanges.isNotEmpty()) {
190- canvasView.mergeWordDiffRangesByRowId(decodedWordDiffRanges)
190+ canvasView.drawing.mergeWordDiffRangesByRowId(decodedWordDiffRanges)
191+ canvasView.invalidate()
191192 }
192193 }
193194 } catch (_: Exception ) {
@@ -658,7 +659,7 @@ internal data class DiffStyle(
658659
659660private class DiffCanvasView (context : Context ) : View(context) {
660661 private val density = resources.displayMetrics.density
661- private val drawing = ReviewDiffCanvasDrawing (context)
662+ val drawing = ReviewDiffCanvasDrawing (context)
662663 private val backgroundPaint = drawing.backgroundPaint
663664 private val borderPaint = drawing.borderPaint
664665 private val textPaint = drawing.textPaint
@@ -713,18 +714,6 @@ private class DiffCanvasView(context: Context) : View(context) {
713714 field = value
714715 invalidate()
715716 }
716- private val wordDiffRangesByRowId = mutableMapOf<String , List <DiffWordDiffRange >>()
717-
718- fun mergeWordDiffRangesByRowId (patch : Map <String , List <DiffWordDiffRange >>) {
719- wordDiffRangesByRowId.putAll(patch)
720- invalidate()
721- }
722-
723- fun clearWordDiffRanges () {
724- wordDiffRangesByRowId.clear()
725- invalidate()
726- }
727-
728717 var viewedFileIds: Set <String > = emptySet()
729718 set(value) {
730719 field = value
@@ -1218,14 +1207,7 @@ private class DiffCanvasView(context: Context) : View(context) {
12181207 val tokens = tokensByRowId[row.id]
12191208 drawScrollableCode(canvas, top, bottom) { codeX ->
12201209 drawing.configureCodePaint(theme.text, 0 , style)
1221- drawing.drawWordDiffRanges(
1222- canvas,
1223- row,
1224- codeX,
1225- top,
1226- bottom,
1227- wordDiffRangesByRowId[row.id] ? : row.wordDiffRanges,
1228- )
1210+ drawing.drawWordDiffRanges(canvas, row, codeX, top, bottom)
12291211 if (tokens.isNullOrEmpty()) {
12301212 canvas.drawText(row.content, codeX, centeredBaseline(top, bottom, textPaint), textPaint)
12311213 } else {
0 commit comments