Skip to content

Conversation

metasong
Copy link

@metasong metasong commented Sep 22, 2025

when override the cell rendering, we do not know which cell is rendering

@metasong metasong requested a review from tig as a code owner September 22, 2025 09:53
@tig tig requested a review from Copilot September 22, 2025 15:02
Copy link
Contributor

@Copilot 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 enhances the TableView's cell rendering functionality by adding row and column position parameters to the RenderCell method. This change enables developers to know which specific cell is being rendered when overriding the cell rendering behavior.

  • Added three new parameters (row, rowToRender, columnToRender) to the RenderCell method signature
  • Updated the method call in RenderRow to pass the additional position parameters
  • Updated the example override implementation to match the new signature

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
Terminal.Gui/Views/TableView/TableView.cs Enhanced RenderCell method signature with position parameters and updated the method call
Examples/UICatalog/Scenarios/MultiColouredTable.cs Updated override implementation to match new RenderCell signature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 1299 to +1304
/// <param name="cellAttribute"></param>
/// <param name="render"></param>
/// <param name="isPrimaryCell"></param>
protected virtual void RenderCell (Attribute cellAttribute, string render, bool isPrimaryCell)
/// <param name="row"></param>
/// <param name="rowToRender"></param>
/// <param name="columnToRender"></param>
Copy link
Preview

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter documentation is missing descriptions. Consider adding meaningful descriptions like /// <param name="row">The logical row index in the data source</param>, /// <param name="rowToRender">The visual row position being rendered</param>, and /// <param name="columnToRender">The column index being rendered</param>.

Copilot uses AI. Check for mistakes.

@tznind
Copy link
Collaborator

tznind commented Sep 22, 2025

Hmn... for v2 we should probably prioritise using the events system for this.

Add a DrawingCell event for example.

That would be preferable to override I think.

@tig thoughts?

@metasong would you be up for having a go at this? I can assist

Benefits include:

  • Future proofing for parameters (since they would be event args instead)
  • No need to subclass to change behaviour

Proposition would be to make it a cancelable event. User would set cancel to true and call relevant methods to draw themselves

@tig
Copy link
Collaborator

tig commented Sep 24, 2025

I concur.

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.

3 participants