Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -485,14 +485,24 @@ fun AddEditHostScreen(
value = hostname,
onValueChange = { hostname = it },
label = { Text("Hostname") },
keyboardOptions =
KeyboardOptions(
keyboardType = KeyboardType.Uri,
autoCorrectEnabled = false,
),
singleLine = true,
modifier = Modifier.fillMaxWidth()
)
// Without a declared content type a password manager sees an unlabelled field and offers
// nothing. Username here and Password below give it the pair it needs.
OutlinedTextField(
value = username,
onValueChange = { username = it },
label = { Text("Username") },
keyboardOptions =
KeyboardOptions(
keyboardType = KeyboardType.PasswordVisible,
autoCorrectEnabled = false,
),
singleLine = true,
modifier = Modifier
.fillMaxWidth()
.semantics { contentType = ContentType.Username },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,12 @@ private fun ImportEntryCard(
value = state.hostNameOverride,
onValueChange = { state.hostNameOverride = it },
label = { Text("Hostname") },
keyboardOptions =
KeyboardOptions(
keyboardType = KeyboardType.Uri,
autoCorrectEnabled = false,
),
singleLine = true,
modifier = Modifier.fillMaxWidth()
)
OutlinedTextField(
Expand All @@ -389,6 +395,12 @@ private fun ImportEntryCard(
value = state.usernameOverride,
onValueChange = { state.usernameOverride = it },
label = { Text("Username") },
keyboardOptions =
KeyboardOptions(
keyboardType = KeyboardType.PasswordVisible,
autoCorrectEnabled = false,
),
singleLine = true,
modifier = Modifier.fillMaxWidth()
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.text.input.KeyboardType
import com.termux.terminal.KeyHandler
import androidx.compose.ui.input.key.KeyEvent as ComposeKeyEvent

Expand All @@ -54,9 +55,10 @@ private const val PLACEHOLDER = " "
* previous session.
*
* The buffer holds the current line until Enter so the IME can revise it, which also means the IME
* sees that line, including a password typed at a no-echo prompt. Compose cannot request
* no-suggestions or no-personalised-learning without also disabling the autocorrect this exists
* for, so that exposure is accepted.
* sees that line, including a password typed at a no-echo prompt. The field uses
* [KeyboardType.PasswordVisible] so the IME neither offers suggestions nor learns from that text;
* the text stays unmasked (Compose masks only through a visual transformation) and the capture
* logic below is unaffected.
*/
@Composable
fun TerminalInputCapture(
Expand Down Expand Up @@ -111,6 +113,8 @@ fun TerminalInputCapture(
KeyboardOptions(
autoCorrectEnabled = false,
capitalization = KeyboardCapitalization.None,
// Prevent keyboard from autocorrect/suggestions
keyboardType = KeyboardType.PasswordVisible,
),
)
}
Expand Down