-
-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Misc] A hodgepodge of tiny changes #1146
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,20 @@ namespace ncpp | |
plane = create_plane (*n, rows, cols, yoff, xoff, opaque); | ||
} | ||
|
||
explicit Plane (Plane *n, ncplane_options const& nopts, NotCurses *ncinst = nullptr) | ||
: Plane (static_cast<const Plane*>(n), nopts, ncinst) | ||
{} | ||
|
||
explicit Plane (const Plane *n, ncplane_options const& nopts, NotCurses *ncinst = nullptr) | ||
: Root (ncinst) | ||
{ | ||
if (n == nullptr) { | ||
throw invalid_argument ("'n' must be a valid pointer"); | ||
} | ||
|
||
plane = create_plane (*n, nopts); | ||
} | ||
|
||
explicit Plane (const Plane &n, int rows, int cols, int yoff, int xoff, void *opaque = nullptr) | ||
: Root (nullptr) | ||
{ | ||
|
@@ -69,7 +83,7 @@ namespace ncpp | |
explicit Plane (int rows, int cols, int yoff, int xoff, void *opaque = nullptr, NotCurses *ncinst = nullptr) | ||
: Root (ncinst) | ||
{ | ||
struct ncplane_options nopts = { | ||
ncplane_options nopts = { | ||
.y = yoff, | ||
.x = xoff, | ||
.rows = rows, | ||
|
@@ -102,6 +116,16 @@ namespace ncpp | |
plane = create_plane (const_cast<Plane&>(n), rows, cols, yoff, align, opaque); | ||
} | ||
|
||
explicit Plane (Plane &n, ncplane_options const& nopts, NotCurses *ncinst = nullptr) | ||
: Plane (static_cast<Plane const&>(n), nopts, ncinst) | ||
{} | ||
|
||
explicit Plane (Plane const& n, ncplane_options const& nopts, NotCurses *ncinst = nullptr) | ||
: Root (ncinst) | ||
{ | ||
plane = create_plane (n, nopts); | ||
} | ||
|
||
explicit Plane (Plane *n, int rows, int cols, int yoff, NCAlign align, void *opaque = nullptr) | ||
: Root (nullptr) | ||
{ | ||
|
@@ -1130,6 +1154,16 @@ namespace ncpp | |
return error_guard (ncplane_rotate_ccw (plane), -1); | ||
} | ||
|
||
char* strdup (Cell const& cell) const noexcept | ||
{ | ||
return cell_strdup (plane, cell); | ||
} | ||
|
||
char* extract (Cell const& cell, uint16_t *stylemask = nullptr, uint64_t *channels = nullptr) | ||
{ | ||
return cell_extract (plane, cell, stylemask, channels); | ||
} | ||
|
||
const char* get_extended_gcluster (Cell &cell) const noexcept | ||
{ | ||
return cell_extended_gcluster (plane, cell); | ||
|
@@ -1227,27 +1261,17 @@ namespace ncpp | |
private: | ||
ncplane* create_plane (const Plane &n, int rows, int cols, int yoff, int xoff, void *opaque) | ||
{ | ||
struct ncplane_options nopts = { | ||
ncplane_options nopts = { | ||
.y = yoff, | ||
.x = xoff, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my bad |
||
.x = xoff, | ||
.rows = rows, | ||
.cols = cols, | ||
.userptr = opaque, | ||
.name = nullptr, | ||
.resizecb = nullptr, | ||
.flags = 0, | ||
}; | ||
ncplane *ret = ncplane_create ( | ||
n.plane, | ||
&nopts | ||
); | ||
|
||
if (ret == nullptr) | ||
throw init_error ("Notcurses failed to create a new plane"); | ||
|
||
map_plane (plane, this); | ||
|
||
return ret; | ||
return create_plane (n, nopts); | ||
} | ||
|
||
ncplane* create_plane (Plane &n, int rows, int cols, int yoff, NCAlign align, void *opaque) | ||
|
@@ -1262,16 +1286,21 @@ namespace ncpp | |
nullptr, | ||
0, | ||
}; | ||
return create_plane (n, nopts); | ||
} | ||
|
||
ncplane* create_plane (const Plane &n, ncplane_options const& nopts) | ||
{ | ||
ncplane *ret = ncplane_create ( | ||
n.plane, | ||
&nopts | ||
); | ||
|
||
if (ret == nullptr) | ||
if (ret == nullptr) { | ||
throw init_error ("Notcurses failed to create an aligned plane"); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thank you |
||
|
||
map_plane (plane, this); | ||
|
||
return ret; | ||
} | ||
|
||
|
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh. I'd rather switch
cell_{on, off}_styles
in the actual API to matchncplane_styles_*
, but Allah, the All-Powerful, has fucked us once again. Guess I just missed this in 2.0 API review. Bah! Thanks a lot for this find.I'm going to go ahead and fix it in
USAGE.md
as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it in
USAGE.md
.cell_load_char()
was already correct there.