iOfficeAI / iOfficeAI/OfficeCLI

docx: view issues ignores positive firstLineChars when checking first-line indent

Open Beginner friendly
#283 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
30.7k
Forks
2.1k
Avg merge
9d 8h
Merged PRs (30d)
5

Description

## Summary

In OfficeCLI v1.0.143, `view issues` reports that a normal body paragraph is missing a first-line indent even when the paragraph has a positive `firstLineChars` value.

`firstLineChars=200` represents a two-character first-line indent, so it should satisfy the check whose suggestion is “Set first-line indent to 2 characters.”

## Reproduction

```bash
officecli create repro.docx
officecli add repro.docx /body --type paragraph \
--prop 'text=Body paragraph with a character-relative first-line indent.' \
--prop firstLineChars=200
officecli get repro.docx /body/p[1] --json
officecli validate repro.docx --json
officecli view repro.docx issues --json
```

The property readback retains `firstLineChars: 200`, validation succeeds, and the DOCX contains `w:firstLineChars="200"`.

## Expected behavior

The paragraph is not reported as missing a first-line indent because it has a positive character-relative first-line indent.

## Actual behavior

`view issues` reports:

```text
Body paragraph missing first-line indent
```

with the suggestion:

```text
Set first-line indent to 2 characters
```

## Likely cause

The DOCX checker currently tests `Indentation.FirstLine` only when deciding whether a body paragraph has a first-line indent. It recognizes `HangingChars` as an exception, but does not recognize a positive `FirstLineChars` value:

https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Handlers/Word/WordHandler.View.cs#L1319-L1351

OfficeCLI otherwise supports and documents `firstLineChars`:

- https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Handlers/Word/WordHandler.Add.Text.cs#L553-L564
- https://github.com/iOfficeAI/OfficeCLI/blob/main/examples/word/paragraph-formatting.sh#L82-L84
- https://github.com/iOfficeAI/OfficeCLI/blob/main/schemas/help/docx/paragraph.json#L1166-L1173

## Suggested behavior

Treat either of these as satisfying the semantic first-line-indent check:

- a nonzero `FirstLine`; or
- a positive `FirstLineChars`.

This would align `view issues` with OfficeCLI’s supported character-relative DOCX indentation.

A related question: should effective first-line indentation inherited from the paragraph style also satisfy this semantic check? If so, resolving effective formatting rather than only direct paragraph properties may prevent the same false warning for style-driven documents.

Contributor guide

Open the contributing guide

Research direction

Start in src/officecli/Handlers/Word/WordHandler.View.cs around lines 1319-1351, then compare the existing first-line and character-relative indentation handling with the property support in WordHandler.Add.Text.cs and the paragraph schema. Run the reproduction commands from the issue and confirm that view issues no longer reports the warning when firstLineChars is positive; keep the style-inheritance question separate unless the code or tests require it.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.