Skip to content
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

Improve pasting and copying of code block after select all #13271

Merged
merged 3 commits into from
Nov 27, 2024

Conversation

TCOTC
Copy link
Contributor

@TCOTC TCOTC commented Nov 25, 2024

@TCOTC
Copy link
Contributor Author

TCOTC commented Nov 25, 2024

有个问题我解决不了,在代码块内按 Ctrl+A 全选时,会比手动全选多选中一个换行符,此时粘贴文本会把这个换行符也替换掉,如果复制的文本末尾有空行的话再粘贴就会少一个空行:

image

image

video.webm

@TCOTC TCOTC marked this pull request as ready for review November 25, 2024 17:02
@TCOTC
Copy link
Contributor Author

TCOTC commented Nov 26, 2024

我感觉是要改 selection.ts,但我没看懂。

需要实现的效果是:

  • 在代码块内按 Ctrl+A 之后不选中末尾的那个换行符
  • 此时再按一次 Ctrl+A 应该全选文档中已加载的块

@88250 88250 requested a review from Vanessa219 November 26, 2024 03:52
@Vanessa219 Vanessa219 merged commit 595842f into siyuan-note:dev Nov 27, 2024
Vanessa219 added a commit that referenced this pull request Nov 27, 2024
@Vanessa219
Copy link
Member

再试一下看看。

@TCOTC
Copy link
Contributor Author

TCOTC commented Nov 27, 2024

.replace(/\n$/, "") 也解决不了这个问题,问题是出在 Ctrl+A 时多选中了代码块末尾的换行符

video.webm

@TCOTC TCOTC deleted the dev-code-1 branch November 27, 2024 04:03
Vanessa219 added a commit that referenced this pull request Nov 27, 2024
@Vanessa219
Copy link
Member

再试试。

@Vanessa219 Vanessa219 assigned TCOTC and unassigned TCOTC Nov 27, 2024
@Vanessa219 Vanessa219 added this to the 3.1.14 milestone Nov 27, 2024
@Vanessa219 Vanessa219 changed the title fix #13214 #13267 Improv pasting and copying of code block after select all Nov 27, 2024
@TCOTC
Copy link
Contributor Author

TCOTC commented Nov 27, 2024

确实可以了

@TCOTC TCOTC changed the title Improv pasting and copying of code block after select all Improve pasting and copying of code block after select all Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants