D6086: Left-click mini-map to jump to clicked area

2017-06-07 Thread Kevin Funk
kfunk added a comment.


  Works perfectly fine for me now, great! I don't see anything wrong with it 
now from a behavioral point of view.
  
  @dhaumann Maybe you want to check once more?

REPOSITORY
  R39 KTextEditor

REVISION DETAIL
  https://phabricator.kde.org/D6086

To: sars, #ktexteditor, #kate, dhaumann, kfunk
Cc: kfunk, broulik, kwrite-devel, #frameworks


D6086: Left-click mini-map to jump to clicked area

2017-06-06 Thread Kåre Särs
sars added a comment.


  I think I fixed it. 
  The comment about the dragging was only partially correct. The press must be 
inside the slider for dragging, so when the initial press is outside or not 
translated from the mini-map coordinates, the dragging does not start.
  
  My solution is to first move to the desired place then forward the translated 
click to the QScrollBar.

REPOSITORY
  R39 KTextEditor

REVISION DETAIL
  https://phabricator.kde.org/D6086

To: sars, #ktexteditor, #kate, dhaumann, kfunk
Cc: kfunk, broulik, kwrite-devel, #frameworks


D6086: Left-click mini-map to jump to clicked area

2017-06-06 Thread Dominik Haumann
dhaumann added a comment.


  Hi, I'm sorry I am a bit late to the game: I once also tried to implement 
this, but the result was a messy patch that did not always get the location 
right. So I would not be surprised if there are corner cases that do not work.
  In any case, either we stabilize this until the next tag (afaik, the last tag 
was 5 days ago?), or we need to revert.
  
  But also: Cool that you are working on this!

REPOSITORY
  R39 KTextEditor

REVISION DETAIL
  https://phabricator.kde.org/D6086

To: sars, #ktexteditor, #kate, dhaumann, kfunk
Cc: kfunk, broulik, kwrite-devel, #frameworks


D6086: Left-click mini-map to jump to clicked area

2017-06-06 Thread Kevin Funk
kfunk added a comment.


  There are a couple of problems with the new behavior -- though I can't tell 
precisely when they're caused. And not sure they're new or not either.
  
  Things I'm seeing while mini map is enabled, only in some documents though:
  
  - When the slider is position at the bottom: clicking repeatedly on the same 
position causes flickering in the view port of the editor
  - Sometimes the scroll bar preview is shown while dragging the slider -- we 
should probably disable it while dragging altogether
  - Sometimes the slider is 'jumpy', when e.g. moving the slider from bottom to 
top. The jump distance is the size of the "slider" height.
  - Sometimes just fails to drag completely, or stops moving the slider in the 
middle of the drag move.
  
  Might wanna have another look?

REPOSITORY
  R39 KTextEditor

REVISION DETAIL
  https://phabricator.kde.org/D6086

To: sars, #ktexteditor, #kate, dhaumann, kfunk
Cc: kfunk, broulik, kwrite-devel, #frameworks


D6086: Left-click mini-map to jump to clicked area

2017-06-05 Thread Kåre Särs
This revision was automatically updated to reflect the committed changes.
Closed by commit R39:7bb1f434afaf: Jump to the clicked scrollbar position when 
minim-map is enabled. (authored by sars).

REPOSITORY
  R39 KTextEditor

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D6086?vs=15180=15182

REVISION DETAIL
  https://phabricator.kde.org/D6086

AFFECTED FILES
  src/view/kateviewhelpers.cpp
  src/view/kateviewhelpers.h

To: sars, #ktexteditor, #kate, dhaumann, kfunk
Cc: kfunk, broulik, kwrite-devel, #frameworks


D6086: Left-click mini-map to jump to clicked area

2017-06-05 Thread Kåre Särs
sars updated this revision to Diff 15180.
sars added a comment.


  Use qBound() + remove one set of unneeded parenthesis

