Skip to content

Commit 6a4f853

Browse files
committed
editor help doc sort with space for Methods and Properties by alphabetical order
1 parent c0ff2a3 commit 6a4f853

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

editor/editor_help.cpp

+21-2
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,26 @@ void EditorHelp::_update_doc() {
517517
class_desc->push_table(2);
518518
class_desc->set_table_column_expand(1, true);
519519

520+
String first_char;
520521
for (int i = 0; i < cd.properties.size(); i++) {
522+
const String new_char = cd.properties[i].name.substr(0, 1);
523+
bool is_new_group = false;
524+
525+
if (i < cd.properties.size() - 1 && new_char == cd.properties[i + 1].name.substr(0, 1) && new_char != first_char) {
526+
is_new_group = i > 0;
527+
first_char = new_char;
528+
} else if (first_char != "" && new_char != first_char) {
529+
is_new_group = true;
530+
first_char = "";
531+
}
532+
533+
if (is_new_group) {
534+
class_desc->push_cell();
535+
class_desc->pop(); //cell
536+
class_desc->push_cell();
537+
class_desc->pop(); //cell
538+
}
539+
521540
property_line[cd.properties[i].name] = class_desc->get_line_count() - 2; //gets overridden if description
522541

523542
class_desc->push_cell();
@@ -640,10 +659,10 @@ void EditorHelp::_update_doc() {
640659

641660
String group_prefix;
642661
for (int i = 0; i < m.size(); i++) {
643-
const String new_prefix = m[i].name.substr(0, 3);
662+
const String new_prefix = m[i].name.substr(0, 1);
644663
bool is_new_group = false;
645664

646-
if (i < m.size() - 1 && new_prefix == m[i + 1].name.substr(0, 3) && new_prefix != group_prefix) {
665+
if (i < m.size() - 1 && new_prefix == m[i + 1].name.substr(0, 1) && new_prefix != group_prefix) {
647666
is_new_group = i > 0;
648667
group_prefix = new_prefix;
649668
} else if (group_prefix != "" && new_prefix != group_prefix) {

0 commit comments

Comments
 (0)