* registrar: should remove invalid windows from registry when detected
* tide: Ctrl+D should not pass tag name as arg when executing tag commands
* tide: should re-register with the registrar when a new registrar is launched
-* tide: Line - Get the current line number(s) containing the selection
* tide: gap buffer does not handle UTF-8 currently
## BACKLOG
bool buf_findstr(Buf* buf, int dir, char* str);
void buf_setln(Buf* buf, size_t line);
+void buf_getln(Buf* buf, size_t* begln, size_t* endln);
void buf_getcol(Buf* buf);
void buf_setcol(Buf* buf);
buf->selection.beg = buf->selection.end = curr;
}
+void buf_getln(Buf* buf, size_t* begln, size_t* endln) {
+ size_t line = 1, curr = 0, end = buf_end(buf);
+ size_t sbeg = buf_selbeg(buf), send = buf_selend(buf);
+ while (curr < end) {
+ size_t next = buf_byline(buf, curr, DOWN);
+ if (curr <= sbeg && sbeg < next) {
+ *begln = line, *endln = line;
+ }
+ if (curr <= send && send < next) {
+ *endln = line;
+ break;
+ }
+ if (curr == next) break;
+ line++, curr = next;
+ }
+}
+
void buf_getcol(Buf* buf) {
Sel sel = buf->selection; //getsel(buf, NULL);
size_t pos = sel.end, curr = buf_bol(buf, pos);
} Tag;
char* ARGV0;
-static Tag Builtins[17];
+static Tag Builtins[18];
static Time Now;
static struct XConf X;
static int KeyBtnState;
job_kill(job);
}
+static void tag_line(char* cmd) {
+ (void)cmd;
+ char buf[256] = {0};
+ size_t lnbeg = 1, lnend = 1;
+ buf_getln(win_buf(EDIT), &lnbeg, &lnend);
+ if (lnbeg == lnend)
+ snprintf(buf, sizeof(buf)-1, "%lu", lnbeg);
+ else
+ snprintf(buf, sizeof(buf)-1, "%lu:%lu", lnbeg, lnend);
+ view_paste(win_view(TAGS), buf);
+}
+
/* Main Routine
******************************************************************************/
-static Tag Builtins[17] = {
+static Tag Builtins[18] = {
{ .tag = "Cut", .action = cut },
{ .tag = "Copy", .action = copy },
{ .tag = "Del", .action = quit },
{ .tag = "Undo", .action = tag_undo },
{ .tag = "Font", .action = win_font },
{ .tag = "Kill", .action = tag_kill },
+ { .tag = "Line", .action = tag_line },
{ .tag = NULL, .action = NULL }
};