Skip to content

refactor: generalize input field logic for easier reuse - #2035

Merged
ClementTsang merged 17 commits into
mainfrom
generalize_search_and_cursor
Apr 13, 2026
Merged

refactor: generalize input field logic for easier reuse#2035
ClementTsang merged 17 commits into
mainfrom
generalize_search_and_cursor

Conversation

@ClementTsang

@ClementTsang ClementTsang commented Apr 12, 2026

Copy link
Copy Markdown
Owner

Description

A description of the change, what it does, and why it was made. If relevant (e.g. UI changes), please also provide screenshots/recordings:

This came up while I was reviewing/updating #1953 - we probably want to generalize the really hairy input field logic so it can be reused anywhere. This PR further generalizes it so it's not as tied into app state logic. It also fixes a found bug around deleting whole words if they were were more than one byte long.

Issue

If applicable, what issue does this address?

Closes: #

Testing

If relevant, please state how this was tested (including steps):

If this change affects the program, please also indicate which platforms were tested:

  • Windows
  • macOS (specify version below)
  • Linux (specify distro below)
  • Other (specify below)

Checklist

Ensure all of these are met:

  • If this PR adds or changes a dependency, please justify this in the description
  • If this is a code change, areas your change affects have been linted using (cargo fmt)
  • If this is a code change, your changes pass cargo clippy --all -- -D warnings
  • If this is a code change, new tests were added if relevant
  • If this is a code change, your changes pass cargo test
  • The change has been tested to work (see above) and doesn't appear to break other things
  • Documentation has been updated if needed (README.md, help menu, docs, configs, etc.)
  • There are no merge conflicts
  • You have reviewed your changes first
  • The pull request passes the provided CI pipeline

Other

Anything else that maintainers should know about this PR:

@codecov

codecov Bot commented Apr 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.93750% with 81 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.35%. Comparing base (3545a31) to head (fdcc179).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/utils/input.rs 93.02% 36 Missing ⚠️
src/app.rs 0.00% 34 Missing ⚠️
src/canvas/widgets/process_table.rs 0.00% 6 Missing ⚠️
src/widgets/process_table.rs 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2035      +/-   ##
==========================================
+ Coverage   54.04%   55.35%   +1.31%     
==========================================
  Files         122      123       +1     
  Lines       17049    17278     +229     
