diff options
author | Benji Dial <benji6283@gmail.com> | 2021-03-11 22:00:22 -0500 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2021-03-11 22:00:22 -0500 |
commit | 5fcf57739e68a8b5053e03778aaee0eed445babd (patch) | |
tree | e7a8bab18668d112e58b1b48190195035c71fa8a /src/user/settings/str_editor.cpp | |
parent | 0f2398d1f622cce37925f52d978d92e6cce1c7a9 (diff) | |
download | portland-os-5fcf57739e68a8b5053e03778aaee0eed445babd.tar.gz |
settings editor, and lots of changes in service of that
Diffstat (limited to 'src/user/settings/str_editor.cpp')
-rw-r--r-- | src/user/settings/str_editor.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/user/settings/str_editor.cpp b/src/user/settings/str_editor.cpp new file mode 100644 index 0000000..5e86e96 --- /dev/null +++ b/src/user/settings/str_editor.cpp @@ -0,0 +1,17 @@ +#include <knob/block.h> + +#include "str_editor.h" + +str_editor::str_editor(struct setting *s, const char *sname) + : e(10, 25, s->data.string), s(&s->data.string) { + editing_widget_ready(e, sname); +} + +void str_editor::set_data() { + const char *const contents = e.get_contents(); + if (strequ(contents, *s)) + return; + delete *s; + *s = strdup(contents); + main_w->is_saved = false; +}
\ No newline at end of file |