mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-03 21:24:46 +00:00
don't copy if selected text is null, fixes #390
This commit is contained in:
parent
e5af924a4a
commit
71ff8bc7aa
1 changed files with 5 additions and 3 deletions
|
@ -650,12 +650,14 @@ public final class RichInputConnection implements PrivateCommandPerformer {
|
||||||
CharSequence text = getSelectedText(InputConnection.GET_TEXT_WITH_STYLES);
|
CharSequence text = getSelectedText(InputConnection.GET_TEXT_WITH_STYLES);
|
||||||
if (text == null || text.length() == 0) {
|
if (text == null || text.length() == 0) {
|
||||||
// we have no selection, get the whole text
|
// we have no selection, get the whole text
|
||||||
ExtractedTextRequest etr = new ExtractedTextRequest();
|
final ExtractedTextRequest etr = new ExtractedTextRequest();
|
||||||
etr.flags = InputConnection.GET_TEXT_WITH_STYLES;
|
etr.flags = InputConnection.GET_TEXT_WITH_STYLES;
|
||||||
etr.hintMaxChars = Integer.MAX_VALUE;
|
etr.hintMaxChars = Integer.MAX_VALUE;
|
||||||
text = mIC.getExtractedText(etr, 0).text;
|
final ExtractedText et = mIC.getExtractedText(etr, 0);
|
||||||
|
if (et == null) return;
|
||||||
|
text = et.text;
|
||||||
}
|
}
|
||||||
if (text == null) return;
|
if (text == null || text.length() == 0) return;
|
||||||
final ClipboardManager cm = (ClipboardManager) mParent.getSystemService(Context.CLIPBOARD_SERVICE);
|
final ClipboardManager cm = (ClipboardManager) mParent.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
cm.setPrimaryClip(ClipData.newPlainText("copied text", text));
|
cm.setPrimaryClip(ClipData.newPlainText("copied text", text));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue