File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ class IntegerInput(Widget):
2828 name (Optional[str]): The unique name of the widget. If None, the
2929 widget will be automatically named.
3030 value (Optional[int]): The starting integer value.
31- placeholder (Union[str, int, optional): Defaults to "". Text that
31+ placeholder (Union[str, int] , optional): Defaults to "". Text that
3232 appears in the widget when value is "" and the widget is not focused.
3333 title (str, optional): Defaults to "". A title on the top left
3434 of the widget's border.
@@ -268,11 +268,13 @@ async def on_key(self, event: events.Key) -> None:
268268 self .value = int (value [:- 1 ])
269269 self ._cursor_position -= 1
270270 else :
271- self . value = int (
271+ new_value = (
272272 value [: self ._cursor_position - 1 ]
273273 + value [self ._cursor_position :]
274274 )
275- self ._cursor_position -= 1
275+ if new_value != "" :
276+ self .value = int (new_value )
277+ self ._cursor_position -= 1
276278
277279 await self ._emit_on_change (event )
278280
You can’t perform that action at this time.
0 commit comments