editor-snip% assumes editor is a text% or a pasteboard% (on copying)
Nobody has claimed this yet.
- Dominant language
- Racket
- Stars
- 68
- Forks
- 82
- PR merge metrics
- No merged PRs in 30d
Description
The editor-snip% class assumes that the internal editor is a text% or a pasteboard%, when it really should support anything that satisfies the editor<%> interface.
This initially seems okay given that those are the only two editors provided by Racket, but it becomes a problem if new editors are defined. Say I create a my-pasteboard%, which extends a pasteboard%.
This shows up when calling the editor-snip%'s copy method. Which is supposed to create a new editor-snip% that is a copy of the previous one.
Now, each editor has a copy-self method with similar semantics (returns a new editor<%> that is a copy of the previous one), that it can use to get a copy of the editor. However, rather than relying on this method, the editor-snip%'s copy method overrides the editor<%>'s copy-self method, to do its own copying, and it assumes that the only editors are text% and pasteboard%.
This becomes a problem when a user has extended an editor<%> to, say, create their own pasteboard% class that has new attributes. When the copy happens, everything that cannot be coerced into a pasteboard% gets lost.
Instead, it really should rely on the editor's copy method to get the new type of editor. It can then add the attributes it wants to onto that. Unless there is something I'm missing here?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the editor-snip% copy method and the editor<%> copy-self method. Check how copying currently handles text% and pasteboard%, then verify that a custom editor<%> retains its type and attributes after copying. Done means editor-snip% delegates editor copying while still adding its own attributes.
Written by the indexing model from the issue text.
Assessment
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100