Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
44e0071d
Commit
44e0071d
authored
Oct 14, 2016
by
Rémi Verschelde
Committed by
GitHub
Oct 14, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6780 from RandomShaper/space-padded-line-numbers
Allow turning off zero-padding for line numbers
parents
6c0be2c0
00b3af24
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
1 deletion
+16
-1
text_edit.cpp
scene/gui/text_edit.cpp
+10
-1
text_edit.h
scene/gui/text_edit.h
+3
-0
code_editor.cpp
tools/editor/code_editor.cpp
+1
-0
editor_settings.cpp
tools/editor/editor_settings.cpp
+2
-0
No files found.
scene/gui/text_edit.cpp
View file @
44e0071d
...
...
@@ -693,6 +693,8 @@ void TextEdit::_notification(int p_what) {
// get the highlighted words
String
highlighted_text
=
get_selection_text
();
String
line_num_padding
=
line_numbers_zero_padded
?
"0"
:
" "
;
for
(
int
i
=
0
;
i
<
visible_rows
;
i
++
)
{
int
line
=
i
+
cursor
.
line_ofs
;
...
...
@@ -758,7 +760,7 @@ void TextEdit::_notification(int p_what) {
if
(
cache
.
line_number_w
)
{
String
fc
=
String
::
num
(
line
+
1
);
while
(
fc
.
length
()
<
line_number_char_count
)
{
fc
=
"0"
+
fc
;
fc
=
line_num_padding
+
fc
;
}
cache
.
font
->
draw
(
ci
,
Point2
(
cache
.
style_normal
->
get_margin
(
MARGIN_LEFT
)
+
cache
.
breakpoint_gutter_width
,
ofs_y
+
cache
.
font
->
get_ascent
()),
fc
,
cache
.
line_number_color
);
...
...
@@ -4520,6 +4522,12 @@ void TextEdit::set_show_line_numbers(bool p_show) {
update
();
}
void
TextEdit
::
set_line_numbers_zero_padded
(
bool
p_zero_padded
)
{
line_numbers_zero_padded
=
p_zero_padded
;
update
();
}
bool
TextEdit
::
is_show_line_numbers_enabled
()
const
{
return
line_numbers
;
}
...
...
@@ -4811,6 +4819,7 @@ TextEdit::TextEdit() {
completion_line_ofs
=
0
;
tooltip_obj
=
NULL
;
line_numbers
=
false
;
line_numbers_zero_padded
=
false
;
line_length_guideline
=
false
;
line_length_guideline_col
=
80
;
draw_breakpoint_gutter
=
false
;
...
...
scene/gui/text_edit.h
View file @
44e0071d
...
...
@@ -232,6 +232,7 @@ class TextEdit : public Control {
bool
text_changed_dirty
;
bool
undo_enabled
;
bool
line_numbers
;
bool
line_numbers_zero_padded
;
bool
line_length_guideline
;
int
line_length_guideline_col
;
bool
draw_breakpoint_gutter
;
...
...
@@ -489,6 +490,8 @@ public:
void
set_show_line_numbers
(
bool
p_show
);
bool
is_show_line_numbers_enabled
()
const
;
void
set_line_numbers_zero_padded
(
bool
p_zero_padded
);
void
set_show_line_length_guideline
(
bool
p_show
);
void
set_line_length_guideline_column
(
int
p_column
);
...
...
tools/editor/code_editor.cpp
View file @
44e0071d
...
...
@@ -1112,6 +1112,7 @@ void CodeTextEditor::update_editor_settings() {
text_editor
->
set_tab_size
(
EditorSettings
::
get_singleton
()
->
get
(
"text_editor/tab_size"
));
text_editor
->
set_draw_tabs
(
EditorSettings
::
get_singleton
()
->
get
(
"text_editor/draw_tabs"
));
text_editor
->
set_show_line_numbers
(
EditorSettings
::
get_singleton
()
->
get
(
"text_editor/show_line_numbers"
));
text_editor
->
set_line_numbers_zero_padded
(
EditorSettings
::
get_singleton
()
->
get
(
"text_editor/line_numbers_zero_padded"
));
text_editor
->
set_show_line_length_guideline
(
EditorSettings
::
get_singleton
()
->
get
(
"text_editor/show_line_length_guideline"
));
text_editor
->
set_line_length_guideline_column
(
EditorSettings
::
get_singleton
()
->
get
(
"text_editor/line_length_guideline_column"
));
text_editor
->
set_syntax_coloring
(
EditorSettings
::
get_singleton
()
->
get
(
"text_editor/syntax_highlighting"
));
...
...
tools/editor/editor_settings.cpp
View file @
44e0071d
...
...
@@ -546,6 +546,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints
[
"text_editor/tab_size"
]
=
PropertyInfo
(
Variant
::
INT
,
"text_editor/tab_size"
,
PROPERTY_HINT_RANGE
,
"1, 64, 1"
);
// size of 0 crashes.
set
(
"text_editor/draw_tabs"
,
true
);
set
(
"text_editor/line_numbers_zero_padded"
,
false
);
set
(
"text_editor/show_line_numbers"
,
true
);
set
(
"text_editor/show_breakpoint_gutter"
,
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment