Commit graph

218 commits

Author SHA1 Message Date
Rémi Verschelde
32f5bee985
LineEdit: Respect max_length by truncating text to append
When appending text (either via `set_text()` or by pasting from clipboard),
if the input would make the `LineEdit` exceed its configured `max_length`,
the input text is truncated to fit. The discard part is passed as a parameter
in the `text_change_rejected` signal.

Fixes #33321.
Fixes #41278.

Also cleaned up unimplemented `max_chars` property in `TextEdit`.

Co-authored-by: Tony-Goat <70238376+Tony-Goat@users.noreply.github.com>
(cherry picked from commit 9a1ce8e6c3)
2021-07-13 10:20:02 +02:00
kobewi
cb5870dd4a
Display arrow cursor if text is not editable
(cherry picked from commit c3967c80ab)
2021-05-09 17:50:06 +02:00
Rémi Verschelde
140350d767
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2021-05-05 15:02:01 +02:00
Rémi Verschelde
a828398655
Style: Replaces uses of 0/NULL by nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2021-05-04 16:30:23 +02:00
Rémi Verschelde
b5e1e05ef2
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Rémi Verschelde
3d15f04668
Style: clang-format: Disable AllowShortIfStatementsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde
d252ef4c5e
Merge pull request #46527 from kuruk-mm/3_2_lineedit 2021-04-29 13:32:33 +02:00
ray90514
ea8004052d
Fix LineEdit undo behaves strangely
(cherry picked from commit 7501c7f48a)
2021-04-26 12:20:28 +02:00
Mateo Kuruk Miccino
74b3021691 LineEdit: Now double click to select a word, and triple click to select all the content 2021-02-28 17:41:11 -03:00
kobewi
7ede2f36fe
Allow to override drop data in LineEdit
(cherry picked from commit a3a31591b5)
2021-01-26 17:24:55 +01:00
Sergey Minakov
7b8d6d2413 [GUI] Enforce virtual keyboard redisplay on clear 2021-01-26 13:18:14 +03:00
Rémi Verschelde
49646383f1
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Rémi Verschelde
5c80c94449
Revert "solved ctrl + alt + special character Issue #6851"
(cherry picked from commit 8b7f582f22)
2021-01-05 21:33:33 +01:00
Tomasz Chabora
0c50509326
Update clear button when clicked
(cherry picked from commit 836b78f329)
2020-11-26 09:38:47 +01:00
PouleyKetchoupp
9b64646bc3
Expose LineEdit scroll offset to scripts
(cherry picked from commit 4775db1600)
2020-11-11 15:44:18 +01:00
HellonLegs
9340385731
LineEdit/TextEdit: solved control + alt issue
(cherry picked from commit f412237f38)
2020-09-24 14:43:08 +02:00
PouleyKetchoupp
c21d14fe69
Fix LineEdit not consuming enter events
LineEdit should not return early when processing KEY_ENTER, so it can
consume the event properly.

