Commit graph

711 commits

Author SHA1 Message Date
Rémi Verschelde a0bc2f359d
Merge pull request #50588 from bruvzg/menu_gen
Optimize LineEdit and TextEdit menu item generation.
2021-07-19 22:56:53 +02:00
Rémi Verschelde dfc1ec7fb9
Merge pull request #50606 from Chaosus/textedit_fix_guttertype
Fixed typos in `TextEdit::GutterType` enum
2021-07-19 16:40:42 +02:00
Yuri Roubinsky 1597045b09 Fixed typos in TextEdit::GutterType enum 2021-07-19 11:18:54 +03:00
bruvzg 1ac7a126f1 Optimize LineEdit and TextEdit menu item generation. 2021-07-19 08:19:09 +03:00
reduz 6631f66c2a Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname.
* Subsequent usages use the cached version.
* Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time.
* Replaced all theme usages by this new macro.
* Replace all signal emission usages by this new macro.
* Replace all call_deferred usages by this new macro.

This is part of ongoing work to optimize GUI and the editor.
2021-07-18 21:20:02 -03:00
reduz a3fb76cd45 Create many types of popups on demand
* LineEdit popups created on demand.
* TextEdit popups created on demand.
* SpinSlider popups created on demand.
* ResourcePicker popups created on demand.

Improves editor responsiveness.
2021-07-17 10:57:14 -03:00
Rémi Verschelde 9a1ce8e6c3
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>
2021-07-06 18:03:03 +02:00
Paulb23 1a0cfc219b Move indent management to CodeEdit 2021-06-20 20:00:54 +01:00
Lightning_A e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Paulb23 ab49ea032c Remove redundant keywords from TextEdit 2021-06-19 13:56:54 +01:00
Paulb23 5c618dd03d Move code folding into CodeEdit and hide line hiding API 2021-06-01 17:07:01 +01:00
Rémi Verschelde c5f237eaf8
Merge pull request #45393 from Paulb23/code_edit_autocomplete 2021-06-01 17:58:19 +02:00
Paulb23 c1b9971ad8 Move and expose Code Hint in CodeEdit 2021-06-01 15:38:45 +01:00
Paulb23 1c16673798 Move and expose AutoComplete in CodeEdit 2021-06-01 15:38:45 +01:00
Paulb23 5f66dfa371 Fix TextEdit selection drawing behing minimap 2021-06-01 13:09:39 +01:00
Rémi Verschelde 9bc2ba3b64
Merge pull request #48955 from Calinou/editor-tweak-property-hints
Tweak dozens of editor property hints for consistency
2021-05-25 11:44:43 +02:00
Hugo Locurcio 87f503310b
Tweak dozens of editor property hints for consistency
- Update Viewport MSAA property hints to match the currently
  exposed values.
- Add some performance hints to property hints.
2021-05-25 02:50:35 +02:00
Hugo Locurcio 80f4e407b2
Add a keyboard shortcut to select the word under cursor in TextEdit
This also acts as a general-purpose "deselect" shortcut since pressing
it a second time will deselect text.

This is available both in the script editor and in TextEdit fields
in use, both in the editor and projects.