==========================================
+ Hits         9214     9565     +351     
+ Misses       7835     7713     -122     
Flag Coverage Δ
macos-14 48.43% <85.76%> (+1.58%) ⬆️
ubuntu-24.04 53.89% <85.93%> (+1.40%) ⬆️
windows-2022 48.06% <85.76%> (+1.63%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ClementTsang
ClementTsang force-pushed the generalize_search_and_cursor branch from 5bfdc25 to 9cb9a0d Compare April 12, 2026 21:32
@ClementTsang
ClementTsang merged commit d187559 into main Apr 13, 2026
38 checks passed
@ClementTsang
ClementTsang deleted the generalize_search_and_cursor branch April 13, 2026 05:24
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Jul 9, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [ClementTsang/bottom](https://github.com/ClementTsang/bottom) | minor | `0.12.3` → `0.14.3` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>ClementTsang/bottom (ClementTsang/bottom)</summary>

### [`v0.14.3`](https://github.com/ClementTsang/bottom/blob/HEAD/CHANGELOG.md#0143---2026-07-01)

[Compare Source](ClementTsang/bottom@0.14.2...0.14.3)

##### Other

- [#&#8203;2119](ClementTsang/bottom#2119): Add workaround for draw behaviour that caused Kitty with `cursor_trail` to occasionally use more CPU.

### [`v0.14.2`](https://github.com/ClementTsang/bottom/blob/HEAD/CHANGELOG.md#0142---2026-06-27)

[Compare Source](ClementTsang/bottom@0.14.1...0.14.2)

##### Other

- [#&#8203;2109](ClementTsang/bottom#2109): Relocate the schema generation tool to avoid it interfering with `cargo install`.

### [`v0.14.1`](https://github.com/ClementTsang/bottom/blob/HEAD/CHANGELOG.md#0141---2026-06-22)

[Compare Source](ClementTsang/bottom@0.14.0...0.14.1)

##### Other

- [#&#8203;2096](ClementTsang/bottom#2096): Fix documentation suggestions around `memory_graph`.
- [#&#8203;2102](ClementTsang/bottom#2102): Mention memory/network alias in deprecation warnings.

### [`v0.14.0`](https://github.com/ClementTsang/bottom/blob/HEAD/CHANGELOG.md#0140---2026-06-20)

[Compare Source](ClementTsang/bottom@0.13.0...0.14.0)

##### Bug Fixes

- [#&#8203;2093](ClementTsang/bottom#2093): Fix memory collection using cgroup v1 sentinel max as total.

##### Features

- [#&#8203;2055](ClementTsang/bottom#2055): Add UFS disk I/O counters for FreeBSD.

##### Other

- [#&#8203;2052](ClementTsang/bottom#2052): Update minimum Rust version to 1.95.0.
- [#&#8203;2055](ClementTsang/bottom#2055): Use sysinfo for disk I/O for FreeBSD.

### [`v0.13.0`](https://github.com/ClementTsang/bottom/blob/HEAD/CHANGELOG.md#0130---2026-06-19)

[Compare Source](ClementTsang/bottom@0.12.3...0.13.0)

##### Bug Fixes

- [#&#8203;2035](ClementTsang/bottom#2035): Fix panic when deleting unicode words in search.
- [#&#8203;2042](ClementTsang/bottom#2042): Address possible memory usage growth for AMD GPU stat gathering on Linux.
- [#&#8203;2069](ClementTsang/bottom#2069): Fix issue in process search with parsing quoted delimiters.

##### Features

- [#&#8203;1938](ClementTsang/bottom#1938), [#&#8203;1980](ClementTsang/bottom#1980): Report average packet size and packet rate.
- [#&#8203;2003](ClementTsang/bottom#2003): Configurable default sort column for temperature and disk table widgets.
- [#&#8203;1979](ClementTsang/bottom#1979): Add a global `bg_colour` config option to set widget background colour.
- [#&#8203;2039](ClementTsang/bottom#2039): Add a config option for drawing a line separator (`table_gap`) between the column headers and data.
- [#&#8203;1948](ClementTsang/bottom#1948): Add support for both an `!=` operator and `!` negation prefixes in query searches.
- [#&#8203;2045](ClementTsang/bottom#2045): Add support for showing a decimal place for CPU usage
- [#&#8203;2046](ClementTsang/bottom#2046): Add a `show_table_scroll_bar` config option to show a scroll bar on table widgets.
- [#&#8203;2048](ClementTsang/bottom#2048): Add support for a temperature graph to show sensor temperature change over time.
- [#&#8203;2053](ClementTsang/bottom#2053): Add a configurable default sort column for the process widget (`processes.default_sort` or `--process-default-sort`).
- [#&#8203;2066](ClementTsang/bottom#2066): Add search support in the help dialog.
- [#&#8203;1791](ClementTsang/bottom#1791), [#&#8203;2072](ClementTsang/bottom#2072): Add support for using a short name for the GPU in memory usage.
- [#&#8203;2073](ClementTsang/bottom#2073): Add disk I/O time series graph.
- [#&#8203;2088](ClementTsang/bottom#2088): Add option to show unmounted disks on Linux.

##### Changes

- [#&#8203;2031](ClementTsang/bottom#2031): Tweak display/hiding logic for a graph widget's legend.
- [#&#8203;2039](ClementTsang/bottom#2039): Replace `hide_table_gap` with `table_gap`.
- [#&#8203;2061](ClementTsang/bottom#2061): Take cgroup into account for RAM/swap usage.
- [#&#8203;2062](ClementTsang/bottom#2062): Rename `[network]` to `[network_graph]` in the config file; `[network]` remains valid as an alias.
- [#&#8203;2062](ClementTsang/bottom#2062): Move network and memory graph config file options from `[flags]` to be under `[network_graph]` and `[memory_graph]`.
- [#&#8203;2063](ClementTsang/bottom#2063): Move process config file options from `[flags]` to be under `[processes]`.
- [#&#8203;2064](ClementTsang/bottom#2064): Move CPU config file options from `[flags]` to be under `[cpu]`.
- [#&#8203;2064](ClementTsang/bottom#2064): Move memory config file options from `[flags]` to be under `[memory_graph]`.
- [#&#8203;2066](ClementTsang/bottom#2066): Take cgroup into account for CPU usage% calculations.
- [#&#8203;2074](ClementTsang/bottom#2074): Treat uppercase 'Q' as a quit shortcut.

##### Other

- [#&#8203;1955](ClementTsang/bottom#1955): Fix mirrored documentation deploy to GitHub Pages.
- [#&#8203;1957](ClementTsang/bottom#1957): Fix CI bug around deploying docs on release.
- [#&#8203;1958](ClementTsang/bottom#1958): Fix cosmetic banner issue on docs page.
- [#&#8203;1962](ClementTsang/bottom#1962): Add code signing for Windows artifacts.
- [#&#8203;1986](ClementTsang/bottom#1986): Test and build NetBSD target.
- [#&#8203;2009](ClementTsang/bottom#2009): Configure CI job to publish to crates.io.
- [#&#8203;2037](ClementTsang/bottom#2037): Update AMD GPU names list.

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNTYuMCIsInVwZGF0ZWRJblZlciI6IjQzLjI1Ni4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6bWlub3IiXX0=-->
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