]> git.mdlowis.com Git - projs/tide.git/commitdiff
Added logic to jump to specific line number
authorMichael D. Lowis <mike@mdlowis.com>
Sat, 3 Dec 2016 04:08:40 +0000 (23:08 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Sat, 3 Dec 2016 04:08:40 +0000 (23:08 -0500)
xedit.c

diff --git a/xedit.c b/xedit.c
index a0dff6722ca8a6d143253a82df022b170d3935ab..df10da7c2ac29056efc931ad279b1b298c537b42 100644 (file)
--- 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);
+                }
             }
         }
     }