CodeEdit
CodeEdit copied to clipboard
Search Results UI Fixes
Description
This PR finishes the search results UI changes in #549 and #534. It improves contrast between the search match and the rest of the search result, and shortens search results to 60 characters before and after the matching search result. This removes lengthy search results when searching minimized files.
While implementing the UI changes, I found that NSAttributedString crashes when given non-valid strings. The changes in WorkspaceDocument+Search.swift are the changes made to filter out non-compatible strings (It also resulted in a massive performance boost, searching the entire CodeEdit code base only takes ~1/2s now).
Changes in detail:
- Changed search result labels to more closely match Xcode in terms of font and color.
- Selecting search results opens the corresponding file.
- Pressing the
backspaceordeletebutton when a result is selected will delete that result. - Implemented an
NSOutlineView-backed search results list - Modified the search results to return a slightly different result structure
- Results now look like
File > Array of matchesw/ line numbers. CheckSearchResultModelandSearchResultMatchModelin the search module for more.
- Results now look like
- Added a
searchResultCountvariable to the search state due to the updated result structure. - Modified
OutlineTableViewCellto be more generalized and reusable (It's used in the search list for the file header)- Cell now manages the icon, icon color, and file label settings instead of the
OutlineTableView
- Cell now manages the icon, icon color, and file label settings instead of the
- Adds a
String.safeOffsetmethod for safely fetching an offset (this is limited to the Search module)
Related Issue
- #534
- Replaces PR #549
Checklist
- [x] I read and understood the contributing guide as well as the code of conduct
- [x] My changes generate no new warnings
- [x] My code builds and runs on my machine
- [x] I documented my code
- [x] Review requested
Screenshots
Light Mode Search List.
Dark Mode Search List.
