3#define WIN32_LEAN_AND_MEAN
45 ImGui::TextUnformatted(
"\n");
94 int wlen = MultiByteToWideChar(CP_UTF8, 0, url.c_str(), -1,
nullptr, 0);
96 wurl.resize(wlen ? (wlen - 1) : 0);
98 MultiByteToWideChar(CP_UTF8, 0, url.c_str(), -1, wurl.data(), wlen);
100 HINSTANCE r = ShellExecuteW(
nullptr, L
"open", wurl.c_str(),
nullptr,
nullptr, SW_SHOWNORMAL);
101 if ((INT_PTR)r <= 32)
104 std::string cmd =
"start \"\" \"" + url +
"\"";
105 std::system(cmd.c_str());
112 const size_t n = std::strlen(pref);
113 return s.size() >= n && std::equal(pref, pref + n, s.begin());
120 const int dashPos[4] = {8, 13, 18, 23};
121 for (
int i = 0; i < 36; ++i)
123 if (i == dashPos[0] || i == dashPos[1] || i == dashPos[2] || i == dashPos[3])
152 return std::isxdigit(
static_cast<unsigned char>(c)) != 0;
static bool startsWith_(const std::string &s, const char *pref)
static void openDefaultBrowser_(const std::string &url)
std::function< std::string(const std::string &ref) resolveNoteRef)
void open_url() const override
std::string resolveNote_(const std::string &ref) const
std::function< void(const std::string &expr) onRoll)
static bool isHex_(char c)
std::function< void(const std::string &url) onOpenExternal)
std::function< void(const std::string &uuid) onNoteOpen)
static bool looksLikeShortId_(const std::string &s)
void soft_break() override
Parsed parseHref_(const std::string &href) const
static bool looksLikeUuid_(const std::string &s)