Ubisam-MobileGit/tasks/058-outline-for-windows-cpp.md
2026-09-28 16:07:46 +09:00

2.8 KiB

TASK-058: The outline was empty for C++ written on Windows

Status: implemented; required checks pass; installed on the product owner's Z Fold7, awaiting their confirmation Owner: Claude Reviewer: human product owner

Outcome

The human product owner reported that a .cpp and its .h showed no classes or functions in the side pane, although both plainly contain them.

Cause

Reproduced in a unit test, not on the owner's files (their repository is private and was not read).

  1. Lines ending in \r\n. The viewer split text on \n only, so every line of a file written on Windows ended in an invisible \r. The patterns that recognize a method must match a whole line, and . does not match \r, so no method was ever recognized -- in C++ and in C# alike. A class was still found, because that pattern only has to match the start of the line. A .cpp holding only function definitions therefore had an empty outline.
  2. Found while reproducing, in MFC-style code: a macro in a class body (DECLARE_MESSAGE_MAP()) was listed as a method, and because it has no ; the declaration on the next line was skipped.
  3. Found while reproducing: a block opened in both branches of an #if/#else was counted twice, leaving a scope that never closed; every function after it in the file was missing.

Scope

  • Included: the three causes above, with a test for each.
  • Excluded: declarations produced by macros, and declarations split across lines before their name. The outline recognizes patterns; it is not a parser.

Writable paths

  • app/src/main/java/com/ubisam/ubgitea/feature/codebrowser/
  • app/src/test/java/com/ubisam/ubgitea/feature/codebrowser/
  • tasks/, docs/

Acceptance criteria

  • A header, a source file and a C# file with \r\n line endings list their methods.
  • A capitalized macro in a class body is not listed and does not hide what follows it.
  • A block opened in each branch of a conditional is counted once.

Security and privacy

No additional concerns.

Required checks

./gradlew compileDebugKotlin compileDebugUnitTestKotlin testDebugUnitTest assembleDebug lintDebug

Evidence

  • Required checks pass: 435 unit tests, 0 failures; lint 0 errors.
  • Installed on the SM-F966N over wireless adb.
  • Not verified against the files the product owner was reading. If their outline is still empty, the cause is something these three do not cover, and a sample of the file is needed.

Known limitations

  • A header whose class showed nothing at all is not explained by cause 1, which still finds classes. It may be explained by the owner looking at the .cpp's outline while both were open.
  • Removing the \r also changes what "copy" puts on the clipboard: lines are joined as displayed.

Review findings

None yet.