mirror of
https://github.com/1j01/textual-paint.git
synced 2024-11-24 00:35:03 +03:00
Prevent focusing character input when closing dialogs
This commit is contained in:
parent
45b28f142f
commit
d61de649a6
@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Changed
|
||||
|
||||
- Plain text files (`.txt`) are now saved with CRLF line endings on Windows.
|
||||
- When closing dialogs, the character input no longer becomes focused.
|
||||
|
||||
### Fixed
|
||||
|
||||
|
@ -216,7 +216,6 @@ To preview ANSI art files in file managers like Nautilus, Thunar, Nemo, or Caja,
|
||||
### Misc
|
||||
- Extraneous undo states may be created in some cases. In particular, I noticed when undoing/redoing with free-typing mode, the last state had no cursor but was otherwise identical.
|
||||
- Document recovery dialog is shown unnecessarily if the backup file is identical.
|
||||
- Closing dialogs focuses the character input which is undesirable as it prevents typing in the canvas or copying the selection with <kbd>Ctrl</kbd>+<kbd>C</kbd> etc. (You can use <kbd>Esc</kbd> to reset focus.)
|
||||
- Pressing a key to exit View Bitmap mode may cause unwanted side effects.
|
||||
- Pressing a key doesn't exit View Bitmap mode if the character input is focused.
|
||||
|
||||
|
@ -395,6 +395,8 @@ class Window(Container):
|
||||
|
||||
def close(self) -> None:
|
||||
"""Force close the window."""
|
||||
# Before removing from the DOM, unfocus, because otherwise Textual will try to focus a widget "nearby" in the focus order, in `_reset_focus`.
|
||||
self.app.set_focus(None)
|
||||
self.remove()
|
||||
self.post_message(self.Closed())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user