static Optional<TextChange> handle_command_key(const KeyPress& key,
  ObjText* obj)
{
  auto toggler = [obj](const BoolSetting& setting, const utf8_string& name){
    auto setter = [obj](const auto& setting, const auto& value){
      return [obj, setting, value](){
        return obj->Set(setting, value);
      };
    };

    auto value = obj->GetSettings().Get(setting);
    return TextChange(setter(setting, !value), setter(setting, value),
      value ? "Clear " + name : "Set " + name);
  };

  if (key.Is(Ctrl, key::B)){
    return option(toggler(ts_FontBold, "bold"));
  }
  else if (key.Is(Ctrl, key::I)){
    return option(toggler(ts_FontItalic, "italic"));
  }
  return no_option();
}
inline bool is_exit_key(const KeyPress& key){
  return key.Is(Ctrl, key::enter) ||
    key.Is(key::esc);
}