Skip to content

Commit 3bb7999

Browse files
committed
editor help doc sort with space for Methods and Properties by alphabetical order
1 parent f6b6d51 commit 3bb7999

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

editor/editor_help.cpp

+24-5
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,26 @@ void EditorHelp::_update_doc() {
520520
class_desc->push_table(2);
521521
class_desc->set_table_column_expand(1, true);
522522

523+
char first_char;
523524
for (int i = 0; i < cd.properties.size(); i++) {
525+
const char new_char = cd.properties[i].name[0];
526+
bool is_new_group = false;
527+
528+
if (i < cd.properties.size() - 1 && new_char == cd.properties[i + 1].name[0] && new_char != first_char) {
529+
is_new_group = i > 0;
530+
first_char = new_char;
531+
} else if (first_char != '\0' && new_char != first_char) {
532+
is_new_group = true;
533+
first_char = '\0';
534+
}
535+
536+
if (is_new_group) {
537+
class_desc->push_cell();
538+
class_desc->pop(); //cell
539+
class_desc->push_cell();
540+
class_desc->pop(); //cell
541+
}
542+
524543
property_line[cd.properties[i].name] = class_desc->get_line_count() - 2; //gets overridden if description
525544

526545
class_desc->push_cell();
@@ -641,17 +660,17 @@ void EditorHelp::_update_doc() {
641660
class_desc->pop(); //cell
642661
}
643662

644-
String group_prefix;
663+
char group_prefix;
645664
for (int i = 0; i < m.size(); i++) {
646-
const String new_prefix = m[i].name.substr(0, 3);
665+
const char new_prefix = m[i].name[0];
647666
bool is_new_group = false;
648667

649-
if (i < m.size() - 1 && new_prefix == m[i + 1].name.substr(0, 3) && new_prefix != group_prefix) {
668+
if (i < m.size() - 1 && new_prefix == m[i + 1].name[0] && new_prefix != group_prefix) {
650669
is_new_group = i > 0;
651670
group_prefix = new_prefix;
652-
} else if (group_prefix != "" && new_prefix != group_prefix) {
671+
} else if (group_prefix != '\0' && new_prefix != group_prefix) {
653672
is_new_group = true;
654-
group_prefix = "";
673+
group_prefix = '\0';
655674
}
656675

657676
if (is_new_group && pass == 1) {

0 commit comments

Comments
 (0)