Heuristic JCL/COBOL detection and syntax highlighting in the raw record view#28
Merged
Conversation
Tannex
force-pushed
the
issue-19-table-polish
branch
from
July 19, 2026 10:06
f145dcb to
801c9d3
Compare
Tannex
force-pushed
the
issue-21-syntax-highlighting
branch
from
July 19, 2026 10:06
d7da6a2 to
162669c
Compare
Tannex
force-pushed
the
issue-19-table-polish
branch
from
July 19, 2026 10:10
801c9d3 to
f9dacca
Compare
Tannex
force-pushed
the
issue-21-syntax-highlighting
branch
from
July 19, 2026 10:10
162669c to
cd5cd88
Compare
Tannex
force-pushed
the
issue-19-table-polish
branch
from
July 19, 2026 11:31
f9dacca to
7c57bb0
Compare
Tannex
force-pushed
the
issue-21-syntax-highlighting
branch
from
July 19, 2026 11:32
cd5cd88 to
a757197
Compare
Tannex
commented
Jul 19, 2026
Tannex
left a comment
Owner
Author
There was a problem hiding this comment.
A bit heavy on in-line comments, could indicate the code needs refactoring.
Could use better support for COBOL keywords, but we can do that another time.
LGTM;
Tannex
force-pushed
the
issue-19-table-polish
branch
from
July 19, 2026 13:34
7c57bb0 to
1981841
Compare
The raw record view now classifies decoded records once per loaded page (never per keystroke or render frame) as JCL, COBOL, or plain via cheap heuristics: JCL by the //-statement ratio, COBOL by scored signals (division headers, PIC clauses, column-7 comments, sequence areas) so flat data files with leading numeric ids stay plain. Detected sources get subtle consolePalette tints: JCL statement names, operations, keyword parameters, and comments; COBOL sequence areas, comment lines, keywords, PIC clauses, and literals. Highlighted lines strip back to their exact input, so the viewport's ANSI-aware cut keeps horizontal panning and narrow terminals safe, and the cursor row stays untinted so the selected style renders uniformly. Demo mode serves a real JCL job from DEMO.JCLLIB and a COBOL program from DEMO.SOURCE.COBOL so every token class is visible offline. Closes #21 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Extract named helpers (isJCLPrefixed, containsCOBOLDivision, containsPICClause, blankOrDigits, takeQuoted, splitAtSpace, wordEnd) and COBOL column constants so the scanning code reads without per-line comments. No behavior change; existing syntax tests pass unmodified. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Tannex
force-pushed
the
issue-21-syntax-highlighting
branch
from
July 19, 2026 13:34
9e94ea4 to
ba96a8a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #21. Stacked on PR #27 (
issue-19-table-polish) — merge that first; this PR's own diff is commit d7da6a2.What
internal/cqt/syntax.go): classifies a data set/member's decoded records as JCL, COBOL, or plain.//or/*(min 2).PIC/PICTUREclauses, column-7 comment indicators, and a numeric sequence area on most lines (supporting signal only, so flat data files with leading record ids stay plain).rawLongeston refresh/reset. Never per keystroke or per render frame; content type can't change mid-file, so a 120-line prefix sample carries the verdict.consolePalette, matching the table-polish tones://NAMEcyan, operations (JOB/EXEC/DD/…) amber,KEYWORD=parameter keys and quoted literals green, in-stream data plain.PIC+ picture strings amber, quoted literals green.ansi.Strip(highlight(l)) == l), so the viewport's ANSI-awareansi.Cutkeeps horizontal panning and narrow terminals safe. The cursor row stays untinted so the selected-row style renders uniformly (same rule as the table cell tints).DEMO.JCLLIBmembers serve a realistic JCL job andDEMO.SOURCE.COBOLmembers a COBOL program, exercising every token class offline (and flowing through the edit-mode text path too).Screenshots (demo mode, via
scripts/tui-shot)Decisions
Testing
go build ./... && go vet ./... && go test ./...all pass,gofmtclean. New tests cover detection (JCL, COBOL, flat-data and mostly-plain negatives), both highlighters' token classes with content round-trip guarantees, once-per-page cache behavior (content swap without count change is not re-detected; a new page is), raw-view integration with an untinted cursor row, and unchanged plain rendering.Closes #21
🤖 Generated with Claude Code