From 4acc767d3be73bf6de60b52507319fadbd6eeb68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20B=C3=BCnzli?= Date: Mon, 8 Sep 2008 14:06:06 +0200 Subject: [PATCH] Bug 331940 - Should be able to pass a line number to the external viewer/editor. r=gavin --- browser/app/profile/firefox.js | 3 + browser/base/content/browser.js | 13 +--- .../components/console/content/console.xul | 1 + .../console/content/consoleBindings.xml | 6 +- .../viewsource/content/viewSourceUtils.js | 61 +++++++++++++++---- 5 files changed, 56 insertions(+), 28 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index ca53434173f5..439f42be4155 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -537,6 +537,9 @@ pref("layout.spellcheckDefault", 1); pref("view_source.editor.path", ""); pref("view_source.editor.external", false); +// allows to add further arguments to the editor; use the %LINE% placeholder +// for jumping to a specific line (e.g. "/line:%LINE%" or "--goto %LINE%") +pref("view_source.editor.args", ""); pref("browser.send_pings", false); diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index c54eecf4ae3a..d42f39d26901 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1896,18 +1896,7 @@ function BrowserViewSourceOfDocument(aDocument) // If no page descriptor is available, just use the view-source URL... } - ViewSourceOfURL(webNav.currentURI.spec, pageCookie, aDocument); -} - -function ViewSourceOfURL(aURL, aPageDescriptor, aDocument) -{ - var utils = window.top.gViewSourceUtils; - if (getBoolPref("view_source.editor.external", false)) { - utils.openInExternalEditor(aURL, aPageDescriptor, aDocument); - } - else { - utils.openInInternalViewer(aURL, aPageDescriptor, aDocument); - } + top.gViewSourceUtils.viewSource(webNav.currentURI.spec, pageCookie, aDocument); } // doc - document to use for source, or null for this window's document diff --git a/toolkit/components/console/content/console.xul b/toolkit/components/console/content/console.xul index 3d6b946c3756..78dab86b3b01 100644 --- a/toolkit/components/console/content/console.xul +++ b/toolkit/components/console/content/console.xul @@ -59,6 +59,7 @@