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

feat: 终端设置增加在双击选中区域包含特殊符号选项 #273

Merged
merged 1 commit into from Apr 17, 2023

Conversation

liwl1991
Copy link
Contributor

@liwl1991 liwl1991 commented Apr 15, 2023

Description: 当前终端版本特性仅用部分符号作为长字符串的分隔符号且无法调整,无法应对用户在使用双击复制选中文本时灵活的使用场景。本次提交提供在终端设置选项里面自定义双击选中时分隔符。

Log: 终端设置增加在双击选中区域包含特殊符号选项

效果如下:
image

Copy link
Contributor

@ArchieMeng ArchieMeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不错不错,非常实用的功能,而且实现起来需要了解的相关qtermwidget内容也挺多的。(我Review了一会,才搞懂这个选中区域规则是怎么实现的)

不过有个小Bug: 在我这里,刚启动的时候还是会加载默认的全特殊分隔符规则,需要在termwidget里初始化一下。
另外,我觉得做成选中部分允许包含的特殊符号似乎会更合理一些。有以下好处:

  • 符合QTermWidget中的实现逻辑。因为它判定是否应该被选中的时候,会判断_wordCharacters中有没有。所以,实现上直接用自定义的值 setWordCharacters 就实现了,不需要从所有的特殊符号中去除分隔符。
  • 当前deepin-terminal默认的选中区域分割符是比较多的。(除 :@-./_~ 以外的特殊符号都是分割符)所以,一般情况是我选中的内容被无情分割,如果是删除分隔符的花会比较眼花缭乱,但如果是添加选中区域可包含的特殊符号的话,就会相对容易且直观些。

我觉得可以讨论一下这样。Konsole就是这个实现逻辑的,你可以装下体验一下。

3rdparty/terminalwidget/lib/TerminalDisplay.cpp Outdated Show resolved Hide resolved
src/assets/other/default-config.json Outdated Show resolved Hide resolved
translations/deepin-terminal_zh_HK.ts Outdated Show resolved Hide resolved
translations/deepin-terminal_zh_TW.ts Outdated Show resolved Hide resolved
src/views/termwidget.cpp Show resolved Hide resolved
@liwl1991 liwl1991 force-pushed the master branch 2 times, most recently from 972e0ea to 12c91ff Compare April 15, 2023 08:37
@liwl1991 liwl1991 changed the title feat: 终端设置增加双击选中时设置分隔符号 feat: 终端设置选项增加自定义双击选中时可选中的特殊符号功能 Apr 15, 2023
@liwl1991
Copy link
Contributor Author

已完成,请复审 @ArchieMeng
后续会将修改提交到上游 @BLumia

Copy link
Contributor

@ArchieMeng ArchieMeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

再优化下就可以合了.主要还是确定文案,现在实现和最开始不一样了,需要修改.

src/views/termwidget.cpp Outdated Show resolved Hide resolved
src/views/termwidget.h Outdated Show resolved Hide resolved
src/assets/other/default-config.json Outdated Show resolved Hide resolved
src/settings/settings_translation.cpp Outdated Show resolved Hide resolved
@github-actions
Copy link

github-actions bot commented Apr 17, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@ArchieMeng
Copy link
Contributor

不好意思,翻车了,我得看看.

Description: 本次提交提供在终端设置选项里面,自定义双击选中区域包含特殊符号的功能。

Log: 终端设置增加在双击选中区域包含特殊符号选项
Copy link
Contributor

@ArchieMeng ArchieMeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@ArchieMeng ArchieMeng merged commit e27b3df into linuxdeepin:master Apr 17, 2023
15 checks passed
@liwl1991 liwl1991 changed the title feat: 终端设置选项增加自定义双击选中时可选中的特殊符号功能 feat: 终端设置增加在双击选中区域包含特殊符号选项 Apr 17, 2023
@luodeepin
Copy link

验证通过
终端 6.0.6
截图_选择区域_20230804132409

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.

None yet

4 participants