bool buf_iseol(Buf* buf, unsigned pos);
unsigned buf_bol(Buf* buf, unsigned pos);
unsigned buf_eol(Buf* buf, unsigned pos);
-
unsigned buf_bow(Buf* buf, unsigned pos);
unsigned buf_eow(Buf* buf, unsigned pos);
unsigned buf_lscan(Buf* buf, unsigned pos, Rune r);
unsigned buf_rscan(Buf* buf, unsigned pos, Rune r);
void buf_find(Buf* buf, unsigned* beg, unsigned* end);
-
unsigned buf_end(Buf* buf);
unsigned buf_byrune(Buf* buf, unsigned pos, int count);
unsigned buf_byline(Buf* buf, unsigned pos, int count);
void screen_update(Buf* buf, unsigned crsr, unsigned* csrx, unsigned* csry);
unsigned screen_getoff(Buf* buf, unsigned pos, unsigned row, unsigned col);
-
-void screen_getcoords(Buf* buf, unsigned pos, unsigned* posx, unsigned* posy);
-
void screen_setsize(Buf* buf, unsigned nrows, unsigned ncols);
void screen_getsize(unsigned* nrows, unsigned* ncols);
Row* screen_getrow(unsigned row);
DotBeg = mbeg, DotEnd = mend-1;
}
-void select(MouseEvent* mevnt) {
+void selection(MouseEvent* mevnt) {
(void)mevnt;
unsigned bol = buf_bol(&Buffer, DotEnd);
Rune r = buf_get(&Buffer, DotEnd);
void search(MouseEvent* mevnt) {
if (DotBeg == DotEnd) {
move_cursor(mevnt);
- select(mevnt);
+ selection(mevnt);
}
buf_find(&Buffer, &DotBeg, &DotEnd);
unsigned x, y;
void (*Actions[5][3])(MouseEvent* mevnt) = {
[MOUSE_LEFT] = {
[SINGLE_CLICK] = move_cursor,
- [DOUBLE_CLICK] = select,
+ [DOUBLE_CLICK] = selection,
[TRIPLE_CLICK] = bigword,
},
[MOUSE_MIDDLE] = {
}
}
-void screen_getcoords(Buf* buf, unsigned pos, unsigned* posx, unsigned* posy) {
- for (unsigned y = 0; y < NumRows; y++) {
- unsigned start = Rows[y]->off;
- unsigned end = Rows[y]->off + Rows[y]->rlen - 1;
- if (start <= pos && pos <= end) {
- unsigned off = start;
- for (unsigned x = 0; x < NumCols;) {
- if (off == pos) {
- *posy = y, *posx = x;
- return;
- }
- x += runewidth(x, buf_get(buf,off++));
- }
- break;
- }
- }
-}
-
void screen_update(Buf* buf, unsigned csr, unsigned* csrx, unsigned* csry) {
/* scroll the view and reflow the screen lines */
sync_view(buf, csr);
unsigned DotEnd;
enum ColorScheme ColorBase;
-void move_pointer(unsigned x, unsigned y) { }
+void move_pointer(unsigned x, unsigned y) {
+ (void)x;
+ (void)y;
+}
int main(int argc, char** argv) {
atf_init(argc,argv);