void view_undo(View* view);
void view_redo(View* view);
void view_putstr(View* view, char* str);
-char* view_getstr(View* view, Sel* sel);
+char* view_getstr(View* view);
char* view_getcmd(View* view);
char* view_getword(View* view);
char* view_getctx(View* view);
char* str = NULL;
size_t off = getoffset(view, row, col);
if (off != SIZE_MAX) {
- Sel sel = { .beg = off, .end = off };
- if (buf_insel(&(view->buffer), NULL, off))
- sel = *(getsel(view));
- else
- buf_selword(&(view->buffer), isword, &sel);
- str = view_getstr(view, &sel);
+ /* str = buf_fetchat(buf, isword, off) */
+// Sel sel = { .beg = off, .end = off };
+// if (buf_insel(&(view->buffer), NULL, off))
+// sel = *(getsel(view));
+// else
+// buf_selword(&(view->buffer), isword, &sel);
+// str = view_getstr(view, &sel);
}
return str;
}
buf_puts(&(view->buffer), str, NULL);
}
-char* view_getstr(View* view, Sel* range) {
- return buf_gets(&(view->buffer), (range ? range : getsel(view)));
+char* view_getstr(View* view) {
+ return buf_gets(&(view->buffer), NULL);
}
char* view_getcmd(View* view) {
if (!view_selsize(view))
buf_selctx(&(view->buffer), riscmd, NULL);
- return view_getstr(view, NULL);
+ return view_getstr(view);
}
void view_selctx(View* view) {
char* view_getctx(View* view) {
view_selctx(view);
- return view_getstr(view, NULL);
+ return view_getstr(view);
}
void view_scroll(View* view, int move) {
if (!view_selsize(view))
select_line(arg);
/* now perform the cut */
- char* str = view_getstr(view, NULL);
+ char* str = view_getstr(view);
x11_sel_set(CLIPBOARD, str);
if (str && *str) delete(arg);
}
/* select the current line if no selection */
if (!view_selsize(win_view(FOCUSED)))
select_line(arg);
- char* str = view_getstr(win_view(FOCUSED), NULL);
+ char* str = view_getstr(win_view(FOCUSED));
x11_sel_set(CLIPBOARD, str);
}
static void tag_exec(Tag* tag, char* arg) {
/* if we didnt get an arg, find one in the selection */
- if (!arg) arg = view_getstr(win_view(TAGS), NULL);
- if (!arg) arg = view_getstr(win_view(EDIT), NULL);
+ if (!arg) arg = view_getstr(win_view(TAGS));
+ if (!arg) arg = view_getstr(win_view(EDIT));
/* execute the tag handler */
tag->action(arg);
free(arg);
/* get the selection that the command will operate on */
if (op && op != '<' && op != '!' && 0 == view_selsize(win_view(EDIT)))
view_selectall(win_view(EDIT));
- char* input = view_getstr(win_view(EDIT), NULL);
+ char* input = view_getstr(win_view(EDIT));
size_t len = (input ? strlen(input) : 0);
View *tags = win_view(TAGS), *edit = win_view(EDIT), *curr = win_view(FOCUSED);
static void complete(char* arg) {
View* view = win_view(FOCUSED);
view_selectobj(view, risword);
- cmd_execwitharg(CMD_COMPLETE, view_getstr(view, NULL));
+ cmd_execwitharg(CMD_COMPLETE, view_getstr(view));
}
static void jump_to(char* arg) {