SYSTEM: You are a Python 3.12 programmer, capable of analyzing problems in depth and explaining solutions in a clear and concise manner. Your responses prioritize code efficiency, readability, and simplicity. You leverage the latest Python features. When addressing tasks, you break them down into clear steps and present only essential information, ensuring users receive focused, expert guidance tailored to their needs. You only print the parts of the code you changed in a way that makes them easy to copy paste in the code base. USER: When Filtering for something (for example gladiator) and then in the filtered view create a new row and type something in the new row it deletes the rest of the table. Please fix this. tksheet handbook: Hiding Rows

Note that once you have hidden rows you can use the function displayed_row_to_data(row) to retrieve a row data index from a displayed index.
Display only certain rows

display_rows(
    rows: None | Literal["all"] | Iterator[int] = None,
    all_rows_displayed: None | bool = None,
    reset_row_positions: bool = True,
    refresh: bool = False,
    redraw: bool = False,
    deselect_all: bool = True,
    **kwargs,
) -> list[int] | None

Parameters:

    rows (int, iterable, "all") are the rows to be displayed, omit the rows to be hidden.
    Use argument True with all_rows_displayed to display all rows, use False to display only the rows you've set using the rows arg.
    You can also use the keyword argument all_displayed instead of all_rows_displayed.

Examples:

    An example of row filtering using this function can be found here.
    More examples below:

# display all rows
self.sheet.display_rows("all")

# display specific rows only
self.sheet.display_rows([2, 4, 7], all_displayed = False)

Hide specific rows

hide_rows(
    rows: int | set | Iterator[int] = set(),
    redraw: bool = True,
    deselect_all: bool = True,
    data_indexes: bool = False,
) -> Sheet

Parameters:

    NOTE: rows (int) by default uses displayed row indexes, not data indexes. In other words the indexes of the rows displayed on the screen are the ones that are hidden, this is useful when used in conjunction with get_selected_rows().
    data_indexes when False it makes the rows parameter indexes represent displayed rows and not the underlying Sheet data rows. When True the indexes represent data indexes.

Example:

rows_to_hide = set(sheet.data_r(r) for r in sheet.get_selected_rows())
sheet.hide_rows(
    rows_to_hide,
    data_indexes=True,
)

Unhide specific rows

show_rows(
    rows: int | Iterator[int],
    redraw: bool = True,
    deselect_all: bool = True,
) -> Sheet

Parameters:

    NOTE: rows (int) uses data row indexes, not displayed indexes. In other words the indexes of the rows which represent the underlying data are shown.

Notes:

    Will return if all rows are currently displayed (Sheet.all_rows).

Example:

# converting displayed row indexes to data indexes using data_r(r)
rows = set(sheet.data_r(r) for r in sheet.get_selected_rows())

# hiding rows
sheet.hide_rows(
    rows,
    data_indexes=True,
)

# showing them again
sheet.show_rows(rows)

Get or set the all rows displayed boolean

Get the bool

@property
all_rows()

    e.g. get_all_rows_displayed = sheet.all_rows.

Set the bool

@all_rows.setter
all_rows(a: bool)

e.g. sheet.all_rows = True.

all_rows_displayed(a: bool | None = None) -> bool

    a (bool, None) Either set by using bool or get by leaving None e.g. all_rows_displayed().

Displayed row index to data

Convert a displayed row index to a data index. If the internal all_rows_displayed attribute is True then it will simply return the provided argument.

displayed_row_to_data(r)
data_r(r)

Get currently displayed rows

@property
displayed_rows() -> list[int]

    e.g. rows = sheet.displayed_rows

  Python 3.12 Code: