Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): preserve syntax and navigation in large diffs #24276

Mergedjuliusmarmingemerged 2 commits intomain fromrefs/pull/24276/headmerged by juliusmarminge View on GitHub

Showing 57 changed files with 118 additions and 23 deletions (loading 54).

x
0 of 57 viewed, 57 left
77 additions and 9 deletionsapps/mobile/modules/t3-review-diff/android/src/main/java/expo/modules/t3reviewdiff/ReviewDiffCanvasDrawing.ktModified
View file
@@ -185,7 +185,8 @@
fun prepareRows(
tokens: Map<String, List<DiffToken>>,
style: DiffStyle,
- width: Int
+ width: Int,
+ isCancelled: () -> Boolean = { false }
): (List<DiffRow>) -> CodeLayoutCache {
configureCodePaint(theme.text, 0, style)
val paint = TextPaint(textPaint)
@@ -196,7 +197,7 @@
style.codePaddingPx * 2f
).toInt()
return { rows ->
- cache.apply { layout(rows, tokens, paint, style, colors, availableWidth) }
+ cache.apply { layout(rows, tokens, paint, style, colors, availableWidth, isCancelled) }
​
@@ -218,6 +219,39 @@
private var widthTokens: Map<String, List<DiffToken>>? = null
private var widthStyle: DiffStyle? = null
private var measuredContentWidth = 0
+ private var asciiCharacterWidth = 0f
+ private var asciiFixedPitch = false
+​
+ fun tokensChangeWidth(
+ previous: Map<String, List<DiffToken>>,