Copying code includes leading "│" characters, breaking pasted code
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 19.9k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 30
Description
Description:
When copying code from the jcode interface (e.g., from the rendered code blocks), the copied text includes a vertical bar │ at the beginning of every line. This makes the copied code invalid for direct use in editors, compilers, or terminals.
Example:
The original code (as displayed):
@TestTemplate
void aotCacheRecordingWritesCacheFile() throws IOException {
createMinimalMainSource();
createCacheRecordingTestSource();
this.gradleBuild.scriptProperty("junitVersion", TestTemplate.class.getPackage().getImplementationVersion());
this.gradleBuild.build("test", "bootBuildImage");
File cacheFile = new File(this.gradleBuild.getProjectDir(), "build/aot-cache/application.aot");
assertThat(cacheFile).exists();
}
But when copied, the clipboard contains:
│ @TestTemplate
│ void aotCacheRecordingWritesCacheFile() throws IOException {
│ createMinimalMainSource();
│ createCacheRecordingTestSource();
│ this.gradleBuild.scriptProperty("junitVersion", TestTemplate.class.getPackage().getImplementationVersion());
│ this.gradleBuild.build("test", "bootBuildImage");
│ File cacheFile = new File(this.gradleBuild.getProjectDir(), "build/aot-cache/application.aot");
│ assertThat(cacheFile).exists();
│ }
Expected behavior:
Copying should produce the clean source code without any extra characters, so the user can paste it directly into their workflow.
Possible cause:
The UI likely uses these vertical bars as visual guides or decorations (e.g., for line numbers or diff styling). These characters are not excluded from the copy event, so they end up in the clipboard.
Impact:
This affects usability and requires manual cleaning of every copied code snippet, which is frustrating for developers.
Proposed fix:
- Ensure that decorative characters are not included when text is copied. This can be achieved by intercepting the copy event and stripping the leading
│from the selected text before placing it on the clipboard, or by separating visual decorations from the actual code content so they are not selectable at all.
Thank you for maintaining jcode!
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
Reproduce the issue by copying a rendered code block in the jcode interface, then trace the interface's copy handling and rendering of the decorative │ characters. Done means copied snippets contain only the source code, without leading bars, and can be pasted directly into an editor, compiler, or terminal.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100