Commit graph

635 commits

Author SHA1 Message Date
SnailRhymer
efed5087ae Change code folding behavior to include terminal indented comments
Previously, when folding a block of code that finished with an indented comment (i.e. one indented as much as or more than the starting indent of the code), that comment would be left out of the fold. Change the behavior to include such comments, but still leave less-indented ones out.
2022-07-17 17:38:51 +01:00
ConteZero
a13b3028a2 Add an option to drag'n'drop selected text in TextEdit
(cherry picked from commit 5d56efcaa4)
2022-06-30 19:23:01 +02:00
kobewi
053fdb8872 Disable scroll when dragging at edges of TextEdit 2022-06-14 23:36:54 +02:00
Rémi Verschelde
8182a754d2
Merge pull request #59827 from ConteZero/fix_right_menu 2022-04-14 21:29:57 +02:00
Haoyu Qiu
19a0145742 Fix undo history for function name autocompletion 2022-04-14 14:37:31 +08:00
Haoyu Qiu
1d476d7737 Consider chained operation when selecting text in TextEdit::undo()
(cherry picked from commit 8cefbfcf43)
2022-04-13 11:43:49 +02:00
Rémi Verschelde
21c3048397 Add missing argument names in bindings 2022-04-04 12:56:59 +02:00
ConteZero
57b616fb21 Fix Right-Click clearing selection 2022-04-03 10:18:12 +02:00
ConteZero
2ff0735329 Added primary clipboard for Linux 2022-03-14 15:28:36 +01:00
ConteZero
0ffacff998 [3.x] Add option to make selection unique 2022-03-14 09:48:09 +01:00
Rémi Verschelde
08c3e00b95
Merge pull request #55355 from ConteZero/drag_and_drop_3.x 2022-03-14 08:43:22 +01:00
ConteZero
4167e98088 Add drag and drop to TextEdit, LineEdit, RichTextLabel 2022-03-14 08:15:25 +01:00
Haoyu Qiu
db9d426798 Remove extra separator when TextEdit is read only and unselectable
(cherry picked from commit 933211cb0c)
2022-03-10 16:19:30 +01:00
Wilson E. Alvarez
c37be0f31b
Expose TextEdit get_visible_rows() and get_total_visible_rows() to GDScript 2022-03-08 22:32:22 -05:00
Rémi Verschelde
a627cdafc5
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-13 15:54:13 +01:00
kobewi
9f7f7377dd
Set max value of inactive TextEdit scrolls to 0
(cherry picked from commit 892d93759c)
2022-01-12 17:36:41 +01:00
Yuri Sizov
ba747e2a26 Add methods to get position from column and line in TextEdit 2021-11-29 00:06:16 +03:00
Haoyu Qiu
eb6f74855f Allow toggle TextEdit bookmark gutter 2021-11-21 21:34:30 +08:00
Rémi Verschelde
42d385b312
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 13:23:38 +02:00
Haoyu Qiu
52a840b9c9 Fix crash when tooltip_request_func object is freed 2021-10-06 15:33:31 +08:00
PouleyKetchoupp
ab55c33c20 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-09-16 09:14:22 -07:00
Hugo Locurcio
85ebe8e3f6
Add visual feedback when hovering or dragging the code minimap grabber
This makes it more obvious that the minimap grabber can be dragged
to scroll.
2021-09-04 02:25:44 +02:00
Rémi Verschelde
a67eaa67b0
Merge pull request #51732 from codecat/fix-caret-selection-3.x
Move cursor to edge of selection when moving caret left/right
2021-08-18 20:12:19 +02:00
Melissa Geels
6bf6d18ee1 Move cursor to edge of selection when moving caret left/right
This is to mimic the behavior of many third party text editors.
The reasons it's not doing it when moving by word is due to that
behavior being mostly the same on other editors.

This was backported to 3.x from pull request #51502.
2021-08-18 14:28:57 +02:00
Haoyu Qiu
5f316aa216 Improve Undo/Redo menu items
* Make Undo/Redo menu items disabled when clicking it does nothing.
    * Context menu of `TextEdit`
    * Context menu of `LineEdit`
    * Editor's Scene menu
    * Script editor's Edit menu and context menu  (for Script and Text)
