<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>256353</bug_id>
          
          <creation_ts>2010-11-08 11:33:35 +0000</creation_ts>
          <short_desc>Selecting text by triple click and scolling up causes only the visible contents to be selected</short_desc>
          <delta_ts>2012-04-20 05:40:48 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>konsole</product>
          <component>general</component>
          <version>2.5.999</version>
          <rep_platform>Mandriva RPMs</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Shlomi Fish">shlomif</reporter>
          <assigned_to name="Konsole Bugs">konsole-bugs-null</assigned_to>
          <cc>adaptee</cc>
    
    <cc>shlomif</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin>4.9.0</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1041672</commentid>
    <comment_count>0</comment_count>
    <who name="Shlomi Fish">shlomif</who>
    <bug_when>2010-11-08 11:33:35 +0000</bug_when>
    <thetext>Version:           2.5.999 (using Devel) 
OS:                Linux

When I line-wise-select the text of &quot;ls -lR / | head -1000&quot; (or any other long text) in Konsole (on Mandriva Linux Cooker from kdebase4-4.5.74-0.svn1190490.1mdv2011.0.src.rpm ) and start from the bottom and move upwards, then after the screen scrolls upwards, and I release the mouse button, then the section of the selection that is not visible is no longer selected and is not copied. Selecting a text downwards is working fine.

Reproducible: Always

Steps to Reproduce:
1. Type ls -lR / | head -1000

2. Do a triple click to select the last line in the output and hold the mouse button.

3. Move up with the mouse to the top of the screen to select more. Make sure the last lines are no longer visible.

4. Release the mouse.

5. Scroll downwards using the scrollbar.

Actual Results:  
The bottommost lines are not selected.

Expected Results:  
The bottommost lines should remain selected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1164888</commentid>
    <comment_count>1</comment_count>
    <who name="Jekyll Wu">adaptee</who>
    <bug_when>2011-09-20 12:56:16 +0000</bug_when>
    <thetext>Yes, I can reproduce it in 2.7.999. 

The important condition is starting selection by triple click in step 2.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1212345</commentid>
    <comment_count>2</comment_count>
      <attachid>67643</attachid>
    <who name="Shlomi Fish">shlomif</who>
    <bug_when>2012-01-10 08:58:11 +0000</bug_when>
    <thetext>Created attachment 67643
A tentative patch that seems to fix the problem here.

This is a tentative fix to this bug. It is tentative because it contains some code I added in order to debug this. Nevertheless, the fix is only in the src/ScreenWindow.cpp and is toggled by the &quot;#define BUG256353_FIX&quot;.

What happens there is that the original authors used qMin(...) to limit the code based on the current window&apos;s boundaries. Perhaps we need one qMin() and one qMax(), but, from my understanding, it could be that end &lt; start and so it&apos;s hard to know when to use each one. I simply removed the boundings and everything seems to be OK.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1214714</commentid>
    <comment_count>3</comment_count>
    <who name="Shlomi Fish">shlomif</who>
    <bug_when>2012-01-15 15:04:57 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Created an attachment (id=67643) [details]
&gt; A tentative patch that seems to fix the problem here.
&gt; 
&gt; This is a tentative fix to this bug. It is tentative because it contains some
&gt; code I added in order to debug this. Nevertheless, the fix is only in the
&gt; src/ScreenWindow.cpp and is toggled by the &quot;#define BUG256353_FIX&quot;.
&gt; 
&gt; What happens there is that the original authors used qMin(...) to limit the
&gt; code based on the current window&apos;s boundaries. Perhaps we need one qMin() and
&gt; one qMax(), but, from my understanding, it could be that end &lt; start and so
&gt; it&apos;s hard to know when to use each one. I simply removed the boundings and
&gt; everything seems to be OK.

Hi, since I didn&apos;t get any comment, should I put this patch on the KDE reviewboard (after cleaning it up)?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1214791</commentid>
    <comment_count>4</comment_count>
    <who name="Jekyll Wu">adaptee</who>
    <bug_when>2012-01-15 17:54:24 +0000</bug_when>
    <thetext>Sorry for no response. 

Yes, submitting patch to review board is always the preferred way.

As for the patch itself, I actually made similar analysis after posting comment #1, and I thought the first and real problem was why ScreenWindow::setSelectionStart() was ever called, which should not happen IMHO, to reset the start point of selection during scrolling up.  My little hack was setting &apos;swapping&apos; to false in force in the case of triple clicking and scrolling, and it seemed to work. Anyway, it was just hack and I didn&apos;t make further investigation.

In general, I feel the real problem is not in those setSelectionStart() methods themselves, but in how and when they are called. So changing the internal logic of those methods might be dangerous and cause new regressions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1215921</commentid>
    <comment_count>5</comment_count>
    <who name="Shlomi Fish">shlomif</who>
    <bug_when>2012-01-18 08:59:42 +0000</bug_when>
    <thetext>Hi Jekyll,

