mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Accessibility: Set caret position when passed an empty range selection in CodeEditorComponent and TextEditor AccessibilityTextInterface implementations
This commit is contained in:
parent
005d45e0fe
commit
a7f33da900
2 changed files with 14 additions and 1 deletions
|
|
@ -2718,7 +2718,14 @@ private:
|
|||
|
||||
int getTotalNumCharacters() const override { return textEditor.getText().length(); }
|
||||
Range<int> getSelection() const override { return textEditor.getHighlightedRegion(); }
|
||||
void setSelection (Range<int> r) override { textEditor.setHighlightedRegion (r); }
|
||||
|
||||
void setSelection (Range<int> r) override
|
||||
{
|
||||
if (r.isEmpty())
|
||||
textEditor.setCaretPosition (r.getStart());
|
||||
else
|
||||
textEditor.setHighlightedRegion (r);
|
||||
}
|
||||
|
||||
String getText (Range<int> r) const override
|
||||
{
|
||||
|
|
|
|||
|
|
@ -71,6 +71,12 @@ private:
|
|||
|
||||
void setSelection (Range<int> r) override
|
||||
{
|
||||
if (r.isEmpty())
|
||||
{
|
||||
codeEditorComponent.caretPos.setPosition (r.getStart());
|
||||
return;
|
||||
}
|
||||
|
||||
auto& doc = codeEditorComponent.document;
|
||||
|
||||
codeEditorComponent.selectRegion (CodeDocument::Position (doc, r.getStart()),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue