summaryrefslogtreecommitdiff
path: root/src/user/settings/str_editor.cpp
blob: 5e86e9669febaad9d718201da013e433300087dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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;
}