Skip to content

Add column filter row with operator-aware filtering#71

Merged
silva96 merged 6 commits into
mainfrom
feature/column-filter-row
Feb 17, 2026
Merged

Add column filter row with operator-aware filtering#71
silva96 merged 6 commits into
mainfrom
feature/column-filter-row

Conversation

@silva96
Copy link
Copy Markdown
Owner

@silva96 silva96 commented Feb 17, 2026

Screenshot From 2026-02-17 17-39-39

Summary

This PR introduces a dedicated per-column filtering workflow in the request
list and follows through with keyboard/mouse UX, filter expression behavior,
renderer cleanup, and request-header mouse sorting improvements.

What changed

1) Column filter state and matching

  • Added per-column request filters in State for:
    • method, path, status, time
  • Kept compatibility with the legacy main filter path.
  • Added numeric expression matching for status and time:
    • comparators: >, >=, <, <=
    • exact numbers
    • ranges like 50-100
  • Important UX rule from discussion:
    • operator-only input (>, <, >=, <=) is treated as no-op
      (ignored), so incomplete expressions do not hide all rows.

2) Filter mode keyboard behavior

  • Added column navigation keys while in filter mode:
    • left/right arrows
    • Tab / Shift+Tab
  • Backspace behavior remains robust in filter mode.

3) Dedicated filter row + mouse support

  • Replaced header-inline filtering with a dedicated row under column headers.
  • Shows instruction text when filters are inactive:
    • Press f to start filtering, operators allowed: > >= < <= 50-100
  • Renders per-column inputs when filter mode is active or filters are present.
  • Added blinking active cursor in the selected filter cell.
  • Added filter-row mouse click support to select column and enter filter mode.

4) Visual and cleanup improvements

  • Removed temporary/testing palette UI and dead palette setup code.
  • Consolidated layout offsets used by renderer and mouse hit-testing to avoid
    drift.
  • Replaced renderer color magic numbers with semantic constants in:
    • renderer/ansi.rb
    • renderer/details.rb
    • renderer/scrollbar.rb
    • plus related usage updates in header/request list.

5) Request header sorting via mouse clicks

  • Clicking sortable request headers toggles sorting for METHOD, STATUS,
    and TIME.
  • PATH remains intentionally unsortable.
  • Active sorted column shows arrow direction in the header.
  • Sort is tri-state per clickable column:
    • first click: default direction
    • second click: reversed direction
    • third click: clears column arrow and resets to TIMESTAMP ASC

Tests

Added/updated tests:

  • test/test_request_column_filters.rb
  • test/test_input_handler_filter.rb
  • test/test_mouse_handler_filter_clicks.rb
  • test/test_sort_toggle.rb

Validation run:

  • bundle exec standardrb
  • bundle exec rake test

Both pass locally.

Introduce per-column request filters for method, path, status, and
time while preserving the legacy main filter behavior.

Implement numeric comparison and range parsing for status/time,
including operator-only expressions as no-op filters so incomplete
input does not hide all rows.

This enables combining multiple column filters at once and adds
regression tests for comparisons, ranges, and clear behavior.
Expand filter-mode key handling to navigate request filter columns
with left/right arrows, Tab, and Shift+Tab.

Keep backspace handling robust by preserving the key set used in
filter mode and assert behavior against the active request column
filter in tests.

This keeps keyboard filtering predictable while editing focused
column inputs.
Replace the single header filter display with a dedicated filter row
below column headers and render per-column inputs.

Keep status/time filter inputs right-anchored while allowing wider
filter expressions by borrowing space from the path filter area.
Support blinking cursor placement and operator guidance text.

Add mouse support for filter-row clicks, align hitboxes with the
new layout, and update header/help behavior to reflect column-based
filtering.
Refactor renderer color usage to rely on named screen constants
instead of raw color-pair integers.

Update ANSI mapping, details rendering segments, and scrollbar
drawing to use semantic identifiers so color intent is explicit and
changes are easier to audit.

This reduces hidden coupling to pair indices and keeps styling
changes safer across renderers.
Allow clicking sortable request headers to toggle sorting for
method, status, and time while leaving path unsortable.

Render directional arrows on the active sorted column header and
persist ascending/descending direction per selected column.

Keep keyboard sort cycling intact, integrate mouse hit-testing for
header row clicks, and add tests for toggling behavior and path
no-op semantics.
Make request-header sorting tri-state: first click uses the default
direction, second click reverses it, and third click clears the
column arrow by resetting to TIMESTAMP ASC.

Extract request filter-row rendering and layout into a dedicated
RequestFilterBar renderer so RequestList stays focused on table rows
and headers. Reuse that layout in MouseHandler to keep click hit
testing aligned with rendered filter cells.

Add and extend tests for third-click reset behavior in both sort
and mouse header interactions.
@silva96 silva96 force-pushed the feature/column-filter-row branch from 23a609b to 9cabd6a Compare February 17, 2026 20:32
@silva96 silva96 merged commit 0404fee into main Feb 17, 2026
1 check passed
@silva96 silva96 deleted the feature/column-filter-row branch February 17, 2026 20:40
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