(In reply to comment #4)
&gt; Sorry for no response. 
&gt; 
&gt; Yes, submitting patch to review board is always the preferred way.
&gt; 
&gt; As for the patch itself, I actually made similar analysis after posting comment
&gt; #1, and I thought the first and real problem was why
&gt; ScreenWindow::setSelectionStart() was ever called, which should not happen
&gt; IMHO, to reset the start point of selection during scrolling up.  

I think it is called because the selection start/end are calculated based on the current scroll position and so it needs to be updated whenver the user scrolls the viewport (don&apos;t know why this design decision was made, but that&apos;s how it is.)

&gt; My little
&gt; hack was setting &apos;swapping&apos; to false in force in the case of triple clicking
&gt; and scrolling, and it seemed to work. Anyway, it was just hack and I didn&apos;t
&gt; make further investigation.
&gt; 
&gt; In general, I feel the real problem is not in those setSelectionStart() methods
&gt; themselves, but in how and when they are called. So changing the internal logic
&gt; of those methods might be dangerous and cause new regressions.

From my testing (which I admit was not very comprehensive), the scrolling and selection continued to work properly with this patch.

In any case, I&apos;ll submit this patch to the review board.

Regards,

-- Shlomi Fish</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1219874</commentid>
    <comment_count>6</comment_count>
    <who name="Kurt Hindenburg">khindenburg</who>
    <bug_when>2012-01-28 16:32:22 +0000</bug_when>
    <thetext>Git commit 6d9d49aafb358293326f4edca393c7f2dfc9602a by Kurt Hindenburg.
Committed on 28/01/2012 at 17:26.
Pushed by hindenburg into branch &apos;master&apos;.

Correct issue of triple clicking and scrolling up.

Fixes selecting text by triple click and scrolling up causes only the
visible contents to be selected.

Thanks to Shlomi Fish (shlomif@iglu.org.il) for research and patch.
REVIEW: 103724
FIXED-IN: 4.9

M  +2    -2    src/ScreenWindow.cpp

http://commits.kde.org/konsole/6d9d49aafb358293326f4edca393c7f2dfc9602a</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>67643</attachid>
            <date>2012-01-10 08:58:11 +0000</date>
            <delta_ts>2012-01-10 08:58:11 +0000</delta_ts>
            <desc>A tentative patch that seems to fix the problem here.</desc>
            <filename>konsole-bug-256353-tentative-fix.diff</filename>
            <type>text/plain</type>
            <size>3017</size>
            <attacher name="Shlomi Fish">shlomif</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL3NyYy9TY3JlZW4uY3BwIGIvc3JjL1NjcmVlbi5jcHAKaW5kZXggM2Q4OTQ0
Yy4uZTQxMzFhYyAxMDA2NDQKLS0tIGEvc3JjL1NjcmVlbi5jcHAKKysrIGIvc3JjL1NjcmVlbi5j
cHAKQEAgLTM1LDYgKzM1LDcgQEAKICNpbmNsdWRlIDxRdENvcmUvUVRleHRTdHJlYW0+CiAjaW5j
bHVkZSA8UXRDb3JlL1FEYXRlPgogCisjaW5jbHVkZSA8S0RlYnVnPgogLy8gS29uc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4dGVuZFNl
bGVjdGlvbihjb25zdCBRUG9pbnQmIHBvc2l0aW9uKQogICAgIGlmIChfY29sdW1uU2VsZWN0aW9u
TW9kZSAmJiAhX2xpbmVTZWxlY3Rpb25Nb2RlICYmICFfd29yZFNlbGVjdGlvbk1vZGUpIHsKICAg
ICAgICAgX3NjcmVlbldpbmRvdy0+c2V0U2VsZWN0aW9uRW5kKGhlcmUueCgpICwgaGVyZS55KCkp
OwogICAgIH0gZWxzZSB7CisgICAgICAgIC8vIFRPRE8gOiBEZWJ1ZyB0cmFjZSB0byByZW1vdmUu
CisgICAgICAgIGtEZWJ1ZygpIDw8ICJFbmQgc2V0IHRvICgiIDw8IChoZXJlLngoKSArIG9mZnNl
dCkgPDwgIiwiIDw8IGhlcmUueSgpIDw8ICIpIjsKICAgICAgICAgX3NjcmVlbldpbmRvdy0+c2V0
U2VsZWN0aW9uRW5kKGhlcmUueCgpICsgb2Zmc2V0ICwgaGVyZS55KCkpOwogICAgIH0KIAo=
</data>

          </attachment>
      

    </bug>

</bugzilla>