diff --git a/src/ewig/application.cpp b/src/ewig/application.cpp index aedf880..4b6c365 100644 --- a/src/ewig/application.cpp +++ b/src/ewig/application.cpp @@ -47,7 +47,7 @@ static const auto global_commands = commands {"page-down", scroll_command(page_down)}, {"page-up", scroll_command(page_up)}, {"paste", paste_command(insert_text)}, - {"quit", [](auto, auto) { return boost::none; }}, + {"quit", [](auto, auto) { return std::nullopt; }}, {"save", save}, {"undo", edit_command(undo)}, {"start-selection", edit_command(start_selection)}, @@ -93,7 +93,7 @@ application clear_input(application state) return state; } -boost::optional update(application state, event ev) +std::optional update(application state, event ev) { state.input = state.input.push_back(ev.key); const auto& map = state.keys.get(); @@ -116,7 +116,7 @@ boost::optional update(application state, event ev) return state; } -boost::optional +std::optional eval_command(application state, const std::string& cmd, coord size) { auto it = global_commands.find(cmd); diff --git a/src/ewig/application.hpp b/src/ewig/application.hpp index 6093522..d0e56cc 100644 --- a/src/ewig/application.hpp +++ b/src/ewig/application.hpp @@ -48,17 +48,17 @@ struct event coord size; }; -using command = std::function(application, coord)>; +using command = std::function(application, coord)>; application save(application app, coord); application paste(application app, coord size); application put_message(application state, std::string str); application put_clipboard(application state, text content); -boost::optional eval_command(application state, const std::string& cmd, coord editor_size); +std::optional eval_command(application state, const std::string& cmd, coord editor_size); application clear_input(application state); -boost::optional update(application state, event ev); +std::optional update(application state, event ev); application apply_edit(application state, coord size, buffer edit); application apply_edit(application state, coord size, std::pair edit); diff --git a/src/ewig/buffer.cpp b/src/ewig/buffer.cpp index ccee1dd..e4bb78a 100644 --- a/src/ewig/buffer.cpp +++ b/src/ewig/buffer.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -370,14 +369,14 @@ std::pair cut(buffer buf) buf.cursor = starts; } - buf.selection_start = boost::none; + buf.selection_start = std::nullopt; return {buf, selection}; } std::pair copy(buffer buf) { auto result = selected_text(buf); - buf.selection_start = boost::none; + buf.selection_start = std::nullopt; return {buf, result}; } @@ -397,7 +396,7 @@ buffer select_whole_buffer(buffer buf) buffer clear_selection(buffer buf) { - buf.selection_start = boost::none; + buf.selection_start = std::nullopt; return buf; } @@ -434,7 +433,7 @@ buffer record(buffer before, buffer after) if (before.content != after.content) { after.history = after.history.push_back({before.content, before.cursor}); if (before.history_pos == after.history_pos) - after.history_pos = boost::none; + after.history_pos = std::nullopt; } return after; } diff --git a/src/ewig/buffer.hpp b/src/ewig/buffer.hpp index a8b7e3e..024adaf 100644 --- a/src/ewig/buffer.hpp +++ b/src/ewig/buffer.hpp @@ -26,7 +26,7 @@ #include #include -#include +#include namespace ewig { @@ -51,9 +51,9 @@ struct buffer text content; coord cursor; coord scroll; - boost::optional selection_start; + std::optional selection_start; immer::vector history; - boost::optional history_pos; + std::optional history_pos; }; constexpr auto tab_width = 8; diff --git a/src/ewig/utils.hpp b/src/ewig/utils.hpp index 03205eb..ef0568f 100644 --- a/src/ewig/utils.hpp +++ b/src/ewig/utils.hpp @@ -24,8 +24,8 @@ #include #include -#include +#include #include namespace std @@ -54,7 +54,7 @@ struct hash> namespace ewig { template -boost::optional optional_map(boost::optional v, Fn&& fn) +std::optional optional_map(std::optional v, Fn&& fn) { return v ? std::forward(fn)(std::move(*v)) : v; }