REPOSITORY
  R39 KTextEditor

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D6086?vs=15128=15180

REVISION DETAIL
  https://phabricator.kde.org/D6086

AFFECTED FILES
  src/view/kateviewhelpers.cpp
  src/view/kateviewhelpers.h

To: sars, #ktexteditor, #kate, dhaumann, kfunk
Cc: kfunk, broulik, kwrite-devel, #frameworks


D6086: Left-click mini-map to jump to clicked area

2017-06-04 Thread Kevin Funk
kfunk accepted this revision.
kfunk added a comment.
This revision is now accepted and ready to land.


  +1 on the behavior change, this is a much desired change :)

INLINE COMMENTS

> kateviewhelpers.cpp:204
> +if (m_leftMouseDown) {
> +int newVal = ((e->pos().y()-m_mapGroveRect.top()) / 
> (double)m_mapGroveRect.height()) * (double)(maximum()+pageStep()) - 
> pageStep()/2;
> +if (newVal < 0) newVal = 0;

Style: `((a - b)) / ...`

> kateviewhelpers.cpp:205
> +int newVal = ((e->pos().y()-m_mapGroveRect.top()) / 
> (double)m_mapGroveRect.height()) * (double)(maximum()+pageStep()) - 
> pageStep()/2;
> +if (newVal < 0) newVal = 0;
> +if (newVal > maximum()) newVal = maximum();

Use `qBound(...)`?

REPOSITORY
  R39 KTextEditor

REVISION DETAIL
  https://phabricator.kde.org/D6086

To: sars, #ktexteditor, #kate, dhaumann, kfunk
Cc: kfunk, broulik, kwrite-devel, #frameworks


D6086: Left-click mini-map to jump to clicked area

2017-06-04 Thread Kai Uwe Broulik
broulik added a comment.


  Fair enough, +1

REPOSITORY
  R39 KTextEditor

REVISION DETAIL
  https://phabricator.kde.org/D6086

To: sars, #ktexteditor, #kate, dhaumann
Cc: broulik, kwrite-devel, #frameworks


D6086: Left-click mini-map to jump to clicked area

2017-06-04 Thread Kåre Särs
sars added a comment.


  Reasoning behind the change of behavior:
  
  - With mini-map it is seems a bit more logical to jump to the clicked place 
in stead of "searching your way there". (You already know where you want to go).
  - Page Up/Down and mouse scroll can still be used.
  - The middle click action is not very well known.
  - On Windows middle-click does nothing.
  - At least VisualStudio and Sublime does it like this.

REPOSITORY
  R39 KTextEditor

REVISION DETAIL
  https://phabricator.kde.org/D6086

To: sars, #ktexteditor, #kate, dhaumann
Cc: broulik, kwrite-devel, #frameworks


D6086: Left-click mini-map to jump to clicked area

2017-06-04 Thread Kai Uwe Broulik
broulik added a comment.


  Shouldn't left click scroll up and down a bit with middle click jumping to 
position - that's the behavior of Qt's scroll bars.

REPOSITORY
  R39 KTextEditor

REVISION DETAIL
  https://phabricator.kde.org/D6086

To: sars, #ktexteditor, #kate, dhaumann
Cc: broulik, kwrite-devel, #frameworks


D6086: Left-click mini-map to jump to clicked area

2017-06-04 Thread Kåre Särs
sars created this revision.
Restricted Application added subscribers: Frameworks, kwrite-devel.
Restricted Application added a project: Frameworks.

REVISION SUMMARY
  This patch implements the jump to clicked position in "show-minimap" mode for 
the scrollbar.

REPOSITORY
  R39 KTextEditor

REVISION DETAIL
  https://phabricator.kde.org/D6086

AFFECTED FILES
  src/view/kateviewhelpers.cpp
  src/view/kateviewhelpers.h

To: sars, #ktexteditor, #kate, dhaumann
Cc: kwrite-devel, #frameworks