Skip to content

Search #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed

Search #49

wants to merge 12 commits into from

Conversation

rmusser01
Copy link

@rmusser01 rmusser01 commented Jun 23, 2025

Sorry about the other pull request, here's a slightly better one,

Full Disclosure: This code was vibe coded via Anthropic Opus (claude code) -> Reviewed -> Implemented -> Iterated -> Tested -> Worked.

# File Picker Enhancements

This document describes the enhancements made to the textual-fspicker module to improve user experience and functionality.

## New Features

### 1. Enhanced Keyboard Shortcuts
- **Ctrl+H** - Toggle hidden files (in addition to existing '.')
- **Ctrl+L** - Focus path input field for direct path entry
- **Ctrl+F** - Toggle search mode and focus search input
- **F5** - Refresh current directory

### 2. Breadcrumb Navigation
- Visual path display with clickable components
- Click any path segment to navigate directly
- Better understanding of current location in filesystem hierarchy

### 3. Search Within Directory
- Real-time search filtering of directory contents
- Toggle with Ctrl+F
- Filters files and folders by name
- Clear button to reset search
- This doesn't do fuzzy searching, only exact-matches

## Implementation Details

### Modified Files

1. **base_dialog.py**
   - Added new keyboard bindings
   - Added reactive properties for UI state
   - Implemented breadcrumb navigation
   - Added search container
   - Implemented all keyboard action handlers

2. **parts/directory_navigation.py**
   - Added `search_filter` reactive variable
   - Modified `hide()` method to respect search filter
   - Added `_watch_search_filter()` method
   - Modified `_repopulate_display()` to handle search state

### Code Structure

The enhancements maintain backward compatibility while adding new optional features. The UI components are hidden by default and can be toggled via keyboard shortcuts.

### CSS Additions

New CSS rules were added for:
- Breadcrumb navigation styling
- Search container
- Visibility toggles

## Testing

The enhancements have been tested with:
- Various directory structures
- Hidden files toggle
- Search functionality
- Breadcrumb navigation
- Keyboard shortcuts

rmusser01 and others added 12 commits June 19, 2025 17:18
…arch within directory features added

### 1. Enhanced Keyboard Shortcuts
- **Ctrl+H** - Toggle hidden files (in addition to existing '.')
- **Ctrl+L** - Focus path input field for direct path entry
- **Ctrl+R** - Toggle recent locations panel
- **Ctrl+F** - Toggle search mode and focus search input
- **F5** - Refresh current directory
- **Ctrl+D** - Bookmark current directory (placeholder for future implementation)

### 2. Recent Locations Panel
- Shows recently accessed files and directories
- Toggle visibility with Ctrl+R
- Click to quickly navigate to recent locations
- Placeholder for persistent storage (needs implementation)

### 3. Breadcrumb Navigation
- Visual path display with clickable components
- Click any path segment to navigate directly
- Better understanding of current location in filesystem hierarchy

### 4. Search Within Directory
- Real-time search filtering of directory contents
- Toggle with Ctrl+F
- Filters files and folders by name
- Clear button to reset search

### 5. Improved Visual Feedback
- Notifications for keyboard actions
- Better error messages
- Search active indicator
Remove extra commetns
@rmusser01
Copy link
Author

rmusser01 commented Jun 23, 2025

I recognize and realize this is probably not 'ideal' code, and do not mind if you reject/rewrite it all. Just wanting to contribute what I've added to your library to help me, back into main and all that.

@davep
Copy link
Owner

davep commented Jun 23, 2025

Full Disclosure: This code was vibe coded via Anthropic Opus (claude code) -> Reviewed -> Implemented -> Iterated -> Tested -> Worked.

Thanks, I appreciate the honesty here. Sadly, I'm not sure I can in good conscience accept code created in this way, especially given the possible licence implications. Moreover, a quick glance over the code throws up quite a few problems with it.

Probably the most glaring issue is that this PR renders the library impossible to import because of one particular change it makes.

Python 3.13.1 (main, Dec  6 2024, 20:13:21) [Clang 18.1.8 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import textual_fspicker
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    import textual_fspicker
  File "/Users/davep/develop/python/textual-fspicker/src/textual_fspicker/__init__.py", line 14, in <module>
    __version__ = version("textual_fspicker")
                  ^^^^^^^
NameError: name 'version' is not defined
>>>

@davep davep closed this Jun 23, 2025
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.

2 participants