Commit graph

887 commits

Author SHA1 Message Date
bruvzg
3ca3ee36ab
Fix IME position in the single window mode sub-windows. 2023-03-06 10:08:55 +02:00
bruvzg
315164c619
[TextEdit / IME] Check selection before deleting to avoid unnecessary error messages. 2023-02-27 08:58:28 +02:00
Paulb23
60161cbe7d Fix ctrl+backspace crash with multicarets on the same line 2023-02-19 12:04:14 +00:00
James Mintram
aa024296d1
Fix error spam when hovering minimap in the script editor 2023-02-16 22:03:01 +01:00
Danil Alexeev
af8bf6f1d0
Fix LineEdit and TextEdit context menus not customizable 2023-01-27 11:14:54 +03:00
bruvzg
e08a6e692d
[Windows] Fix committing IME text without IME deactivation. 2023-01-26 09:24:12 +02:00
Aaron Franke
2bc0bcbd26
PropertyUsage: Rename "DO_NOT_SHARE_ON_DUPLICATE" to "ALWAYS_DUPLICATE" 2023-01-24 16:05:07 -06:00
bruvzg
daad4aed62
Cleanup and unify keyboard input.
- Unify keycode values (secondary label printed on a key), remove unused hardcoded Latin-1 codes.
- Unify IME behaviour, add inline composition string display on Windows and X11.
- Add key_label (localized label printed on a key) value to the key events, and allow mapping actions to the unshifted Unicode events.
- Add support for physical keyboard (Bluetooth or Sidecar) handling on iOS.
- Add support for media key handling on macOS.

Co-authored-by: Raul Santos <raulsntos@gmail.com>
2023-01-23 15:08:12 +02:00
bruvzg
5361ec9f43
Implement BiDi override mode for GDScript source. 2023-01-18 19:22:20 +02:00
Juan Linietsky
2b815df3c1 Use BitField<> in core type masks
* All core types masks are now correctly marked as bitfields.
* The enum hacks in MouseButtonMask and many other types are gone. This ensures that binders to other languages non C++ can actually implement type safe bitmasks.
* Most bitmask operations replaced by functions in BitField<>
* Key is still a problem because its enum and mask at the same time. While it kind of works in C++, this most likely can't be implemented safely in other languages and will have to be changed at some point. Mostly left as-is.
* Documentation and API dump updated to reflect bitfields in core types.
2023-01-08 22:17:40 +01:00
Rémi Verschelde
163f6f5fe8
Merge pull request #68429 from KoBeWi/PropertySettings
Add PropertyInfo overload for GLOBAL_DEF
2023-01-06 22:59:29 +01:00
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
bruvzg
a56fdea289
[TextEdit] Fix IME intermediate text not displayed when TextEdit is empty and placeholder is set. 2022-12-13 20:22:48 +02:00
kobewi
7c6b659bd7 Add PropertyInfo overload for GLOBAL_DEF 2022-12-11 21:36:48 +01:00
Danil Alexeev
53b3d1e645
Fix highlight overlaps in TextEdit 2022-12-06 12:01:31 +03:00
Eduard Zalyaev
b663a825a6 Script editor: Fix edge case when double-click incorrectly updates caret position
Fixes #68898.
2022-12-03 15:51:10 +03:00
Adam Scott
0c64304ba5 Fix error while selecting last empty line 2022-11-23 09:21:41 -05:00
Alfred Reinold Baudisch
0d2953074b Mouse click deselect removes secondary carets and puts primary caret under mouse position
Fixes and closes #67993.
2022-11-06 20:03:06 +01:00
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
8b1a42cd47
Merge pull request #67888 from KoBeWi/overridead
Remove `override_selected_font_color` property
2022-10-31 10:59:07 +01:00
Rémi Verschelde
68623c75b3
Merge pull request #67496 from Paulb23/text-edit-crashes
Fix TextEdit action and CodeEdit completion crash
2022-10-31 10:32:41 +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
kobewi
c7eb814ede Remove override_selected_font_color property 2022-10-26 12:59:18 +02: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
Markus Sauermann
b8031bb7d6 Code simplifications
1. Viewport::get_visible_rect().position is always zero.
So Control::get_window_rect is identical to Control::get_global_rect.
Remove Control::get_window_rect since it is not used in the source code.

