| 4858 | } |
| 4859 | |
| 4860 | void Editor::ButtonUpWithModifiers(Point pt, unsigned int curTime, int modifiers) { |
| 4861 | //Platform::DebugPrintf("ButtonUp %d %d\n", HaveMouseCapture(), inDragDrop); |
| 4862 | SelectionPosition newPos = SPositionFromLocation(pt, false, false, |
| 4863 | AllowVirtualSpace(virtualSpaceOptions, sel.IsRectangular())); |
| 4864 | if (hoverIndicatorPos != INVALID_POSITION) |
| 4865 | InvalidateRange(newPos.Position(), newPos.Position() + 1); |
| 4866 | newPos = MovePositionOutsideChar(newPos, sel.MainCaret() - newPos.Position()); |
| 4867 | if (inDragDrop == ddInitial) { |
| 4868 | inDragDrop = ddNone; |
| 4869 | SetEmptySelection(newPos); |
| 4870 | selectionType = selChar; |
| 4871 | originalAnchorPos = sel.MainCaret(); |
| 4872 | } |
| 4873 | if (hotSpotClickPos != INVALID_POSITION && PointIsHotspot(pt)) { |
| 4874 | hotSpotClickPos = INVALID_POSITION; |
| 4875 | SelectionPosition newCharPos = SPositionFromLocation(pt, false, true, false); |
| 4876 | newCharPos = MovePositionOutsideChar(newCharPos, -1); |
| 4877 | NotifyHotSpotReleaseClick(newCharPos.Position(), modifiers & SCI_CTRL); |
| 4878 | } |
| 4879 | if (HaveMouseCapture()) { |
| 4880 | if (PointInSelMargin(pt)) { |
| 4881 | DisplayCursor(GetMarginCursor(pt)); |
| 4882 | } else { |
| 4883 | DisplayCursor(Window::cursorText); |
| 4884 | SetHotSpotRange(nullptr); |
| 4885 | } |
| 4886 | ptMouseLast = pt; |
| 4887 | SetMouseCapture(false); |
| 4888 | FineTickerCancel(tickScroll); |
| 4889 | NotifyIndicatorClick(false, newPos.Position(), 0); |
| 4890 | if (inDragDrop == ddDragging) { |
| 4891 | const SelectionPosition selStart = SelectionStart(); |
| 4892 | const SelectionPosition selEnd = SelectionEnd(); |
| 4893 | if (selStart < selEnd) { |
| 4894 | if (drag.Length()) { |
| 4895 | const Sci::Position length = drag.Length(); |
| 4896 | if (modifiers & SCI_CTRL) { |
| 4897 | const Sci::Position lengthInserted = pdoc->InsertString( |
| 4898 | newPos.Position(), drag.Data(), length); |
| 4899 | if (lengthInserted > 0) { |
| 4900 | SetSelection(newPos.Position(), newPos.Position() + lengthInserted); |
| 4901 | } |
| 4902 | } else if (newPos < selStart) { |
| 4903 | pdoc->DeleteChars(selStart.Position(), drag.Length()); |
| 4904 | const Sci::Position lengthInserted = pdoc->InsertString( |
| 4905 | newPos.Position(), drag.Data(), length); |
| 4906 | if (lengthInserted > 0) { |
| 4907 | SetSelection(newPos.Position(), newPos.Position() + lengthInserted); |
| 4908 | } |
| 4909 | } else if (newPos > selEnd) { |
| 4910 | pdoc->DeleteChars(selStart.Position(), drag.Length()); |
| 4911 | newPos.Add(-static_cast<Sci::Position>(drag.Length())); |
| 4912 | const Sci::Position lengthInserted = pdoc->InsertString( |
| 4913 | newPos.Position(), drag.Data(), length); |
| 4914 | if (lengthInserted > 0) { |
| 4915 | SetSelection(newPos.Position(), newPos.Position() + lengthInserted); |
| 4916 | } |
| 4917 | } else { |
no test coverage detected