Skip to content

Commit

Permalink
add form.get_text_cursor and fix some whitespace trimming bugs in ini
Browse files Browse the repository at this point in the history
  • Loading branch information
samtupy committed Oct 31, 2024
1 parent e107003 commit 3959e07
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions release/include/form.nvgt
Original file line number Diff line number Diff line change
Expand Up @@ -1616,6 +1616,22 @@ class audio_form {
}
return c_form[control_index].text;
}
int get_text_cursor(int control_index) {
form_error = 0;
if (!active) {
form_error = form_error_no_window;
return -1;
}
if ((control_index < 0) || (control_index > c_form.length() - 1)) {
form_error = form_error_invalid_index;
return -1;
}
if (c_form[control_index].type != ct_input) {
form_error = form_error_invalid_control;
return -1;
}
return c_form[control_index].cursor;
}
bool set_text(int control_index, string new_text) {
form_error = 0;
if (!active) {
Expand Down
2 changes: 2 additions & 0 deletions release/include/ini.nvgt
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class ini {
if (is_escape)
is_escape = false;
}
identifier.trim_whitespace_right_this();
// So at this point string identifier contains the name of the new section, so add the previous one and start this one.
this.sections.insert_last(tmp_section);
if (tmp_section.name != "") {
Expand Down Expand Up @@ -179,6 +180,7 @@ class ini {
if (is_escape)
is_escape = false;
}
identifier.trim_whitespace_this();
// If an identifier was found, it's pretty safe to finally add the key to the section!
if (found_identifier)
tmp_section.set_string(identifier, value, true);
Expand Down

0 comments on commit 3959e07

Please sign in to comment.