aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChristian Walther <walther@indel.ch>2013-12-10 12:13:24 +0100
committerChristian Walther <walther@indel.ch>2013-12-10 12:13:24 +0100
commit02a63c68e90cfd14b5b11ede3185ea46f4e56850 (patch)
tree84f340ea13a41ab6d31cdd323c74192e9071fbdb
parente30f0412c5366a4da2aaa1e127eec5ab54379431 (diff)
downloadscintilla-mirror-02a63c68e90cfd14b5b11ede3185ea46f4e56850.tar.gz
Bug [#1562]. Clickable area of hotspots was off by half a character width.
-rw-r--r--src/Editor.cxx22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 36f85a92c..074668059 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -6329,6 +6329,8 @@ void Editor::ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifie
const bool alt = (modifiers & SCI_ALT) != 0;
SelectionPosition newPos = SPositionFromLocation(pt, false, false, AllowVirtualSpace(virtualSpaceOptions, alt));
newPos = MovePositionOutsideChar(newPos, sel.MainCaret() - newPos.Position());
+ SelectionPosition newCharPos = SPositionFromLocation(pt, false, true, false);
+ newCharPos = MovePositionOutsideChar(newCharPos, -1);
inDragDrop = ddNone;
sel.SetMoveExtends(false);
@@ -6419,8 +6421,8 @@ void Editor::ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifie
//Platform::DebugPrintf("Double click: %d - %d\n", anchor, currentPos);
if (doubleClick) {
NotifyDoubleClick(pt, modifiers);
- if (PositionIsHotspot(newPos.Position()))
- NotifyHotSpotDoubleClicked(newPos.Position(), modifiers);
+ if (PositionIsHotspot(newCharPos.Position()))
+ NotifyHotSpotDoubleClicked(newCharPos.Position(), modifiers);
}
} else { // Single click
if (inSelMargin) {
@@ -6449,8 +6451,8 @@ void Editor::ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifie
SetMouseCapture(true);
} else {
if (PointIsHotspot(pt)) {
- NotifyHotSpotClicked(newPos.Position(), modifiers);
- hotSpotClickPos = PositionFromLocation(pt,true,false);
+ NotifyHotSpotClicked(newCharPos.Position(), modifiers);
+ hotSpotClickPos = newCharPos.Position();
}
if (!shift) {
if (PointInSelection(pt) && !SelectionEmpty())
@@ -6503,7 +6505,7 @@ bool Editor::PositionIsHotspot(int position) const {
}
bool Editor::PointIsHotspot(Point pt) {
- int pos = PositionFromLocation(pt, true);
+ int pos = PositionFromLocation(pt, true, true);
if (pos == INVALID_POSITION)
return false;
return PositionIsHotspot(pos);
@@ -6511,7 +6513,7 @@ bool Editor::PointIsHotspot(Point pt) {
void Editor::SetHotSpotRange(Point *pt) {
if (pt) {
- int pos = PositionFromLocation(*pt);
+ int pos = PositionFromLocation(*pt, false, true);
// If we don't limit this to word characters then the
// range can encompass more than the run range and then
@@ -6631,10 +6633,10 @@ void Editor::ButtonMoveWithModifiers(Point pt, int modifiers) {
}
EnsureCaretVisible(false, false, true);
- if (hsStart != -1 && !PositionIsHotspot(movePos.Position()))
+ if (hsStart != -1 && !PointIsHotspot(pt))
SetHotSpotRange(NULL);
- if (hotSpotClickPos != INVALID_POSITION && PositionFromLocation(pt,true,false) != hotSpotClickPos) {
+ if (hotSpotClickPos != INVALID_POSITION && PositionFromLocation(pt,true,true) != hotSpotClickPos) {
if (inDragDrop == ddNone) {
DisplayCursor(Window::cursorText);
}
@@ -6679,7 +6681,9 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {
}
if (hotSpotClickPos != INVALID_POSITION && PointIsHotspot(pt)) {
hotSpotClickPos = INVALID_POSITION;
- NotifyHotSpotReleaseClick(newPos.Position(), ctrl ? SCI_CTRL : 0);
+ SelectionPosition newCharPos = SPositionFromLocation(pt, false, true, false);
+ newCharPos = MovePositionOutsideChar(newCharPos, -1);
+ NotifyHotSpotReleaseClick(newCharPos.Position(), ctrl ? SCI_CTRL : 0);
}
if (HaveMouseCapture()) {
if (PointInSelMargin(pt)) {