-
-
Couldn't load subscription status.
- Fork 40
Improve package usage #830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Allow configuration to be set individually for each Document - Move General struct to general.go for better modularity - Add setter methods to General to simplify configuration changes - Make it easier to use and customize settings when using as a package
…asier testing - Introduce SetTcellNewScreen to enable replacing tcell.NewScreen in tests - Use fakeScreen in example_test.go to improve test stability and flexibility - Add tests for header and follow mode options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves package usage by refactoring the General configuration struct and enhancing the public API. It moves the General struct to its own file and adds setter methods for better encapsulation, while updating examples to use the new API.
- Moves General struct from config.go to general.go with comprehensive setter methods
- Adds a General field to Document for per-document configuration
- Updates examples to demonstrate the new setter-based API pattern
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| oviewer/general.go | New file containing General struct definition with setter methods |
| oviewer/config.go | Removes General struct definition (moved to general.go) |
| oviewer/document.go | Adds General field to Document struct |
| oviewer/oviewer.go | Adds SetTcellNewScreen function and integrates updateRunTimeSettings call |
| oviewer/example_test.go | Adds test cases demonstrating new General setter methods |
| examples/tail/main.go | Updates to use new General setter methods instead of direct field access |
| examples/search/main.go | Updates style configuration to use General.Style field |
| examples/header/main.go | New example demonstrating header configuration with new API |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
oviewer/general.go
Outdated
| SectionStartPosition *int | ||
| // SectionHeaderNum is the number of lines in the section header. | ||
| SectionHeaderNum *int | ||
| // HScrollWidth is the horizontal scroll width as a string (e.g., "80%", "100px"). |
Copilot
AI
Aug 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment mentions "100px" as an example, but this suggests pixel units which may not be appropriate for a terminal-based application. Consider providing more relevant examples like "80%" or column counts.
| // HScrollWidth is the horizontal scroll width as a string (e.g., "80%", "100px"). | |
| // HScrollWidth is the horizontal scroll width as a string (e.g., "80%", "40"). |
| // StatusLine indicates whether to hide the status line. | ||
| StatusLine *bool | ||
| // Prompt is the prompt configuration. | ||
| // PromptConfig holds settings related to the command prompt. |
Copilot
AI
Aug 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment appears to be duplicating the comment on line 75. The comment should be removed since the field type PromptConfig is already self-explanatory.
| // PromptConfig holds settings related to the command prompt. |
No description provided.