* Make editor undo/redo log messages translatable.
* Mark `UndoRedo`'s `has_{un,re}do()` methods as `const`.
* Expose `TextEdit`'s `has_{un,re}do()` to scripts since `{un,re}do()` are already available.
2021-08-18 00:46:51 +08:00
Melissa Geels
ac40f5bb75
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.

(cherry picked from commit 408401a642)
2021-08-12 16:43:22 +02:00
Rémi Verschelde
32f5bee985
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>
(cherry picked from commit 9a1ce8e6c3)
2021-07-13 10:20:02 +02:00
Marcel Admiraal
7e03bd1671 Remove duplicate WARN_PRINTS macro 2021-06-18 12:57:59 +01:00
Hugo Locurcio
f36c90b82f
Add a soft line length guideline to the script editor
The default value is 80. The hard line length guideline's default column
has been moved to 100 to account for the new soft line length guideline.

It can be disabled by setting its value to the same column as the
hard line length guideline.
2021-06-16 06:00:02 +02:00
Hugo Locurcio
2e6a4aea99
Allow more items in automatic width calculation for TextEdit completion
Calculating the width for 100 items takes a millisecond in
a debug build on an i7-6700K. It's likely that the editor can remain
smooth even with 1,000 items, especially in a release build.
2021-06-08 16:21:39 +02:00
Hugo Locurcio
a38b447413
Highlight control flow keywords with a different color
This makes them easier to distinguish from other keywords.
2021-05-25 00:31:39 +02:00
Hugo Locurcio
333dfb96da
Scroll faster when holding Alt in TextEdit (and script editor)
This feature is inspired by a similar feature found in
Visual Studio Code.

(cherry picked from commit cf1cf6c6eb)
2021-05-18 11:58:09 +02:00
kobewi
cb5870dd4a
Display arrow cursor if text is not editable
(cherry picked from commit c3967c80ab)
2021-05-09 17:50:06 +02:00
Rémi Verschelde
140350d767
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2021-05-05 15:02:01 +02:00
Rémi Verschelde
a828398655
Style: Replaces uses of 0/NULL by nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2021-05-04 16:30:23 +02:00
Rémi Verschelde
b5e1e05ef2
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Rémi Verschelde
3d15f04668
Style: clang-format: Disable AllowShortIfStatementsOnASingleLine 2021-05-04 14:45:15 +02:00
Koala
d08666f999
Fix indent left line selection
(cherry picked from commit 2c64008718)
2021-05-04 12:47:36 +02:00
floppyhammer
4628ab2a15
ImproveCompletionPanelPositionInShaderEditor
(cherry picked from commit e927a9fef0)
2021-04-29 11:35:52 +02:00
PouleyKetchoupp
ac9e5d9c60
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.

(cherry picked from commit 121030940c)
2021-02-16 14:27:38 +01:00
PouleyKetchoupp
018008ce81 TextEdit respects content margin from StyleBox
Backport from PR #45858 on master.
2021-02-15 10:47:38 -07:00
Filip
9c4f16f4c1 Fixed completion box not showing properly [3.2] 2021-02-10 20:40:00 +01:00
Oliver Dick
db57f32194
TextEdit: When left mouse is pressed to place the cursor, do not immediately adjust the viewport when cursor_set_line is called, but afterwards on cursor_set_column (effectively when the cursor reached its final position)
Fixes #45770

(cherry picked from commit 8d598693fc)
2021-02-08 22:36:36 +01:00
Rémi Verschelde
0b6dd929c6
Merge pull request #45169 from fmazan/3.2-completion-panel-positioning
[3.2] Fixed completion and hint panel positioning in TextExit
2021-02-01 20:50:38 +01:00
HaSa1002
4ff0df702d Expose bookmark, breakpoint, and mark safe functions in TextEdit 2021-01-27 22:41:07 +01:00
Filip
f1d00522f5 Fixed completion and hint panel positioning in TextExit [3.2] 2021-01-13 21:44:05 +01:00
Rémi Verschelde
49646383f1
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Rémi Verschelde
5c80c94449
Revert "solved ctrl + alt + special character Issue #6851"
(cherry picked from commit 8b7f582f22)
2021-01-05 21:33:33 +01:00
Sergey Minakov
f1fd0440f3 GUI: use cursor in TextEdit for non selected text. 2020-12-16 05:33:10 +03:00
Sergey Minakov
4c3b84b3d7 GUI: send cursor data from TextEdit 2020-12-16 05:05:38 +03:00