From: Michael D. Lowis Date: Sat, 3 Dec 2016 04:08:40 +0000 (-0500) Subject: Added logic to jump to specific line number X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=77a1713893cc359c3c3ef836b0322e581ca69b27;p=projs%2Ftide.git Added logic to jump to specific line number --- diff --git a/xedit.c b/xedit.c index a0dff67..df10da7 100644 --- a/xedit.c +++ b/xedit.c @@ -516,16 +516,22 @@ static void open_file(void) { static void goto_ctag(void) { char* str = view_getctx(currview()); if (str) { - PickTagCmd[2] = str; - char* pick = cmdread(PickTagCmd, NULL); - if (pick) { - Buf* buf = getbuf(EDIT); - if (0 == strncmp(buf->path, pick, strlen(buf->path))) { - view_setln(getview(EDIT), strtoul(strrchr(pick, ':')+1, NULL, 0)); - Focused = EDIT; - } else { - OpenCmd[1] = pick; - cmdrun(OpenCmd, NULL); + size_t line = strtoul(str, NULL, 0); + if (line) { + view_setln(getview(EDIT), line); + Focused = EDIT; + } else { + PickTagCmd[2] = str; + char* pick = cmdread(PickTagCmd, NULL); + if (pick) { + Buf* buf = getbuf(EDIT); + if (0 == strncmp(buf->path, pick, strlen(buf->path))) { + view_setln(getview(EDIT), strtoul(strrchr(pick, ':')+1, NULL, 0)); + Focused = EDIT; + } else { + OpenCmd[1] = pick; + cmdrun(OpenCmd, NULL); + } } } }