Commit graph

860 commits

Author SHA1 Message Date
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
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
Paulb23
4bfb1d953c Fix undo redo not adjusting TextEdit viewport to caret 2022-10-16 19:30:03 +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
Brian Semrau
103c0fa6e6 Add support for multiple virtual keyboard types 2022-08-04 10:41:33 -04:00
Juan Linietsky
d4433ae6d3 Remove Signal connect binds
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind().
Changed all uses of it to Callable.bind()
2022-07-29 16:26:13 +02:00
bruvzg
36ef8f29dc
Implement support for loading system fonts on Linux, macOS / iOS and Windows. 2022-07-26 08:38:05 +03:00
kobewi
f4a7450216 Fix too thin underline in brace match 2022-07-10 18:23:03 +02:00
bruvzg
344ba0ffaf
Refactor Font configuration and import UI, and Font resources. 2022-07-06 14:12:36 +03:00
kobewi
41f6e7c50e Allow to disable TextEdit vertical scroll 2022-07-04 15:02:15 +02:00
ConteZero
5d56efcaa4 Add an option to drag'n'drop selected text in TextEdit 2022-06-26 15:22:02 +02:00
FireForge
4678736a39 Add suffixes to all nodes and resources 2022-06-11 09:41:05 -05:00
iwek
848e759d88 Remove redundant min call when setting line 2022-06-02 15:52:09 +02:00
Rémi Verschelde
9923851370 Fix typos with codespell
Using codespell 2.2-dev from current git.
2022-05-23 21:32:19 +02:00
Rémi Verschelde
c0d189fbb8
Merge pull request #60955 from pfertyk/issue-60668-fix-get-breakpointed-lines-crash
Fix `get_breakpointed_lines` crashing Godot
2022-05-18 22:55:30 +02:00
Paweł Fertyk
3d5dd91f22 Fix get_breakpointed_lines crashing Godot
Fixes #60668.
2022-05-16 18:46:01 +02:00
bruvzg
081b6b8053
Add ALT NUM+ {hex code} character input support for LineEdit, TextEdit and CodeEdit. 2022-05-13 09:33:24 +03:00
Paweł Fertyk
d1aed90976 Fix backspace when selection reaches left edge
Fixes #60866.
2022-05-09 14:16:28 +02:00
Rémi Verschelde
8c2b9801fd
Merge pull request #60438 from Paulb23/text-edit-tests
Add TextEdit unit tests and multiple fixes.
2022-04-25 23:39:30 +02:00
Paulb23
7f62a74927 Multiple small TextEdit Bug Fixes
Fixed line_drawing_cache not containing anything
Fixed is_move_caret_on_right_click_enabled requiring the context menu to be enabled
Fixed when selecting_enabled is false not disabling shift + click
Fixed when selecting_enabled is false not being able to drag the caret
Fixed _delete emitting signals when nothing had changed.
Fixed insert_line_at up causing a visual update
Fixed get_pos_at_line_column returning a valid position when it was invalid
Fixed set_caret_column unnecessary emitting "caret_changed" when the column is greater then the line
Fixed select_word_under_caret not accepting the edges of words
Fixed select_word_under_caret moving the caret to the start of the line when no word was found
Fixed get_selection_line and get_selection_column not checking if the selection was enabled
Fixed set_line_as_center_visible throwing errors if it would show line 0
Fixed set_line_as_center_visible being off by one
Fixed set_line_as_last_visible not being able to show the first line
Fixed pressing UP and the end of a wrapped line sending the caret to col 0 rather then then persevering the position.
2022-04-22 17:53:14 +01:00
bruvzg
be611c1c05
Implement Label3D node.
Add "generate_mipmap" font import option.
Add some missing features to the Sprite3D.
Move BiDi override code from Control to TextServer.
Add functions to access TextServer font cache textures.
Add MSDF related flags and shader to the standard material.
Change standard material cache to use HashMap instead of Vector.
2022-04-22 12:08:46 +03:00
ConteZero
a3d82f5afb Fix shortcut_keys_enabled in TextEdit 2022-04-08 15:13:32 +02:00
bruvzg
d1207a0504
[Input] Add extra shortcut_input input processing step to process Unicode character input with Alt / Ctrl modifiers, after processing of shortcuts. 2022-04-05 13:46:45 +03:00
Haoyu Qiu
8cefbfcf43 Consider chained operation when selecting text in TextEdit::undo() 2022-04-05 09:12:10 +08:00
Rémi Verschelde
f454cea785
Merge pull request #58452 from marcgpuig/text-edit-backspace-fix 2022-04-04 23:58:33 +02:00
Marc Garcia Puig
f22d257025 Fixed ctrl + backspace on empty lines
Fix <word><space><caret> scenario

Fix move left & right for lines without words
2022-04-04 01:21:16 +02:00
jmb462
0d17903bd5 Fix TextEdit v_scroll_speed invalid values breaks wheel scrolling 2022-04-03 21:07:39 +02:00
nova++
4b8fa3716f Fix "p_from_line > p_to_line" errors in text edit
Done via making the function more robust to different inputs
2022-03-11 01:13:45 -05:00
Rémi Verschelde
8845798b44
Merge pull request #58739 from Calinou/control-add-constructors
Add optional constructor arguments to more Control nodes
2022-03-04 11:42:53 +01:00
Hugo Locurcio
a06f82ca4d
Add optional constructor arguments to more Control nodes
This can be used to make editor code more compact.
However, as of writing, these constructor arguments cannot be used
from the scripting API.

This was already provided for Label and CheckBox, but it was missing
for other Control nodes where it made sense to provide a default value.
2022-03-04 09:48:41 +01:00
Haoyu Qiu
933211cb0c Remove extra separator when TextEdit is read only and unselectable 2022-03-04 16:25:25 +08:00