Skip to content

Commit

Permalink
Clear segment on backspace
Browse files Browse the repository at this point in the history
  • Loading branch information
Jupi007 committed Jan 30, 2024
1 parent d8373bb commit c8297d7
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions lib/src/widgets/yaru_segmented_entry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,8 @@ class _YaruSegmentedEntryState extends State<YaruSegmentedEntry> {
_selectedSegment.onDownArrowKey!();
} else if (backspace) {
if (_selectedSegment.input != null) {
_selectedSegment.input = _selectedSegment.input!.dropLastCharacter;
if (_selectedSegment.input == null) {
ltr
? _controller.maybeSelectPreviousSegment()
: _controller.maybeSelectNextSegment();
}
} else {
_selectedSegment.input = null;
} else if (_selectedSegment.input == null) {
ltr
? _controller.maybeSelectPreviousSegment()
: _controller.maybeSelectNextSegment();
Expand Down Expand Up @@ -664,8 +659,4 @@ extension _StringX on String {
String getNbFirstCharacter(int count) {
return length > count ? substring(0, count) : this;
}

String get dropLastCharacter {
return substring(0, length - 1);
}
}

0 comments on commit c8297d7

Please sign in to comment.