1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 14:37:16 +00:00

fixed string_parameter editors forgetting the edited text

This commit is contained in:
Zeno Rogue 2024-05-28 15:26:10 +02:00
parent 43d1fd3db8
commit ba44e111ca

View File

@ -578,21 +578,24 @@ void string_parameter::show_edit_option(int key) {
}
string_parameter* string_parameter::set_standard_editor() {
shared_ptr<string> bak = make_shared<string>(*value);
shared_ptr<string> bak = make_shared<string>();
editor = [this, bak] {
*bak = *value;
dialog::edit_string(*bak, menu_item_name, help_text);
dialog::get_di().reaction = [this, bak] {
if(pre_reaction) pre_reaction();
*value = *bak;
if(reaction) reaction();
};
if(sets) sets();
};
return this;
}
string_parameter* string_parameter::set_file_editor(string ext) {
shared_ptr<string> bak = make_shared<string>(*value);
shared_ptr<string> bak = make_shared<string>();
editor = [this, bak, ext] {
*bak = *value;
dialog::openFileDialog(*bak, menu_item_name, ext, [this, bak] {
if(pre_reaction) pre_reaction();
*value = *bak;