Commit graph

227 commits

Author SHA1 Message Date
Rémi Verschelde
f7c611ab71
Style: Misc docs and comment style and language fixes
- Removed empty paragraphs in XML.
- Consistently use bold style for "Example:", on a new line.
- Fix usage of `[code]` when hyperlinks could be used (`[member]`, `[constant]`).
- Fix invalid usage of backticks for inline code in BBCode.
- Fix some American/British English spelling inconsistencies.
- Other minor fixes spotted along the way, including typo fixes with codespell.
- Don't specify `@GlobalScope` for `enum` and `constant`.
2022-11-02 19:01:18 +01:00
Alfred Reinold Baudisch
a862583d05 Unified shortcut to clear carets and selections
Refactors`ui_text_remove_secondary_carets` from https://github.com/godotengine/godot/pull/68089 as `ui_text_clear_carets_and_selection`, with extra behaviour:

- If there's only one active caret active with a selection, clears the selection.
- In case there's more than one caret active, removes the secondary carets and clears selections.

With this change, `TextEdit` then imitates the behaviour of VSCode for clearing carets and selections.
2022-11-02 18:23:24 +01:00
Alfred Reinold Baudisch
fcff978763 Shortcut and Bind to Remove Secondary Carets
Adds the bind `ui_text_remove_secondary_carets` to TextEdit, with ESC as the default shortcut.

When the bind is performed, if the TextEdit has multiple carets, `remove_secondary_carets` is called and secondary carets are removed.

This is useful when multiple selects are performed with `add_select_for_next_occurrence` #67644 or when multiple multiple carets are manually added, then it's possible to go back to a single caret with a shortcut.

Closes #67991
2022-10-31 17:44:47 +01:00
Rémi Verschelde
5947f22be9
Merge pull request #67578 from KoBeWi/GEDITOR
Unify usage of GLOBAL/EDITOR_GET
2022-10-31 13:15:58 +01:00
Rémi Verschelde
273410ba5a
Merge pull request #67139 from PucklaMotzer09/insert_caret_at_carets
Add Caret Insert Below and Above shortcuts to TextEdit
2022-10-31 10:32:07 +01:00
Clay John
0486810697
Merge pull request #67644 from alfredbaudisch/add-selection-next-occurrence
Add Selection and Caret for Next Occurrence of Selection
2022-10-27 17:21:49 -07:00
Fredia Huya-Kouadio
13e4770b97 Add double_tap attribute to InputEventScreenTouch
This provides parity with the `InputEventMouseButton` allowing for proper conversion between the two events.
2022-10-22 07:30:46 -07:00
Alfred Reinold Baudisch
7d15ecc3af Add Selection and Caret for Next Occurrence of Selection
Adds the bind `add_selection_for_next_occurrence` to TextEdit, with CTRL+D as the default shortcut.

When the bind is performed, ff a selection is currently active with the last caret in text fields, searches for the next occurrence of the selection, adds a caret and selects the next occurrence.

If no selection is currently active with the last caret in text fields, selects the word currently under the caret.

The action can be performed sequentially for all occurrences of the selection of the last caret and for all existing carets. The viewport is adjusted to the latest newly added caret.

The bind and the behaviour is similar to VS Code's "Add Selection to Next Find Match" and JetBrains' "Add Selection for Next Occurrence". It takes advantage of the multi-caret API.

