Commit Graph

917 Commits

Author SHA1 Message Date
408401a642 Triple click in text editor now uses last mouse position for validity
Previously, you would be able to double click a word, followed by
single-clicking another word on the same line, which would select the
entire line. Now, it will only select the whole line if the mouse
position has remained the same after the double click. This mimicks the
behavior in most third party text editors.

Fixes #51312.
2021-08-11 21:49:26 +02:00
ed4c3eb7b3 Move cursor to edge of selection when moving caret left/right
This is to mimic the behavior of many third party text editors. The
reason it's not doing it when moving by word is due to that behavior
being mostly the same on other editors.
2021-08-11 13:27:12 +02:00
dd5a37f556 Move symbol lookup into CodeEdit 2021-08-01 12:06:33 +01:00
8f900ac178 Move line length guidelines into CodeEdit 2021-08-01 12:06:33 +01:00
d1a1ad127e Move brace matching into CodeEdit 2021-08-01 12:06:33 +01:00
12f0053555 Move auto brace completion to CodeEdit 2021-08-01 12:06:33 +01:00
a0bc2f359d Merge pull request #50588 from bruvzg/menu_gen
Optimize LineEdit and TextEdit menu item generation.
2021-07-19 22:56:53 +02:00
dfc1ec7fb9 Merge pull request #50606 from Chaosus/textedit_fix_guttertype
Fixed typos in `TextEdit::GutterType` enum
2021-07-19 16:40:42 +02:00
1597045b09 Fixed typos in TextEdit::GutterType enum 2021-07-19 11:18:54 +03:00
1ac7a126f1 Optimize LineEdit and TextEdit menu item generation. 2021-07-19 08:19:09 +03:00
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
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
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
1a0cfc219b Move indent management to CodeEdit 2021-06-20 20:00:54 +01:00
e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
ab49ea032c Remove redundant keywords from TextEdit 2021-06-19 13:56:54 +01:00
5c618dd03d Move code folding into CodeEdit and hide line hiding API 2021-06-01 17:07:01 +01:00
c5f237eaf8 Merge pull request #45393 from Paulb23/code_edit_autocomplete 2021-06-01 17:58:19 +02:00
c1b9971ad8 Move and expose Code Hint in CodeEdit 2021-06-01 15:38:45 +01:00
1c16673798 Move and expose AutoComplete in CodeEdit 2021-06-01 15:38:45 +01:00
5f66dfa371 Fix TextEdit selection drawing behing minimap 2021-06-01 13:09:39 +01:00
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
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
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
00e10a842f Add custom background line colour to TextEdit and remove marked lines 2021-05-22 14:41:55 +01:00
510030fedc Merge pull request #48528 from sent44/textedit
Expose get_total_visible_rows method to GDScript
2021-05-18 09:06:24 +02:00
92c04fa727 Fix build after mismatch between #48168 and #48599 2021-05-17 17:50:42 +02:00
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
6c367f8e0d Merge pull request #48168 from LightningAA/control-to-ctrl-4.0 2021-05-17 17:38:02 +02:00
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
c3967c80ab Display arrow cursor if text is not editable 2021-05-07 23:08:00 +02:00
97fecd1b69 Rename "Control" key to "Ctrl" and add "_pressed" suffix to all InputEventWithModifiers properties/methods 2021-05-07 14:00:50 -06:00
7bb12b0d6d Expose get_total_visible_rows as get_visible_line_count 2021-05-07 20:54:05 +07:00
0de9a7d803 Rename doubleclick to double_click 2021-05-04 04:38:08 -04:00
2c64008718 Fix indent left line selection 2021-04-25 22:31:29 +01:00
92900bd490 Fixed ui_accept (spacebar + return) accepting auto-completion options. 2021-04-15 00:38:28 +10:00
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
504bc5cc67 Fix crashes in *_input functions 2021-04-05 08:52:21 +02:00
10d7fccb54 Rename ButtonList enum and members to MouseButton 2021-03-23 07:13:23 -04:00
7e86b4c0e4 Merge pull request #46280 from floppyhammer/AdjustCompletionPanelPosition
Improve Completion Panel Position in Shader Editor
2021-03-21 00:17:35 +01:00
91181c2086 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
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
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
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
f05d6f66b0 fix incorrect iauto-indentation in mutliline bracket (fix #46384) 2021-03-03 18:59:59 +01:00
5c58d3731c fix selection error after commenting or indenting text 2021-03-01 21:57:26 +01:00
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
e927a9fef0 ImproveCompletionPanelPositionInShaderEditor 2021-02-22 11:08:51 +08:00
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
d78336c65e [CTL] Add missing font outline drawing routines and theme constants. 2021-02-14 14:11:44 +02:00