This repository has been archived by the owner on Jan 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
21 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,34 @@ | ||
## Godot-FilteredEdits | ||
|
||
Extends base nodes `LineEdit` and `TextEdit` with `FilteredLineEdit` and `FilteredTextEdit`, respectively, to filter user input. `FilteredLineEdit` also allows numeric text value clamping. | ||
Extends base nodes `LineEdit` and `TextEdit` with `FilteredLineEdit` and `FilteredTextEdit`, respectively, to filter user input. It also allows numeric text value clamping. | ||
|
||
If you download the full repository, you will get a small showcase project. | ||
|
||
--- | ||
|
||
Filter modes: | ||
- `none`: no filter. | ||
- `no-num`: no 0-9 characters. | ||
- `+0i`: positive or zero integer. | ||
- `i`: integer. | ||
- `+0f` positive or zero float. | ||
- `f` float. | ||
Features: | ||
- **Filtering**. Filters user input according to `filter_mode`. Filter modes: | ||
- `none`: no filter. | ||
- `no-num`: no 0-9 characters. | ||
- `+0i`: positive or zero integer. | ||
- `i`: integer. | ||
- `+0f` positive or zero float. | ||
- `f` float. | ||
- **Clamping**.`FilteredLineEdit.clamp_text`, `FilteredTextEdit.clamp_line`, `FilteredTextEdit.clamp_lines` to clamp values. | ||
- **Autocompletion**. If there is no text and you press `-`/`.` (in the right `filter_mode`) it will write `-0`/`0.` respectively. Similarly, if you delete `0` from `-0`/`0.` the `-`/`.` will also be deleted. | ||
|
||
Notes: | ||
- "." and "-" count as characters in max length. | ||
- `FilteredLineEdit` can clamp text numeric value when a numeric filter mode is selected, but `FilteredTextEdit` cannot (base class lacks of `text_submitted` signal). | ||
- I [requested](https://github.com/godotengine/godot-proposals/issues/7193) these features to be implemented in base Godot, that would require changing base node signals. Meanwhile, I created this workaround. | ||
- You might also find useful `LineEdit.virtual_keyboard_enabled` and `LineEdit.virtual_keyboard_type`. `TextEdit.virtual_keyboard_enabled` is there but `TextEdit.virtual_keyboard_type` is not (Godot 4.1), see [this](https://github.com/godotengine/godot-proposals/issues/7449). Also, consider that the user could use the physical keyboard to introduce undesired characters. | ||
- "." and "-" count as characters in `FilteredLineEdit.max_length`. | ||
- I [requested](https://github.com/godotengine/godot-proposals/issues/7193) filter features to be implemented in base Godot, that would require changing base node signals. Meanwhile, I created this workaround. | ||
|
||
#### Known issues | ||
|
||
- If you type very quickly in a numeric filter mode mixing numbers and letters, letters may pass the filtering. I think this is a limitation by how `LineEdit` and `TextEdit` handle input. | ||
- Won't fix issue [Limitation: select all text and press `-`/`.`](https://github.com/acgc99/Godot-FilteredEdits/issues/15#issue). | ||
- There are some bugs, check issues and open a new one if you find untracked bugs. | ||
|
||
--- | ||
|
||
### Assets | ||
|
||
All non-Godot icons has been downloaded form [Pictogrammers](https://pictogrammers.com/docs/general/license/). | ||
All non-Godot icons has been downloaded form [Pictogrammers](https://pictogrammers.com/docs/general/license/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[plugin] | ||
|
||
name="FilteredEdits" | ||
description="Extends base nodes LineEdit and TextEdit to filter user input." | ||
description="Extends base nodes `LineEdit` and `TextEdit` with `FilteredLineEdit` and `FilteredTextEdit`, respectively, to filter user input. It also allows numeric text value clamping." | ||
author="acgc99" | ||
version="1.0.3" | ||
version="2.0.0" | ||
script="filtered_edits.gd" |