diff --git a/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/PlatformTextField.desktop.kt b/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/PlatformTextField.desktop.kt index 41964b7d18..dc78f3efa4 100644 --- a/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/PlatformTextField.desktop.kt +++ b/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/PlatformTextField.desktop.kt @@ -83,12 +83,11 @@ actual fun PlatformTextField( lastTimeWasRtlByCharacters.value = isRtlByCharacters } val isLtrGlobally = LocalLayoutDirection.current == LayoutDirection.Ltr - // Different padding here is for a text that is considered RTL with non-RTL locale set globally. - // In this case padding from right side should be bigger - val startEndPadding = if (cs.message.text.isEmpty() && showVoiceButton && isRtlByCharacters && isLtrGlobally) 95.dp else 50.dp - val startPadding = if (isRtlByCharacters && isLtrGlobally) startEndPadding else 0.dp - val endPadding = if (isRtlByCharacters && isLtrGlobally) 0.dp else startEndPadding - val padding = PaddingValues(startPadding, 12.dp, endPadding, 0.dp) + // Reserve space on the same side as the send button (Alignment.BottomEnd in SendMsgView), + // i.e. the global layout-direction's end. RTL text in an LTR locale right-aligns onto that + // edge and would otherwise render under the send button. + val endPadding = if (cs.message.text.isEmpty() && showVoiceButton && isRtlByCharacters && isLtrGlobally) 95.dp else 50.dp + val padding = PaddingValues(0.dp, 12.dp, endPadding, 0.dp) var textFieldValueState by remember { mutableStateOf(TextFieldValue(text = cs.message.text, selection = cs.message.selection)) } val textFieldValue = textFieldValueState.copy(text = cs.message.text, selection = cs.message.selection) val clipboard = LocalClipboardManager.current @@ -116,7 +115,7 @@ actual fun PlatformTextField( autoCorrectEnabled = true ), modifier = Modifier - .padding(start = startPadding, end = endPadding) + .padding(end = endPadding) .offset(y = (-5).dp) .fillMaxWidth() .focusRequester(focusReq)