Skip to content

ADFA-4715: Word wrap switch in logs#1562

Open
dara-abijo-adfa wants to merge 7 commits into
stagefrom
ADFA-4715-word-wrap-switch
Open

ADFA-4715: Word wrap switch in logs#1562
dara-abijo-adfa wants to merge 7 commits into
stagefrom
ADFA-4715-word-wrap-switch

Conversation

@dara-abijo-adfa

Copy link
Copy Markdown
Contributor

Allow users turn word wrapping on/off in logs

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

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: f19dff6c-345e-49a3-987c-d8dae7070bed

📥 Commits

Reviewing files that changed from the base of the PR and between cfa468e and 38db8c3.

📒 Files selected for processing (2)
  • app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt
  • app/src/main/res/layout/layout_editor_bottom_sheet.xml
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/src/main/res/layout/layout_editor_bottom_sheet.xml
  • app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt

📝 Walkthrough
  • Added a persisted output/log editor “Word Wrap” preference (EditorPreferences.OUTPUT_WORD_WRAP), defaulting to enabled.
  • Added a Word Wrap toggle action to the editor output action bar (and bottom sheet), shown for output fragments that implement word-wrapping support.
  • Introduced WrappableOutputFragment to standardize the word-wrap contract (enable/disable + preference key).
  • Updated LogViewFragment and NonEditableEditorFragment to:
    • implement WrappableOutputFragment,
    • initialize editor wrapping from the persisted preference,
    • listen for preference updates via EventBus (PreferenceChangeEvent) and update wrapping live,
    • unregister/release resources on view teardown.
  • Updated the editor bottom sheet layout to use ConstraintLayout for output actions and added word_wrap_output_action (with appropriate strings/accessibility descriptions).
  • Added UI strings/tooling support for the new action (including “Word Wrap” label and enable/disable accessibility content descriptions).

Risks / best-practice considerations:

  • Live preference updates rely on correct EventBus registration/unregistration; missed cleanup could cause stale UI updates or potential leaks on some lifecycle paths.
  • Changing the bottom-sheet action container to ConstraintLayout and repositioning buttons may affect layout alignment on edge screen sizes/configurations.

Walkthrough

Output fragments now support a persisted word-wrap preference. The editor bottom sheet adds a toggle action, synchronizes it with supported fragments, and updates editor word-wrap state through preference-change events.

Changes

Output word-wrap control

