CodeView
CodeView copied to clipboard
Line numbers bug
Describe the bug When line numbers is tirned on:
- There is a blank line when swiping code to the right
- Numbers easily overlap code
To Reproduce To reproduce the behavior, try using line numeration I used CodeView 1.3.7 with programmatic declaration in AndroidView:
AndroidView(
factory = { ctx ->
com.amrdeveloper.codeview.CodeView(ctx).apply {
isFocusable = true
isEnabled = true
isClickable = true
isFocusableInTouchMode = true
maxWidth = context.resources.displayMetrics.widthPixels
setText(text, TextView.BufferType.EDITABLE)
setTextColor(android.graphics.Color.WHITE)
setTextSize(0, 64f)
setEnableLineNumber(true)
setLineNumberTextSize(64f)
setLineNumberTextColor(android.graphics.Color.WHITE)
dropDownHorizontalOffset = 0
setBackgroundColor(android.graphics.Color.BLACK)
layoutParams = LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
gravity = Gravity.START
addTextChangedListener(textWatcher)
}
},
)
Expected behavior I expected line numbers to either disappear completely or not disappear at all while swiping code to the right but it does neither (see attached video). Also, even 2-digit line number overlaps code if using same text size. device-2023-03-27-003432.webm
Smartphone (please complete the following information):
-
Device: emulated PIxel 6
-
OS: Android 13 (API 33)
-
Device: real Xiaomi Redmi 4 Pro
-
OS: Android 6 (API 23)
Additional context I would also like to know if it possible to let "actual" lines to go to next "visual" lines when getting out of view's bounds (something like line break). I have implemented it in Compose if that can help somehow Tried making my own highlighter with Compose but found no way to use AnnotatedString in editable text composables.