Fix double click can only select text within visible region
ClosedPublic

Authored by pavelkh on Oct 12 2018, 3:57 PM.

Details

Summary

This is a reimplemented 914067d14a6a27b59bba1c53cc18cb67eb9811fc (hinted by @cfeck), plus a refactoring of TerminalDisplay::findWordStart()

findWordStart() had bounds check issues and an off-by-one for the case when the acquired region was more than two screens down.

TerminalDisplay::findWordEnd() is very similarly implemented, but I haven't found a case where it fails, so I haven't touched it.

Since 914067d14a6a27b59bba1c53cc18cb67eb9811fc caused a revert, I've tested the changes thoroughly (the cases are in the Test Plan below).

BUG: 399109

Test Plan

Corner cases tested (everything was run under valgrind, since I had no crashes without it pre - f98c752bce9fa11f1e81cf6ef8c02b3c3861c341):

  • At the end of the word, current Konsole doesn't select "@" at the end of the word when double-clicking, but selects it when the mouse is moved. With the introduced changes the behavior is to consistently ignore the last "@" character.
  • When 10K lines buffer is underfilled, dragged doubleclick+scrolled up by dragging the mouse above the terminal (this generates valgrind warnings on 5a31b4af6ddaba36866d092cb169faec3ca2cef1 that might have caused Konsole to crash)
  • Same with overfilled 10K lines buffer.
  • With decreased window size and some chars hidden, dblclick and drag up and down to the end of the buffer. The ends of the string are trimmed (like in current console), the rest of the string is properly selected.
  • With increased window size and padded chars, prod the buffer limits. Long lines are broken into separate lines -- no difference vs current Konsole.

Diff Detail

Repository
R319 Konsole
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
pavelkh created this revision.Oct 12 2018, 3:57 PM
Restricted Application added a project: Konsole. · View Herald TranscriptOct 12 2018, 3:57 PM
Restricted Application added a subscriber: konsole-devel. · View Herald Transcript
pavelkh requested review of this revision.Oct 12 2018, 3:57 PM
ngraham edited the summary of this revision. (Show Details)Oct 12 2018, 4:45 PM

Thanks for working at this - let me do some basic testing

hindenburg accepted this revision.Oct 22 2018, 3:06 AM
This revision is now accepted and ready to land.Oct 22 2018, 3:06 AM
hindenburg requested changes to this revision.Oct 22 2018, 3:23 AM

What's your email address so I can contribute the patch to you?

This revision now requires changes to proceed.Oct 22 2018, 3:23 AM

@hindenburg it's pas.anddev@gmail.com.

hindenburg accepted this revision.Oct 22 2018, 2:33 PM
This revision is now accepted and ready to land.Oct 22 2018, 2:33 PM
This revision was automatically updated to reflect the committed changes.