Skip to content

ADFA-3534: Fix flickering code when font size is small#1324

Merged
dara-abijo-adfa merged 6 commits into
stagefrom
ADFA-3534-flickering-code-text
May 22, 2026
Merged

ADFA-3534: Fix flickering code when font size is small#1324
dara-abijo-adfa merged 6 commits into
stagefrom
ADFA-3534-flickering-code-text

Conversation

@dara-abijo-adfa
Copy link
Copy Markdown
Contributor

  • Increased the minimum font size from 6sp to 8sp to avoid rendering issues
  • Save new font size set by zooming

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 49e5db9a-1c6a-4f77-b448-fa6421e49747

📥 Commits

Reviewing files that changed from the base of the PR and between 2dee111 and b0d283a.

📒 Files selected for processing (4)
  • app/src/main/java/com/itsaky/androidide/preferences/editorPrefExts.kt
  • app/src/main/java/com/itsaky/androidide/ui/CodeEditorView.kt
  • app/src/main/res/layout/layout_text_size_slider.xml
  • editor-treesitter/src/main/java/io/github/rosemoe/sora/editor/ts/LineSpansGenerator.kt

📝 Walkthrough

Release Notes

Features & Improvements

  • Pinch-to-zoom support: Added pinch gesture detection for dynamic font resizing in the code editor
  • Persistent zoom state: Font size changes made via pinch-to-zoom are now saved to editor preferences
  • Optimized font size updates: Editor now skips redundant font size updates when the computed size is unchanged

Bug Fixes

  • Fixed flickering code: Increased minimum font size from 6sp to 8sp to prevent rendering issues at small sizes
  • Enhanced rendering: Increased line span cache threshold from 60 to 100 entries to improve rendering performance

Technical Changes

  • Updated TextSize validation range to 8.0..32.0 (previously 6..32)
  • Updated layout slider minimum value from 6.0 to 8.0 to reflect new minimum font size

⚠️ Risks & Considerations

  • Breaking change for small fonts: Users who relied on 6sp font size will now have their preference bumped to 8sp minimum. This could impact accessibility for users with specific visual needs.
  • New gesture interaction: Pinch-to-zoom is a new gesture handler that could conflict with existing touch event handling or cause unexpected behavior on certain devices.
  • Cache memory impact: Increasing CACHE_THRESHOLD from 60 to 100 will increase memory usage when editing large files with many syntax-highlighted lines.
  • Persistence without explicit user action: Font size changes via pinch-to-zoom are automatically persisted, which may not be the expected behavior for all users (users might expect pinch gestures to be temporary/session-only).

Walkthrough

The PR enables pinch-to-zoom font resizing in the code editor by adding gesture detection, raising the minimum allowed font size from 6 to 8 across validation and UI components, improves changeFontSizeBy with early returns, and increases the editor cache threshold for performance.

Changes

Pinch Gesture Font Resizing

Layer / File(s) Summary
Gesture detection setup
app/src/main/java/com/itsaky/androidide/ui/CodeEditorView.kt
ScaleGestureDetector and SimpleOnScaleGestureListener are imported, a lateinit detector field is declared, and the detector is initialized with an onScale handler that maps pinch scale factors to changeFontSizeBy calls and routes touch events through the detector.
Minimum font size bounds
app/src/main/java/com/itsaky/androidide/ui/CodeEditorView.kt, app/src/main/java/com/itsaky/androidide/preferences/editorPrefExts.kt, app/src/main/res/layout/layout_text_size_slider.xml
The editor minimum font size constant is raised from 6f to 8f, changeFontSizeBy now early-returns when the computed size equals the current value and only then updates the editor text size and persists the preference, text size dialog validation changes from < 6 || > 32 to !in 8.0..32.0, and the slider UI minimum is updated from 6.0 to 8.0.

Editor Cache Optimization

Layer / File(s) Summary
Line span cache threshold
editor-treesitter/src/main/java/io/github/rosemoe/sora/editor/ts/LineSpansGenerator.kt
LineSpansGenerator.CACHE_THRESHOLD is increased from 60 to 100 to allow more cached line-span entries before eviction.

Possibly related PRs

  • appdevforall/CodeOnTheGo#1036: Both PRs modify font-size update logic in CodeEditorView.kt to support zooming via input gestures (pinch vs. Ctrl+mouse wheel).

Suggested reviewers

  • itsaky-adfa
  • jatezzz
  • Daniel-ADFA

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A pinch of magic, a gesture so keen,
Now fonts dance between bounds quite clean,
Eight to thirty-two, the editor's sweet song,
With cache set fuller, performance stays strong!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses the main objective: fixing flickering code when font size is small by increasing the minimum font size from 6sp to 8sp.
Description check ✅ Passed The description accurately summarizes the two key changes: increasing minimum font size to 8sp and persisting font size changes from zooming.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ADFA-3534-flickering-code-text

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dara-abijo-adfa dara-abijo-adfa merged commit a479086 into stage May 22, 2026
2 checks passed
@dara-abijo-adfa dara-abijo-adfa deleted the ADFA-3534-flickering-code-text branch May 22, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants