diff options
author | Neil <nyamatongwe@gmail.com> | 2017-04-22 20:24:24 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2017-04-22 20:24:24 +1000 |
commit | 1eeadce64ec9d786c1da10e98f188a3221b7373b (patch) | |
tree | 660f0b845a8c0b745cc1f021cc4291bb14c30f44 | |
parent | ce8991b3f3b156ada52871052cc856201e1474de (diff) | |
download | scintilla-mirror-1eeadce64ec9d786c1da10e98f188a3221b7373b.tar.gz |
Restrict cursor changing to visible bounds so the text area cursor doesn't show
over other views above and below ScintillaView.
-rw-r--r-- | cocoa/PlatCocoa.h | 2 | ||||
-rw-r--r-- | cocoa/PlatCocoa.mm | 2 | ||||
-rw-r--r-- | cocoa/ScintillaCocoa.h | 1 | ||||
-rw-r--r-- | cocoa/ScintillaCocoa.mm | 7 | ||||
-rw-r--r-- | cocoa/ScintillaView.mm | 3 |
5 files changed, 12 insertions, 3 deletions
diff --git a/cocoa/PlatCocoa.h b/cocoa/PlatCocoa.h index caac1d9fb..5d0789407 100644 --- a/cocoa/PlatCocoa.h +++ b/cocoa/PlatCocoa.h @@ -21,7 +21,7 @@ #include "QuartzTextLayout.h" -NSRect PRectangleToNSRect(Scintilla::PRectangle& rc); +NSRect PRectangleToNSRect(const Scintilla::PRectangle& rc); Scintilla::PRectangle NSRectToPRectangle(NSRect& rc); CFStringEncoding EncodingFromCharacterSet(bool unicode, int characterSet); diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index a0532efc3..5029947da 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -45,7 +45,7 @@ extern sptr_t scintilla_send_message(void* sci, unsigned int iMessage, uptr_t wP /** * Converts a PRectangle as used by Scintilla to standard Obj-C NSRect structure . */ -NSRect PRectangleToNSRect(PRectangle& rc) +NSRect PRectangleToNSRect(const PRectangle& rc) { return NSMakeRect(rc.left, rc.top, rc.Width(), rc.Height()); } diff --git a/cocoa/ScintillaCocoa.h b/cocoa/ScintillaCocoa.h index e894228e7..4b0b2eb1d 100644 --- a/cocoa/ScintillaCocoa.h +++ b/cocoa/ScintillaCocoa.h @@ -205,6 +205,7 @@ public: NSInteger VisibleLineForIndex(NSInteger index); NSRange RangeForVisibleLine(NSInteger lineVisible); NSRect FrameForRange(NSRange rangeCharacters); + NSRect GetBounds() const; void SelectOnlyMainSelection(); void ConvertSelectionVirtualSpace(); bool ClearAllSelections(); diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 354f22a98..9b5a3b0b6 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -1776,6 +1776,13 @@ NSRect ScintillaCocoa::FrameForRange(NSRange rangeCharacters) { //-------------------------------------------------------------------------------------------------- +// Returns a rectangle that frames the range for use by the VoiceOver cursor. +NSRect ScintillaCocoa::GetBounds() const { + return PRectangleToNSRect(GetClientRectangle()); +} + +//-------------------------------------------------------------------------------------------------- + // Translates a UTF8 string into the document encoding. // Return the length of the result in bytes. int ScintillaCocoa::EncodedFromUTF8(char *utf8, char *encoded) const diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index 1e85ab6e8..2e35a5492 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -301,7 +301,8 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) [super resetCursorRects]; // We only have one cursor rect: our bounds. - [self addCursorRect: [self bounds] cursor: mCurrentCursor]; + const NSRect visibleBounds = mOwner.backend->GetBounds(); + [self addCursorRect: visibleBounds cursor: mCurrentCursor]; [mCurrentCursor setOnMouseEntered: YES]; } |