2. sqrt(a * a) = abs(a) for doubles

3. Simplify affine_inverse combination

4. Simplify calculation in shaders
2022-10-18 12:47:40 +02:00
PucklaMotzer09
e5354cacd0 Add Caret Insert Below and Above shortcuts to TextEdit 2022-10-18 10:38:53 +02:00
Paulb23
4bfb1d953c Fix undo redo not adjusting TextEdit viewport to caret 2022-10-16 19:30:03 +01:00
Paulb23
76005e5ff7 Forcibly end current TextEdit action on undo redo 2022-10-16 16:28:22 +01:00
Paulb23
f3eb543e67 Fix select word under caret using caret col instead of line 2022-10-11 20:32:06 +01:00
Rémi Verschelde
4be5660223 Merge pull request #67145 from Paulb23/tab_textedit
Fix inserting tabs in TextEdit
2022-10-10 13:52:42 +02:00
Rémi Verschelde
104af08e9d Merge pull request #65805 from MewPurPur/improve-breakpoint-hovering
Improve bookmark and breakpoint indicators
2022-10-10 10:03:26 +02:00
VolTer
d6e60f45a1 Improved breakpoints hover indicator 2022-10-10 04:36:45 +02:00
Haoyu Qiu
eac9adf7a1 Don't allow removing TextEdit's main caret 2022-10-10 08:30:23 +08:00
Paulb23
7333aa68f4 Handle tab in TextEdit 2022-10-09 17:46:40 +01:00
microaeris
215fe852b8 Getters for TextEdit scrollbars 2022-10-07 23:16:04 -07: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
bruvzg
a750ca7ec1
Add split caret direction markers. Fix block/overtype caret size. 2022-10-07 08:45:52 +03:00
Paulb23
4a9d4e3dad Add mutliple Caret support to TextEdit 2022-10-05 17:19:26 +01:00
Paulb23
7dd3857f7e Move selecion into caret 2022-10-03 14:09:27 +01:00
bruvzg
3278917c7a
[TextEdit] Use error/selection font color for the current glyph only, instead of updating cached font color. 2022-09-23 11:25:39 +03: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
Micky
6dbd283ae5 Rename every instance of caret_blink_speed to caret_blink_interval
It's been changed in EditorSettings, LineEdit, TextEdit.

Affects setters and getters, and passed parameters, too.
2022-09-06 18:37:17 +02:00
Rémi Verschelde
33b4153764
Merge pull request #64917 from Tim-Fronsee/fix/add-gutter-total-width 2022-09-02 20:52:11 +02:00
Tim Fronsee
e5c183b01e Fix TextEdit::gutters_width (total gutter width) when adding & removing a gutter by calling TextEdit::_update_gutter_width in TextEdit::add_gutter & TextEdit::remove_gutter
Update TextEdit gutters subcase, gutter add and remove to ensure gutter total width is correct

Fix test_code_edit symbol lookup test case to include padding (+2)
2022-08-31 10:01:40 +09:00
Micky
e31bb5ffeb Rename CanvasItem.update() to queue_redraw()
Affects a lot of classes. Very thoroughly checked signal connections and deferred calls to this method, add_do_method/add_undo_method calls, and so on.

Also renames the internal `_update_callback()` to `_redraw_callback()` for consistency.

Just a few comments have also been changed to say "redraw".

In CPUParticles2D, there was a private variable with the same name. It has been renamed to `do_redraw`.
2022-08-29 14:59:47 +02:00
风青山
e561c68256 Add some codes, returnes directly if the value is not changed.
Avoid executing the following value-changed logics if the value does not really change.
2022-08-23 23:25:22 +08:00
Yuri Sizov
1362bc22bd Add tests for empty/unnamed arguments to ClassDB, Variant, GDScript 2022-08-08 16:36:01 +03:00