Regression introduced by mistake while fixing enter events for Android
(PR #40487 - c0b394572f)

(cherry picked from commit 5c63dec36e)
2020-09-08 13:38:58 +02:00
Rémi Verschelde
8a66ea7cb0
Revert "Updated LineEdit to address #41278"
This reverts commit 1b6d116dfb.
2020-09-01 14:01:50 +02:00
Tony-Goat
1b6d116dfb
Updated LineEdit to address #41278
Updated set_max_length() function to actually pull a substring of the current text so it's not all thrown away when the new max length is shorter than the current length.

(cherry picked from commit 71febfd6e2)
2020-08-31 15:53:56 +02:00
Rémi Verschelde
a2edf04fd2
Merge pull request #40469 from nekomatata/virtual-keyboard-enter-fixes-3.2
[3.2] Fix Return key events in LineEdit & TextEdit on Android
2020-07-26 20:26:02 +02:00
PouleyKetchoupp
930c880fa6 Add option to disable virtual keyboard for LineEdit
Co-authored-by: Alexander Holland <alexander.holland@live.de>
(cherry picked from commit 0aa56e3ab8)
2020-07-24 10:31:57 +02:00
PouleyKetchoupp
c0b394572f Fix Return key events in LineEdit & TextEdit on Android
Depending on the device implementation, editor actions could be
received with different action ids or not at all for multi-line.

Added a parameter to virtual keyboards to properly handle single-line
and multi-line cases in all situations.

Single-line:
Input type set to text without multiline to make sure actions are sent.
IME options are set to DONE action to force action id consistency.

Multi-line:
Input type set to text and multiline to make sure enter triggers new lines.
Actions are disabled by the multiline flag, so '\n' characters are
handled in text changed callbacks.
2020-07-17 18:25:40 +02:00
Andy Maloney
5bbb15418f [3.2][macOS] Command-backspace in line edit
Make command-backspace in line edit work like other macOS applications.

If there is a selection, command-backspace deletes the selection.

If there isn't a selection, command-backspace deletes from the cursor to the beginning of the line edit.

This addresses part of godotengine/godot#23548
2020-06-18 17:42:51 -04:00
Thibault Truffert
24b3bf0637 Make text deletion methods public for LineEdit
(cherry picked from commit 2bb44ea5bd)
2020-06-11 09:42:23 +02:00
SkyJJ
2197ef0566 Fix Android LineEdit editing bugs
(cherry picked from commit cc473b948f)
2020-05-20 12:07:08 +02:00
Eduardo Nunes Pereira
55ab98233a Using the common behaviour when use command+shift on text line for osx
* On press left+command+shift or right+command+shift it should behave like shift+home or shift+end and select the text
* Using home and end events as reference

(cherry picked from commit d8f8a3c606)
2020-05-11 11:13:22 +02:00
Thakee Nathees
324213a6db fix project manager don't consume Enter key #17620
(cherry picked from commit b98153886f)
2020-04-16 11:44:44 +02:00
simpuid
223d0abd7e Remove update condition from LineEdit::update_placeholder_width
Placeholder with length greater than `max_length` are allowed, so there is no reason for those update condition.
It fixes the odd alignment of placeholder when it's length is greater than `max_length`

(cherry picked from commit 43b2f75d64)
2020-03-25 11:38:53 +01:00
Darren Kaste
53c8d8a5fb Use LineEdit secret character width everywhere
(cherry picked from commit c7c47410aa)
2020-03-25 11:38:53 +01:00
Darren Kaste
f657614760 Calculate LineEdit selection with secret character
(cherry picked from commit 395a038c85)
2020-03-25 11:38:53 +01:00
sumit0190
58a940e5aa Update cached_width of the line_edit element when setting it to be secret
(cherry picked from commit 2e08578985)
2020-02-14 15:56:48 +01:00
Bruno Lourenço
a3bcdbeb78 Android virtual keyboard respecting LineEdit max length. 2020-01-23 01:52:49 +00:00
Haoyu Qiu
26e3b4a58a Updates LineEdit's min size when necessary
These properties will affect the minimum size of LineEdit:

* The right icon (`set_right_icon`)
* The clear button (`set_editable` and `set_clear_button_enabled`)
* The text, when "expand to text length" is enabled (`set_text`)
2020-01-15 10:15:32 +08:00
Paulb23
22c15083af Fix empty LineEdit crash on ctrl+backspace 2020-01-11 17:57:36 +00:00
Tomasz Chabora
60cd3df337 Add signal for LineEdit overflow event 2020-01-10 21:07:00 +01:00
Rémi Verschelde
a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
bruvzg
4937b21ce5
Hide LineEdit placeholder if IME composition string is not empty. 2019-12-08 18:24:30 +02:00
Paulb23
b68703a35c Fixed caret alignment with placeholder text 2019-12-01 14:27:39 +00:00
Paulb23
3df68b4fa6 Fixed LineEdit alignment when removing text or undo / redo 2019-12-01 13:54:09 +00:00
Michael Alexsander Silva Dias
d24513911d Make LineEdit's minimal size adapt to its icons 2019-09-25 00:46:29 -03:00
Rémi Verschelde
2f52d73c21
Merge pull request #31925 from bojidar-bg/31855-overriden-properties-docs
Add overriden properties to the documentation
2019-09-24 11:53:43 +02:00
Rémi Verschelde
791da4cb83
Merge pull request #32048 from YeldhamDev/lineedit_right_icon_fix
Expose LineEdit's 'right_icon' and fix icon size
2019-09-23 09:51:45 +02:00
Rémi Verschelde
0928e82027
Merge pull request #29895 from ptrojahn/menukey
Support menu key in TextEdit and LineEdit controls
2019-09-22 21:21:13 +02:00
Paul Trojahn
ba24bc1e04 Support menu key in TextEdit and LineEdit controls
Related to #15542
2019-09-22 12:06:24 +02:00
Michael Alexsander Silva Dias
5d03aa12c9 Expose LineEdit's 'right_icon' and fix icon size 2019-09-21 21:14:14 -03:00
Rémi Verschelde
fae14153f7
Merge pull request #31188 from codecustard/LineEdit_disable_shortcuts
Add Ability to Enable/Disable Shortcuts and Selection for LineEdit/TextEdit
2019-09-19 19:56:59 +02:00
Emmanuel Barroga
b678d68224 Add Ability to Enable/Disable Shortcuts for LineEdit/TextEdit
This PR adds the ability to enable/disable shortcut keys and selection for LineEdit/TextEdit. It also updates the context menu when you disable/enable the shortcut keys or selection.
2019-09-07 06:06:36 -07:00
Bojidar Marinov
6c4407bae4
Add overriden properties to the documentation
Fixes #31855
2019-09-04 15:21:40 +03:00
PouleyKetchoupp
5fdea32622 TextEdit & LineEdit caret blink timers run only when focused (fixes #31936) 2019-09-04 13:06:15 +02:00
Hugo Locurcio
9e1c23a353
Reorganize various menus for consistency and conciseness
- Clean up the recent scripts dialog to match the recent scenes dialog
- Add "..." at the end of shortcuts that cause a modal dialog to appear

This closes #31148.
2019-08-13 11:52:10 +02:00