Add edit support for Notepad (#1093)

* WIP file editing

* WIP file editing

* Add "on_pop" handler to navigation.

* WIP Editing

* WIP for draft

* Fix mock and unit tests,  support +newline at end.

* Clean up Painter API and use string_view

* Fix optional rvalue functions

* Fix Result 'take' to be more standard

* FileWrapper stack buffer reads

* Grasping at straws

* Nit

* Move set_on_pop impl to cpp

* Workaround "Open" when file not dirty.

---------

Co-authored-by: kallanreed <kallanreed@outlook.com>
This commit is contained in:
Kyle Reed 2023-06-01 15:45:55 -07:00 committed by GitHub
parent 69011754c9
commit 8d7fdeb633
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 847 additions and 148 deletions

View file

@ -25,7 +25,7 @@
#include "ui.hpp"
#include "ui_text.hpp"
#include <string>
#include <string_view>
namespace ui {
@ -46,24 +46,24 @@ class Painter {
Painter(const Painter&) = delete;
Painter(Painter&&) = delete;
int draw_char(const Point p, const Style& style, const char c);
int draw_char(Point p, const Style& style, char c);
int draw_string(Point p, const Font& font, const Color foreground, const Color background, const std::string& text);
int draw_string(Point p, const Style& style, const std::string& text);
int draw_string(Point p, const Style& style, std::string_view text);
int draw_string(Point p, const Font& font, Color foreground, Color background, std::string_view text);
void draw_bitmap(const Point p, const Bitmap& bitmap, const Color background, const Color foreground);
void draw_bitmap(Point p, const Bitmap& bitmap, Color background, Color foreground);
void draw_rectangle(const Rect r, const Color c);
void fill_rectangle(const Rect r, const Color c);
void fill_rectangle_unrolled8(const Rect r, const Color c);
void draw_rectangle(Rect r, Color c);
void fill_rectangle(Rect r, Color c);
void fill_rectangle_unrolled8(Rect r, Color c);
void paint_widget_tree(Widget* const w);
void paint_widget_tree(Widget* w);
void draw_hline(Point p, int width, const Color c);
void draw_vline(Point p, int height, const Color c);
void draw_hline(Point p, int width, Color c);
void draw_vline(Point p, int height, Color c);
private:
void paint_widget(Widget* const w);
void paint_widget(Widget* w);
};
} /* namespace ui */