Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@noborus
Copy link
Owner

@noborus noborus commented Aug 18, 2025

No description provided.

- 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
@noborus noborus requested a review from Copilot August 18, 2025 08:53
Copy link
Contributor

Copilot AI left a 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.

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").
Copy link

Copilot AI Aug 18, 2025

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.

Suggested change
// 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").

Copilot uses AI. Check for mistakes.
// StatusLine indicates whether to hide the status line.
StatusLine *bool
// Prompt is the prompt configuration.
// PromptConfig holds settings related to the command prompt.
Copy link

Copilot AI Aug 18, 2025

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.

Suggested change
// PromptConfig holds settings related to the command prompt.

Copilot uses AI. Check for mistakes.
@noborus noborus merged commit e4ba199 into master Aug 18, 2025
9 checks passed
@noborus noborus deleted the improve-package-usage branch September 3, 2025 23:55
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