The Duplicate Line script editor shortcut was moved to Ctrl + Shift + D
since it conflicts with the new shortcut (Ctrl + D). The rationale for
doing so is that Duplicate Line is a less commonly used action, and
its behavior can be replicated by copying and pasting the current line
anyway. (With no selection active, the whole line will be copied.)
2021-05-22 23:47:43 +02:00
Paulb23 00e10a842f Add custom background line colour to TextEdit and remove marked lines 2021-05-22 14:41:55 +01:00
Rémi Verschelde 510030fedc
Merge pull request #48528 from sent44/textedit
Expose get_total_visible_rows method to GDScript
2021-05-18 09:06:24 +02:00
Rémi Verschelde 92c04fa727
Fix build after mismatch between #48168 and #48599 2021-05-17 17:50:42 +02:00
Rémi Verschelde b3e3f0e34c
Merge pull request #48599 from Calinou/textedit-alt-scroll-faster
Scroll faster when holding Alt in TextEdit (and script editor)
2021-05-17 17:38:18 +02:00
Rémi Verschelde 6c367f8e0d
Merge pull request #48168 from LightningAA/control-to-ctrl-4.0 2021-05-17 17:38:02 +02:00
Hugo Locurcio cf1cf6c6eb
Scroll faster when holding Alt in TextEdit (and script editor)
This feature is inspired by a similar feature found in
Visual Studio Code.
2021-05-10 01:27:54 +02:00
kobewi c3967c80ab Display arrow cursor if text is not editable 2021-05-07 23:08:00 +02:00
Lightning_A 97fecd1b69 Rename "Control" key to "Ctrl" and add "_pressed" suffix to all InputEventWithModifiers properties/methods 2021-05-07 14:00:50 -06:00
sent44 7bb12b0d6d Expose get_total_visible_rows as get_visible_line_count 2021-05-07 20:54:05 +07:00
Aaron Franke 0de9a7d803
Rename doubleclick to double_click 2021-05-04 04:38:08 -04:00
Koala 2c64008718 Fix indent left line selection 2021-04-25 22:31:29 +01:00
Eric M 92900bd490 Fixed ui_accept (spacebar + return) accepting auto-completion options. 2021-04-15 00:38:28 +10:00
PouleyKetchoupp 9d87bcdcde Fix TextEdit cursor update when adding or deleting text
Updating the viewport while setting the line index before the column is
set could wrongly cause the text to be scrolled down.
2021-04-06 22:17:16 -07:00
Rafał Mikrut 504bc5cc67 Fix crashes in *_input functions 2021-04-05 08:52:21 +02:00
Aaron Franke 10d7fccb54
Rename ButtonList enum and members to MouseButton 2021-03-23 07:13:23 -04:00
Rémi Verschelde 7e86b4c0e4
Merge pull request #46280 from floppyhammer/AdjustCompletionPanelPosition
Improve Completion Panel Position in Shader Editor
2021-03-21 00:17:35 +01:00
Anshul7sp1 91181c2086 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
Fabio Alessandrelli eda5ae9d75 Add IME support checks in LineEdit/TextEdit.
Avoid spamming "IME is unsupported" when the DisplayServer report it as
such.
2021-03-11 23:04:22 +01:00
Rémi Verschelde 9b853d7a7b
Merge pull request #46572 from jmb462/fix-selection-error-after-commenting-or-indenting
Fix selection error after commenting or indenting text (Fix #46477 issue)
2021-03-07 17:03:54 +01:00
Rémi Verschelde dc2207d8e8
Merge pull request #46627 from jmb462/fix-incorrect-autoindentation-in-multiline-brackets
Fix incorrect auto-indentation in multiline brackets (fix #46384)
2021-03-07 16:55:32 +01:00
jmb462 f05d6f66b0 fix incorrect iauto-indentation in mutliline bracket (fix #46384) 2021-03-03 18:59:59 +01:00
jmb462 5c58d3731c fix selection error after commenting or indenting text 2021-03-01 21:57:26 +01:00
Mateo Kuruk Miccino a3db2fd46b LineEdit: Now double click to select a word, and triple click to select all the content using the new TextServer
TextEdit: Update the method to search words with the new TextServer
2021-03-01 08:38:08 -03:00
floppyhammer e927a9fef0 ImproveCompletionPanelPositionInShaderEditor 2021-02-22 11:08:51 +08:00
Eric M 49714b0963 Removed hardcoded shortcuts from /scene and converted to input actions
This removes hardcoded actions from things like LineEdit and TextEdit.

Previously, things like copy, paste, etc were all hardcoded to Ctrl+C, Ctrl+V, etc. They could not be changed. This allows the possibility of them being changed, by making them use the action map. This has the added benefit of greatly simplifying the input handling logic in those controls. The logic which was previously in a huge and hard to follow switch statement has been extracted to individual methods.
2021-02-18 16:22:51 +01:00
bruvzg d78336c65e
[CTL] Add missing font outline drawing routines and theme constants. 2021-02-14 14:11:44 +02:00
Rémi Verschelde 7128f09a5d
Merge pull request #45858 from nekomatata/text-edit-style-content-margins
TextEdit respects content margin from StyleBox
2021-02-13 17:41:53 +01:00
Rémi Verschelde 48e7cced9f
Merge pull request #45881 from nekomatata/textedit-wrap-autoscroll
Fix TextEdit autoscroll with wrapped lines
2021-02-13 17:41:20 +01:00
PouleyKetchoupp 121030940c Fix TextEdit autoscroll with wrapped lines
Index to find the last line wrap index was off by one, which prevented the first wrapped line to trigger autoscroll.
2021-02-12 13:44:46 -07:00
PouleyKetchoupp 100fc26f39 TextEdit respects content margin from StyleBox
Now TextEdit adjusts x & y offset according to the corresponding
StyleBox when in normal or read-only mode.

In order to handle bottom content margin, wrapped lines that are entirely outside the stylebox content area are not drawn.
2021-02-12 13:22:06 -07:00
reduz 28537d8c84 Fix LineEdit minimum width
-Changed theme setting name to make more sense of what it does
-Reduced amount of minimum characters, so minimum size is smaller.
2021-02-12 17:04:38 +01:00
bruvzg 6c9e608a34
Use get_char_size(' ') to calculate space width. 2021-02-12 15:06:50 +02:00