The default shortcut for `select_word_under_caret` has been changed to ALT+G, in order to give priority to CTRL+D for `add_selection_for_next_occurrence` to better align with popular IDEs and editors.
2022-10-21 08:26:53 +02:00
kobewi
e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +02:00
PucklaMotzer09
e5354cacd0 Add Caret Insert Below and Above shortcuts to TextEdit 2022-10-18 10:38:53 +02:00
bruvzg
0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
Fabio Alessandrelli
0fe0505f77 [Web] Add PS3 gamepad mapping for FF+Linux. 2022-10-03 13:06:50 +02:00
Jiri Suchan
c5bd2f9dce ci: add Python static analysis check via mypy 2022-09-30 19:03:17 +07:00
Rémi Verschelde
b33460c6ca Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@81ddc73d17
2022-09-27 23:48:25 +02:00
Rémi Verschelde
f3d763011f Merge pull request #63109 from OverloadedOrama/fix-input-event-action
Fix `InputEventAction`'s `is_match` method ignoring `exact_match` parameter
2022-09-25 11:06:38 +02:00
bruvzg
6f4d233062
Fix key mapping changes when moving from macOS to other platform
Removes separate `Command` key (use `Meta` instead).
Adds an event flag to automatically remap `Command` <-> `Control` (cannot be set alongside `Control` or `Meta`).
2022-09-07 18:45:35 +02:00
Andres Hernandez
9054399900 Updated gamecontrollerdb.txt to latest to include new mappings for various controllers, including Xbox One, Nintendo Switch, Steam Deck, and 8BitDo 2022-09-05 22:14:59 -07:00
Rémi Verschelde
8812f0c896
Merge pull request #64444 from timothyqiu/action-completion
Fix action name completion for `Input`
2022-09-01 08:20:20 +02:00
Fabio Alessandrelli
d20b32186f [Web] Rename JavaScript platform to Web.
Also rename export name from "HTML5" to "Web".
2022-08-29 11:52:00 +02:00
Rémi Verschelde
d0a2a4c981
Merge pull request #64531 from madmiraal/fix-63972-2
Fix axis mapped to DPad buttons not releasing opposite button
2022-08-24 20:10:29 +02:00
kobewi
1abdffe7a0 Replace Array return types with TypedArray 2 2022-08-23 23:21:32 +02:00
Rémi Verschelde
3f3ade9e5b
Merge pull request #64732 from RandomShaper/input_is_final
Consolidate the fact that `Input` is meant to be final
2022-08-23 08:53:49 +02:00
Yuri Sizov
1a24c9e14b Make _validate_property a multilevel method 2022-08-22 18:35:11 +03:00
Pedro J. Estébanez
99edd4b43d Consolidate the fact that Input is meant to be final
This reverts #38034 and removes the `iteration()` method.
2022-08-22 14:37:25 +02:00
Marcel Admiraal
61be617571 Fix axis mapped to DPad buttons not releasing opposite button 2022-08-17 09:12:47 +01:00
Haoyu Qiu
660c700f9c Fix action name completion for Input 2022-08-15 23:28:49 +08:00
Haoyu Qiu
e061b1cc3c Use %s for bool value in vformat 2022-08-07 09:57:09 +08:00
Rémi Verschelde
86647c9e42 Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@4896d2de6b
2022-08-05 02:59:03 +02:00
Fabio Alessandrelli
55845bac26 Fix some array size function definition mismatch. 2022-08-04 13:06:17 +02:00
Rémi Verschelde
90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00
bruvzg
8823eae328
Rename OSX to macOS and iPhoneOS to iOS. 2022-07-21 09:37:52 +03:00
Rémi Verschelde
b70e4fc0f3 Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@880abd09c9
2022-07-18 15:42:48 +02:00
Emmanouil Papadeas
38b51942d6 Fix InputEventAction's is_action method ignoring exact_match parameter 2022-07-17 17:20:37 +03:00
Rémi Verschelde
344b42703b
Merge pull request #62212 from hansemro/eraser-detect-4
Add inversion/eraser-end property for tablet pens
2022-07-04 21:48:19 +02:00
Hansem Ro
6dcc9d1131 [macOS, Windows, X11] Add stylus inverted/eraser support to
InputEventMouseMotion event
2022-07-04 10:36:53 -07:00
Rémi Verschelde
00b3822306 Input: Re-enable input accumulation by default
I turned it off by mistake in #38697.
See also #62664 for details on this boolean's complex history :)
2022-07-03 12:16:16 +02:00
Marco F
0efa5d4cbd Input: Make get_action_raw_strength print error when the action doesn't exist 2022-06-28 15:58:26 +02:00
FireForge
4678736a39 Add suffixes to all nodes and resources 2022-06-11 09:41:05 -05:00
Rémi Verschelde
ecde7ce834
Merge pull request #61669 from fire-forge/input
Make Input `mouse_mode` and `use_accumulated_input` properties
2022-06-04 15:52:34 +02:00
FireForge
f16c33fff6 Make Input mouse_mode and use_accumulated_input properties 2022-06-03 14:19:38 -05:00
Raul Santos
3e53afd52c
Add array element type to get_connected_joypads 2022-06-03 20:37:46 +02:00
reduz
45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
reduz
746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
reduz
8b7c7f5a75 Add a new HashMap implementation
Adds a new, cleaned up, HashMap implementation.

* Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing).
* Keeps elements in a double linked list for simpler, ordered, iteration.
* Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much
  for performance vs keeping the key, but helps replace old code).
* Uses a more modern C++ iterator API, deprecates the old one.
* Supports custom allocator (in case there is a wish to use a paged one).

This class aims to unify all the associative template usage and replace it by this one:
* Map<> (whereas key order does not matter, which is 99% of cases)
* HashMap<>
* OrderedHashMap<>
* OAHashMap<>
2022-05-12 11:21:29 +02:00
Rémi Verschelde
30fbb8964d Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@b7d126eb71
2022-05-05 14:12:55 +02:00
Hugo Locurcio
180e5d3028
Remove RES and REF typedefs in favor of spelled out Ref<>
These typedefs don't save much typing compared to the full `Ref<Resource>`
and `Ref<RefCounted>`, yet they sometimes introduce confusion among
new contributors.
2022-05-03 01:43:50 +02:00
Rémi Verschelde
c273ddc3ee Style: Partially apply clang-tidy's cppcoreguidelines-pro-type-member-init
Didn't commit all the changes where it wants to initialize a struct
with `{}`. Should be reviewed in a separate PR.

Option `IgnoreArrays` enabled for now to be conservative, can be
disabled to see if it proposes more useful changes.

Also fixed manually a handful of other missing initializations / moved
some from constructors.
2022-05-02 16:28:25 +02:00
Paulb23
5e4e4967fe Use Input::push_input for tests plus extra mouse testing 2022-04-22 17:39:12 +01:00
Rémi Verschelde
bd9ba4bd10
Merge pull request #60208 from Magorx/input-set-custom-mouse-cursor-fix
Added p_shape check to avoid engine crash in DisplayServer
2022-04-14 00:12:51 +02:00
KingCakeTheFruity
29a2809d21 Added p_shape check to avoid engine crush 2022-04-13 14:50:30 +03:00