size_t buf_selsz(Buf* buf);
void buf_selclr(Buf* buf, int dir);
bool buf_insel(Buf* buf, size_t off);
+char* buf_fetch(Buf* buf, bool (*isword)(Rune), size_t off);
/* Screen management functions
*****************************************************************************/
return (off >= sel.beg && off < sel.end);
}
+char* buf_fetch(Buf* buf, bool (*isword)(Rune), size_t off) {
+ if (!buf_insel(buf, off)) {
+ buf->selection = (Sel){ .beg = off, .end = off };
+ buf_selword(buf, isword);
+ }
+ return buf_gets(buf);
+}
+
/******************************************************************************/
static void selblock(Buf* buf, Rune first, Rune last) {
if (end > beg) beg++; else end++;
buf->selection.beg = beg, buf->selection.end = end;
}
-
-
char* view_fetch(View* view, size_t row, size_t col, bool (*isword)(Rune)) {
char* str = NULL;
size_t off = getoffset(view, row, col);
- if (off != SIZE_MAX) {
- /* str = buf_fetchat(buf, isword, off) */
-// Sel sel = { .beg = off, .end = off };
-// if (buf_insel(BUF, NULL, off))
-// sel = *(getsel(view));
-// else
-// buf_selword(BUF, isword, &sel);
-// str = view_getstr(view, &sel);
- }
+ if (off != SIZE_MAX)
+ str = buf_fetch(BUF, isword, off);
return str;
}
if (bything == buf_byline)
buf_setcol(BUF);
if (!extsel)
- buf_selclr(BUF, move);
+ buf_selclr(BUF, RIGHT);
}
/* only update column if not moving vertically */
if (bything != buf_byline)
static void draw_view(int i, size_t nrows, drawcsr* csr, int bg, int fg, int sel);
static void draw_hrule(drawcsr* csr);
static void draw_scroll(drawcsr* csr);
+static void draw_glyphs(size_t x, size_t y, UGlyph* glyphs, size_t rlen, size_t ncols);
static void xupdate(Job* job);
static void xfocus(XEvent* e);
enum { FontCacheSize = 16 };
-static void draw_glyphs(size_t x, size_t y, UGlyph* glyphs, size_t rlen, size_t ncols);
static WinRegion getregion(size_t x, size_t y);
static struct XSel* selfetch(Atom atom);
static void xftcolor(XftColor* xc, int id);
SearchDir *= (x11_keymodsset(ModShift) ? -1 : +1);
free(SearchTerm);
SearchTerm = view_fetch(win_view(id), row, col, risfile);
+ view_findstr(win_view(id), SearchDir, SearchTerm);
}
}