Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/npp/NppInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,11 @@ std::optional<TextPosition> NppInterface::char_position_from_global_point(int x,
if (WindowFromPoint(p) != hwnd)
return std::nullopt;
ScreenToClient(hwnd, &p);
return send_msg_to_scintilla(SCI_CHARPOSITIONFROMPOINTCLOSE, p.x, p.y);
const auto result = send_msg_to_scintilla(SCI_CHARPOSITIONFROMPOINTCLOSE, p.x, p.y);
if (result < 0) { // -1 is returned if the point is outside the window or not close to any characters
return std::nullopt;
}
return result;
}

TextPosition NppInterface::char_position_from_point(const POINT &pnt) const {
Expand Down