Layer / File(s) Summary
Preference and fragment contract
preferences/src/main/java/.../EditorPreferences.kt, app/src/main/java/.../WrappableOutputFragment.kt
Adds the OUTPUT_WORD_WRAP preference, its boolean accessor, and the shared wrappable-fragment API.
Output fragment integration
app/src/main/java/.../LogViewFragment.kt, app/src/main/java/.../NonEditableEditorFragment.java
Initializes editor wrapping from preferences, exposes wrapping controls, and applies EventBus preference updates during the view lifecycle.
Bottom-sheet word-wrap action
app/src/main/java/.../EditorBottomSheet.kt, app/src/main/res/layout/layout_editor_bottom_sheet.xml, resources/src/main/res/values/*, idetooltips/src/main/java/.../TooltipTag.kt
Adds and displays the checkable word-wrap action, connects it to the preference, updates output-action layout, and adds labels, accessibility descriptions, styling, and tooltip metadata.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant EditorBottomSheet
  participant EditorPreferences
  participant OutputFragment
  User->>EditorBottomSheet: Toggle word-wrap action
  EditorBottomSheet->>EditorPreferences: Persist outputWordWrap
  EditorPreferences->>OutputFragment: Publish OUTPUT_WORD_WRAP change
  OutputFragment->>OutputFragment: Apply editor word-wrap state
Loading

Possibly related PRs

Suggested reviewers: jatezzz, daniel-adfa, jomen-adfa, itsaky-adfa

Poem

I’m a rabbit with a wrap in my ear,
Toggling lines so they all appear.
Preferences hop, editors align,
Logs curl neatly, line by line.
New buttons shine—what a fine design!

🚥 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 clearly matches the main change: adding a word wrap switch for logs.
Description check ✅ Passed The description directly describes enabling word wrapping on or off in logs.
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.
✨ 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-4715-word-wrap-switch

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
app/src/main/java/com/itsaky/androidide/fragments/output/WrappableOutputFragment.kt (1)

25-41: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Run the required Spotless formatters.

  • app/src/main/java/com/itsaky/androidide/fragments/output/WrappableOutputFragment.kt#L25-L41: format Kotlin with ktlint and tabs.
  • app/src/main/java/com/itsaky/androidide/fragments/output/NonEditableEditorFragment.java#L108-L119: format Java with Eclipse formatting and tabs.
  • app/src/main/res/layout/layout_editor_bottom_sheet.xml#L10-L135: format XML with Eclipse WTP and tabs.

As per coding guidelines, Java, Kotlin, and XML files must use tabs and the project's Spotless formatter.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@app/src/main/java/com/itsaky/androidide/fragments/output/WrappableOutputFragment.kt`
around lines 25 - 41, Run the project's Spotless formatters on
app/src/main/java/com/itsaky/androidide/fragments/output/WrappableOutputFragment.kt
lines 25-41 using ktlint with tabs,
app/src/main/java/com/itsaky/androidide/fragments/output/NonEditableEditorFragment.java
lines 108-119 using Eclipse Java formatting with tabs, and
app/src/main/res/layout/layout_editor_bottom_sheet.xml lines 10-135 using
Eclipse WTP formatting with tabs.

Source: Coding guidelines

app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt (1)

662-669: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Use EditorPreferences as the sole word-wrap state source.

This reads OutputWordWrapPrefs, while the action persists only EditorPreferences.outputWordWrap. A value in the secondary store can override the persisted setting; use EditorPreferences.outputWordWrap here when syncing the fragment and action.

Proposed change
-				val prefs = context.getSharedPreferences("OutputWordWrapPrefs", Context.MODE_PRIVATE)
-				val isEnabled = prefs.getBoolean(currentFragment.wordWrapPrefKey, currentFragment.isWordWrapEnabled())
+				val isEnabled = EditorPreferences.outputWordWrap

As per coding guidelines, reuse existing helpers and maintain one owner per concern.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt` around lines
662 - 669, Update the word-wrap synchronization block in EditorBottomSheet so it
reads the enabled state exclusively from EditorPreferences.outputWordWrap
instead of the OutputWordWrapPrefs SharedPreferences store. Use that value for
both WrappableOutputFragment.setWordWrapEnabled and
binding.wordWrapOutputAction.isChecked, preserving the existing conditional
synchronization behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt`:
- Line 201: Complete accessibility support for the word-wrap toggle: in
EditorBottomSheet.kt, keep wordWrapOutputAction’s checked state and state-aware
content description synchronized at the tab-change, toggle-listener, and
fragment-synchronization sites (201-201, 284-290, and 662-669), and register the
required long-press tooltip listener at the toggle setup. In
layout_editor_bottom_sheet.xml lines 105-115, use the appropriate state-aware
cd_* resource; in strings.xml line 691, add enable/disable word-wrap
descriptions and the contextual tooltip string.

In `@app/src/main/res/layout/layout_editor_bottom_sheet.xml`:
- Around line 73-115: Constrain the output-action row in
layout_editor_bottom_sheet.xml by giving every text action, from
search_output_action through clear_output_action, a bounded relationship to
word_wrap_output_action using a horizontal chain, Flow, or equivalent
overflow-safe layout; preserve the icon’s end alignment and prevent localized
text from overlapping or escaping. Also update
resources/src/main/res/values/styles.xml lines 204-216 to avoid forcing
unconstrained wrap_content widths for EditorBottomSheet.OutputActionButton.

---

Nitpick comments:
In
`@app/src/main/java/com/itsaky/androidide/fragments/output/WrappableOutputFragment.kt`:
- Around line 25-41: Run the project's Spotless formatters on
app/src/main/java/com/itsaky/androidide/fragments/output/WrappableOutputFragment.kt
lines 25-41 using ktlint with tabs,
app/src/main/java/com/itsaky/androidide/fragments/output/NonEditableEditorFragment.java
lines 108-119 using Eclipse Java formatting with tabs, and
app/src/main/res/layout/layout_editor_bottom_sheet.xml lines 10-135 using
Eclipse WTP formatting with tabs.

In `@app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt`:
- Around line 662-669: Update the word-wrap synchronization block in
EditorBottomSheet so it reads the enabled state exclusively from
EditorPreferences.outputWordWrap instead of the OutputWordWrapPrefs
SharedPreferences store. Use that value for both
WrappableOutputFragment.setWordWrapEnabled and
binding.wordWrapOutputAction.isChecked, preserving the existing conditional
synchronization behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b2847274-9fe6-42dc-8ff9-039c3fb1a9fd

📥 Commits

Reviewing files that changed from the base of the PR and between aade24f and 90466a3.

📒 Files selected for processing (8)
  • app/src/main/java/com/itsaky/androidide/fragments/output/LogViewFragment.kt
  • app/src/main/java/com/itsaky/androidide/fragments/output/NonEditableEditorFragment.java
  • app/src/main/java/com/itsaky/androidide/fragments/output/WrappableOutputFragment.kt
  • app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt
  • app/src/main/res/layout/layout_editor_bottom_sheet.xml
  • preferences/src/main/java/com/itsaky/androidide/preferences/internal/EditorPreferences.kt
  • resources/src/main/res/values/strings.xml
  • resources/src/main/res/values/styles.xml

Comment thread app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt Outdated
Comment thread app/src/main/res/layout/layout_editor_bottom_sheet.xml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt (1)

672-679: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep the content description synchronized during fragment preference sync.

Line 678 updates only isChecked, bypassing updateWordWrapButtonState(). When this path applies a fragment-specific preference, TalkBack can announce the wrong action for the visible state. Replace the direct assignment with updateWordWrapButtonState(isEnabled).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt` around lines
672 - 679, In the fragment preference sync within the
showWordWrap/WrappableOutputFragment branch, replace the direct
binding.wordWrapOutputAction.isChecked assignment with
updateWordWrapButtonState(isEnabled) so the checked state and content
description remain synchronized.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt`:
- Around line 672-679: In the fragment preference sync within the
showWordWrap/WrappableOutputFragment branch, replace the direct
binding.wordWrapOutputAction.isChecked assignment with
updateWordWrapButtonState(isEnabled) so the checked state and content
description remain synchronized.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2b4d2d77-ff0e-47f8-8a07-dbf2edf0e078

📥 Commits

Reviewing files that changed from the base of the PR and between 069f873 and cfa468e.

📒 Files selected for processing (4)
  • app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt
  • app/src/main/res/layout/layout_editor_bottom_sheet.xml
  • idetooltips/src/main/java/com/itsaky/androidide/idetooltips/TooltipTag.kt
  • resources/src/main/res/values/strings.xml
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src/main/res/layout/layout_editor_bottom_sheet.xml

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.

1 participant