Go to the source code of this file.
◆ ncreader_clear()
Definition at line 73 of file reader.c.
73 {
77 return 0;
78}
void ncplane_erase(ncplane *n)
◆ ncreader_contents()
char * ncreader_contents |
( |
const ncreader * |
n | ) |
|
Definition at line 413 of file reader.c.
413 {
415}
char * ncplane_contents(ncplane *nc, int begy, int begx, unsigned leny, unsigned lenx)
◆ ncreader_create()
Definition at line 26 of file reader.c.
26 {
30 }
33 }
38 }
40
41
43 .
y = -ncplane_dim_y(
n),
44 .x = -ncplane_dim_x(
n),
45 .rows = ncplane_dim_y(
n),
46 .cols = ncplane_dim_x(
n),
47 .name = "text",
48 };
53 }
54
63 if(ncplane_set_widget(
n, nr, (
void(*)(
void*))ncreader_destroy_internal)){
68 }
69 return nr;
70}
ncplane * notcurses_stdplane(notcurses *nc)
void ncplane_set_channels(ncplane *n, uint64_t channels)
void ncplane_set_styles(ncplane *n, unsigned stylebits)
int ncplane_destroy(ncplane *ncp)
notcurses * ncplane_notcurses(const ncplane *n)
ncplane * ncplane_create(ncplane *n, const ncplane_options *nopts)
const struct ncplane_options * opts
#define NCREADER_OPTION_NOCMDKEYS
#define NCREADER_OPTION_HORSCROLL
#define NCREADER_OPTION_CURSOR
◆ ncreader_destroy()
void ncreader_destroy |
( |
ncreader * |
n, |
|
|
char ** |
contents |
|
) |
| |
Definition at line 17 of file reader.c.
17 {
19 if(contents){
21 }
22 ncreader_destroy_internal(
n);
23 }
24}
char * ncreader_contents(const ncreader *n)
◆ ncreader_move_down()
Definition at line 202 of file reader.c.
202 {
203 unsigned y =
n->ncp->y;
204 if(
y >=
n->textarea->leny - 1){
205
206 return -1;
207 }
212 return 0;
213}
int ncplane_cursor_move_yx(ncplane *n, int y, int x)
◆ ncreader_move_left()
Definition at line 115 of file reader.c.
115 {
116 int viewx =
n->ncp->x;
117 int textx =
n->textarea->x;
119
120 if(textx == 0){
121
122
124 return -1;
125 }
126 viewx =
n->ncp->lenx - 1;
128 textx =
n->textarea->lenx - 1;
129 n->xproject =
n->textarea->x -
n->ncp->x;
130 }else{
131
132
133
134 if(viewx == 0){
136 }else{
137 --viewx;
138 }
139 --textx;
140 }
143
145 return 0;
146}
◆ ncreader_move_right()
Definition at line 152 of file reader.c.
152 {
153 unsigned textx =
n->textarea->x;
154 unsigned y =
n->ncp->y;
155 unsigned viewx =
n->ncp->x;
156
157 if(textx >=
n->textarea->lenx - 1){
158
159
160 if(
y >=
n->textarea->leny - 1){
161 return -1;
162 }
163 viewx = 0;
165 textx = viewx;
167 }else{
168
169
170
171 if(viewx >=
n->ncp->lenx - 1){
173 }else{
174 ++viewx;
175 }
176 ++textx;
177 }
180
182 return 0;
183}
◆ ncreader_move_up()
Definition at line 187 of file reader.c.
187 {
190
191 return -1;
192 }
197 return 0;
198}
◆ ncreader_offer_input()
Definition at line 371 of file reader.c.
371 {
373 return false;
374 }
375 if(ncinput_ctrl_p(ni) && !
n->no_cmd_keys){
376 return ncreader_ctrl_input(
n, ni);
377 }
else if(ncinput_alt_p(ni) && !
n->no_cmd_keys){
378 return ncreader_alt_input(
n, ni);
379 }
380 if(ncinput_alt_p(ni) || ncinput_ctrl_p(ni)){
381 return false;
382 }
384 return do_backspace(
n);
385 }
386
387
390 return true;
393 return true;
396 return true;
399 return true;
400 }
else if(nckey_synthesized_p(ni->
id)){
401 return false;
402 }
403
405 unsigned char egc[5]={0};
408 }
409 }
410 return true;
411}
int notcurses_ucs32_to_utf8(const uint32_t *ucs32, unsigned ucs32count, unsigned char *resultbuf, size_t buflen)
int ncreader_move_up(ncreader *n)
int ncreader_move_down(ncreader *n)
int ncreader_write_egc(ncreader *n, const char *egc)
int ncreader_move_right(ncreader *n)
int ncreader_move_left(ncreader *n)
◆ ncreader_plane()
◆ ncreader_write_egc()
int ncreader_write_egc |
( |
ncreader * |
n, |
|
|
const char * |
egc |
|
) |
| |
Definition at line 216 of file reader.c.
216 {
218 if(cols < 0){
220 return -1;
221 }
222 if(
n->textarea->x >=
n->textarea->lenx - cols){
224 if(ncplane_resize_simple(
n->textarea,
n->textarea->leny,
n->textarea->lenx + cols)){
225 return -1;
226 }
228 }
229 }
else if(
n->ncp->x >=
n->ncp->lenx){
231 }
232
233 if(ncplane_putegc(
n->textarea,
egc,
NULL) < 0){
234 return -1;
235 }
236 if(ncplane_putegc(
n->ncp,
egc,
NULL) < 0){
237 return -1;
238 }
239 if(
n->textarea->x >=
n->textarea->lenx - cols){
241 n->textarea->x =
n->textarea->lenx - cols;
242 }
243 }
244 if(
n->ncp->x >=
n->ncp->lenx - cols){
245 n->ncp->x =
n->ncp->lenx - cols;
246 }
248 return 0;
249}
#define logerror(fmt,...)
int ncstrwidth(const char *egcs, int *validbytes, int *validwidth)