forked from anomalyco/opencode
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Summary
Improve clipboard handling specifically for code - better paste behavior, smart formatting, and enhanced copy functionality tailored for developers.
Context
Mobile coding requires frequent copy/paste operations, but standard clipboard behavior doesn't work well for code. Improved clipboard handling would make these operations faster and more reliable.
Problems to Solve
-
Paste Issues
- Indentation often gets stripped or corrupted
- Multi-line paste doesn't preserve structure
- Trailing whitespace problems
- Auto-formatting that breaks code
-
Copy Issues
- Hard to select code accurately on mobile
- No easy way to copy just a function/class
- Line numbers sometimes included accidentally
-
Integration
- Clipboard from other apps may need adjustment
- Different paste behavior for different contexts
Proposed Features
1. Smart Paste
- Preserve indentation when pasting into code blocks
- Detect code vs prose and adjust behavior accordingly
- Strip trailing whitespace automatically (configurable)
- Trim leading blank lines before insert point
- Maintain relative indentation when pasting nested code
2. Enhanced Copy
- Select-by-block - tap to select function, class, or logical block
- Copy with/without surrounding context (just selection vs including indentation)
- Smart selection - double-tap to select word, triple-tap for line
- Copy formatted - option to copy as markdown code block
3. Multi-Content Paste
When pasting content that could be interpreted multiple ways:
- Show a brief picker: "Insert as Code" / "Insert as Text"
- Remember preference for similar content
4. Code-Specific Actions
- Paste and indent - paste and auto-indent for current context
- Paste as comment - paste with comment prefix
- Paste into terminal - execute pasted command (with confirmation)
Technical Considerations
- Use iOS text input system properly
- Work with the existing editor (likely Monaco or CodeMirror)
- Handle various paste sources gracefully
Alternative
Consider adding a dedicated "code paste" button in the input area that applies code-specific paste behavior.
Labels
- enhancement
- developer-experience
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels