Skip to content

Commit

Permalink
fix: make mono when no language code
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Nov 29, 2023
1 parent d2efbf7 commit ff3433b
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
}

builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), (dialogInterface, i) -> {
String language = editText.getText().toString();
Editable editable = getText();
CharacterStyle[] spans = editable.getSpans(start, end, CharacterStyle.class);
if (spans != null && spans.length > 0) {
Expand All @@ -228,10 +229,14 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
run.flags |= TextStyleSpan.FLAG_STYLE_MONO;
run.start = start;
run.end = end;
run.urlEntity = new TLRPC.TL_messageEntityPre();
run.urlEntity.language = editText.getText().toString();
if (!language.isBlank()) {
run.urlEntity = new TLRPC.TL_messageEntityPre();
run.urlEntity.language = language;
}
MediaDataController.addStyleToText(new TextStyleSpan(run), start, end, getText(), allowTextEntitiesIntersection);
SyntaxHighlight.highlight(run, editable);
if (!language.isBlank()) {
SyntaxHighlight.highlight(run, editable);
}
} catch (Exception ignore) {

}
Expand Down

0 comments on commit ff3433b

Please sign in to comment.