Pressing esc closes (un)commited changes filter
This commit is contained in:
parent
9dfd5073bd
commit
3ee8163e2d
@ -160,6 +160,7 @@ fun CommitChangesView(
|
|||||||
searchFilter = searchFilter,
|
searchFilter = searchFilter,
|
||||||
onSearchFilterChanged = onSearchFilterChanged,
|
onSearchFilterChanged = onSearchFilterChanged,
|
||||||
searchFocusRequester = searchFocusRequester,
|
searchFocusRequester = searchFocusRequester,
|
||||||
|
onClose = { onSearchFilterToggled(false) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -663,6 +663,7 @@ private fun EntriesList(
|
|||||||
searchFilter = searchFilter,
|
searchFilter = searchFilter,
|
||||||
onSearchFilterChanged = onSearchFilterChanged,
|
onSearchFilterChanged = onSearchFilterChanged,
|
||||||
searchFocusRequester = searchFocusRequester,
|
searchFocusRequester = searchFocusRequester,
|
||||||
|
onClose = { onSearchFilterToggled(false) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,19 +10,32 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.focus.FocusRequester
|
import androidx.compose.ui.focus.FocusRequester
|
||||||
import androidx.compose.ui.focus.focusRequester
|
import androidx.compose.ui.focus.focusRequester
|
||||||
|
import androidx.compose.ui.input.key.KeyEventType
|
||||||
|
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||||
|
import androidx.compose.ui.input.key.type
|
||||||
import androidx.compose.ui.text.input.TextFieldValue
|
import androidx.compose.ui.text.input.TextFieldValue
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.jetpackduba.gitnuro.keybindings.KeybindingOption
|
||||||
|
import com.jetpackduba.gitnuro.keybindings.matchesBinding
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SearchTextField(
|
fun SearchTextField(
|
||||||
searchFilter: TextFieldValue,
|
searchFilter: TextFieldValue,
|
||||||
onSearchFilterChanged: (TextFieldValue) -> Unit,
|
onSearchFilterChanged: (TextFieldValue) -> Unit,
|
||||||
searchFocusRequester: FocusRequester,
|
searchFocusRequester: FocusRequester,
|
||||||
|
onClose: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.background(MaterialTheme.colors.background)
|
.background(MaterialTheme.colors.background)
|
||||||
.padding(horizontal = 4.dp, vertical = 4.dp)
|
.padding(horizontal = 4.dp, vertical = 4.dp)
|
||||||
|
.onPreviewKeyEvent { keyEvent ->
|
||||||
|
if (keyEvent.matchesBinding(KeybindingOption.EXIT) && keyEvent.type == KeyEventType.KeyDown) {
|
||||||
|
onClose()
|
||||||
|
true
|
||||||
|
} else
|
||||||
|
false
|
||||||
|
},
|
||||||
) {
|
) {
|
||||||
AdjustableOutlinedTextField(
|
AdjustableOutlinedTextField(
|
||||||
value = searchFilter,
|
value = searchFilter,
|
||||||
|
Loading…
Reference in New Issue
Block a user