This commit refactors the search result to include the total count of matches found, alongside the limited search results (page) for better pagination support. Changes made include:
- Modified the return type from `Vec<SearchResult>` to `SearchResults` structure, to include a total count.
- Updated the search function implementation to handle the new data structure.
- Adapted the test cases to account for the updated search result format.
In addition to the previous changes, this commit addresses the issue of not knowing the total number of search results when using pagination, which can now be easily obtained from the `SearchResults` structure.
This commit updates the padding logic in the CodeViewer component to handle highlighted lines more effectively. The renderRowContent function now returns an object with an html property and a highlighted property, allowing for more precise controls when rendering rows. Additionally, new functions have been introduced to manage chunks of lines and apply padding, helping to optimize the display of code diffs.
Changes include:
- Modify `renderRowContent` to return an object containing html and highlighted properties
- Add a `rows` computed variable that maps the original rows to the newly rendered rows
- Introduce new `RenderedRow` type and `applyPadding` function to manage chunks and padding logic
- Update Row interface to include a size property
This commit adds a new feature to display the contents of a file when it's in the "added" status in the commits view. A new `get_file_contents` function is implemented in the `Repository` struct, and a corresponding command is added to the main Tauri app. The frontend is updated to handle added files by invoking this command and rendering the contents in the DiffViewer component.
Changes include:
- Add `get_file_contents` function to `repository.rs` and command in main.rs
- Update the viewer to handle added files
Enhanced the commit page by adding the DiffViewer component and implementing file selection functionality for the commit message generation. Users can now view diffs per file before committing.
This update enables the generation of a working directory diff and returns a Git commit message based on the diff changes. It includes changes to the API, Tauri, and frontend code. Notable modifications include:
- Added `git_wd_diff` function to Tauri `src/main.rs`
- Modified `Repository` struct, added `wd_diff` method to `src/repositories/repository.rs`
- New `commit` function added to `src/lib/api.ts`
- Added `fetchCommitMessage` function in `src/routes/projects/[projectId]/+page.svelte`
- Minor UI adjustments in `src/routes/projects/[projectId]/player/+page.svelte`
Overall, this commit improves user experience by automatically generating commit messages based on the changes made in the working directory.