From 4459827556779c28745b131dc11712f42befd709 Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Wed, 7 Jan 2009 08:57:55 -0500 Subject: [PATCH 01/71] Moved SCM HACKING disc to vimp/TODO and added to it. --- HACKING | 8 -------- vimperator/TODO | 13 +++++++++++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/HACKING b/HACKING index 85cc55c0..3a0542fb 100644 --- a/HACKING +++ b/HACKING @@ -137,12 +137,4 @@ TODO: Document the existence of remote branches and discuss when and how to be added to a new branch. Keep in mind that git is not the most intuitive SCM. - I don't agree. git is about as intuitive as any other SCM, but, - regardless, it's by far one of the most popular. There are - countless git walkthroughs, FAQs, tips pages (not to mention 'git - help') that I don't see the need to duplicate them here. As for - branches, 'git branch' should be sufficient, and, if not, there's - a list on gitweb. - --Kris - # vim: set fdm=marker sw=4 ts=4 et ai: diff --git a/vimperator/TODO b/vimperator/TODO index 4300919c..2f3f6971 100644 --- a/vimperator/TODO +++ b/vimperator/TODO @@ -98,6 +98,19 @@ FEATURES: have a look into the split browser extension 1 Add information to liberator/HACKING file about testing and optimization 1 Document remote branches in liberator/HACKING + I don't agree. git is about as intuitive as any other SCM, but, + regardless, it's by far one of the most popular. There are + countless git walkthroughs, FAQs, tips pages (not to mention 'git + help') that I don't see the need to duplicate them here. As for + branches, 'git branch' should be sufficient, and, if not, there's + a list on gitweb. --Kris + I wasn't trying to say that git was a problem (though other DVCS + have more accessible help systems; except for very complex + projects, I think Mercurial is a much more comfortable DVCS to + learn, use, and navigate). I was saying that it might be nice if + the remote branches (and related polices) were documented. Yes, + anyone can do a "git branch -r", but seeing that a branch exists + is not the same as understanding why it's there. --Ted 1 Reformat liberator/HACKING so that git diff can find sections and report changes @ somewhere - many other ideas are listed in the wiki From b90013213341525198c73eba39672cbbe0678231 Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Wed, 7 Jan 2009 09:00:33 -0500 Subject: [PATCH 02/71] First stab at HACKING filetype (asciidoc?) --- HACKING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HACKING b/HACKING index 3a0542fb..51951b27 100644 --- a/HACKING +++ b/HACKING @@ -137,4 +137,4 @@ TODO: Document the existence of remote branches and discuss when and how to be added to a new branch. Keep in mind that git is not the most intuitive SCM. -# vim: set fdm=marker sw=4 ts=4 et ai: +# vim: set ft=asciidoc fdm=marker sw=4 ts=4 et ai: From 5050b6fee309de0c99908f2d70b3ac5f1735d933 Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Wed, 7 Jan 2009 09:07:00 -0500 Subject: [PATCH 03/71] HACKING comment about using 'new' --- HACKING | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HACKING b/HACKING index 51951b27..bd3861c3 100644 --- a/HACKING +++ b/HACKING @@ -121,6 +121,8 @@ We try to be quite consistent, but of course, that's not always possible. I don't like unnecessary use of 'new', I don't like 'new'. --djk + There is semantic value to using "new." It's good CBSE. --Ted + == Testing/Optimization == TODO: Add some information here about testing/validation/etc. From c54c179d98b8eafcb293e50bb5d76ba374ee44b2 Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Wed, 7 Jan 2009 10:34:33 -0500 Subject: [PATCH 04/71] Added small Makefiles to doc dirs to make building docs more convenient. --- muttator/locale/en-US/Makefile | 9 +++++++++ vimperator/locale/en-US/Makefile | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 muttator/locale/en-US/Makefile create mode 100644 vimperator/locale/en-US/Makefile diff --git a/muttator/locale/en-US/Makefile b/muttator/locale/en-US/Makefile new file mode 100644 index 00000000..c2521e8b --- /dev/null +++ b/muttator/locale/en-US/Makefile @@ -0,0 +1,9 @@ +THISLOCALE=$(notdir $(shell pwd)) + +all: *.html + +%: %.html %.txt + @make $@.html + +%.html: %.txt asciidoc.conf + @make -C ../../ locale/$(THISLOCALE)/$@ diff --git a/vimperator/locale/en-US/Makefile b/vimperator/locale/en-US/Makefile new file mode 100644 index 00000000..c2521e8b --- /dev/null +++ b/vimperator/locale/en-US/Makefile @@ -0,0 +1,9 @@ +THISLOCALE=$(notdir $(shell pwd)) + +all: *.html + +%: %.html %.txt + @make $@.html + +%.html: %.txt asciidoc.conf + @make -C ../../ locale/$(THISLOCALE)/$@ From da0a6da5be22640a47a1c5be6f82df8c5978fa3e Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Wed, 7 Jan 2009 10:56:01 -0500 Subject: [PATCH 05/71] Remove redundant make from doc Makefiles --- muttator/locale/en-US/Makefile | 2 +- vimperator/locale/en-US/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/muttator/locale/en-US/Makefile b/muttator/locale/en-US/Makefile index c2521e8b..1451eb48 100644 --- a/muttator/locale/en-US/Makefile +++ b/muttator/locale/en-US/Makefile @@ -3,7 +3,7 @@ THISLOCALE=$(notdir $(shell pwd)) all: *.html %: %.html %.txt - @make $@.html + @ %.html: %.txt asciidoc.conf @make -C ../../ locale/$(THISLOCALE)/$@ diff --git a/vimperator/locale/en-US/Makefile b/vimperator/locale/en-US/Makefile index c2521e8b..1451eb48 100644 --- a/vimperator/locale/en-US/Makefile +++ b/vimperator/locale/en-US/Makefile @@ -3,7 +3,7 @@ THISLOCALE=$(notdir $(shell pwd)) all: *.html %: %.html %.txt - @make $@.html + @ %.html: %.txt asciidoc.conf @make -C ../../ locale/$(THISLOCALE)/$@ From 52667c8a6378b30b29cc45730e892d9f90ad7ef0 Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Wed, 7 Jan 2009 10:57:02 -0500 Subject: [PATCH 06/71] Remove escaping in marks.txt; replace with inline passthrough (for old asciidoc versions that don't automatically URLize without braces. --- vimperator/locale/en-US/marks.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vimperator/locale/en-US/marks.txt b/vimperator/locale/en-US/marks.txt index f3386a34..9295c117 100644 --- a/vimperator/locale/en-US/marks.txt +++ b/vimperator/locale/en-US/marks.txt @@ -187,7 +187,7 @@ ________________________________________________________________________________ ||:qma[rk] {a-zA-Z0-9} [a][url][a]|| + ________________________________________________________________________________ Mark a URL with a letter for quick access. You can also mark whole groups like this: + -[c]:qmark f \http://forum1.com, \http://forum2.com, imdb some artist[c] +[c]:qmark f +++http://forum1.com+++, +++http://forum2.com+++, imdb some artist[c] ________________________________________________________________________________ From 3beb76a4b60df929ecc3a74588ed2a44176d9b6b Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Wed, 7 Jan 2009 11:03:00 -0500 Subject: [PATCH 07/71] Added NEWS item about using make from within doc dirs. --- vimperator/NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/vimperator/NEWS b/vimperator/NEWS index dc72df66..b2161a57 100644 --- a/vimperator/NEWS +++ b/vimperator/NEWS @@ -21,6 +21,7 @@ * IMPORTANT: 'verbose' is now by default at 1, set to 0 to not show any status messages * IMPORTANT: $VIMPERATOR_HOME is no longer used. + * Now dev's can do "make" or even "make marks" from within the locale/*/ directories * Added ~/.vimperator/info/{profile}/, similar to viminfo * added $VIMPERATOR_RUNTIME, $VIMPERATOR_INIT * :hardcopy now supports output redirection to a file on Unix and MacUnix From 653ff0fb72e3cca2e0960442b732dcb22e9165ee Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Wed, 7 Jan 2009 12:24:51 -0500 Subject: [PATCH 08/71] More doc Makefile convenience edits. --- common/Makefile.common | 7 ++++--- muttator/locale/en-US/Makefile | 17 +++++++++++++---- vimperator/locale/en-US/Makefile | 17 +++++++++++++---- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/common/Makefile.common b/common/Makefile.common index 8bb4edaf..c630005e 100644 --- a/common/Makefile.common +++ b/common/Makefile.common @@ -7,6 +7,7 @@ BASE = $(TOP)/../common DOC_SRC_FILES = $(wildcard locale/*/*.txt) DOC_FILES = ${DOC_SRC_FILES:%.txt=%.html} +DOC_DEPS = $(wildcard locale/*/asciidoc.conf) MAKE_JAR = VERSION="$(VERSION)" DATE="$(BUILD_DATE)" sh $(BASE)/make_jar.sh @@ -106,12 +107,12 @@ $(JAR): doc #### doc check-asciidoc: - @asciidoc --version | awk '{ exit $$2 !~ /^8\.2\./ }' || \ + @$(ASCIIDOC) --version | awk '{ exit $$2 !~ /^8\.2\./ }' || \ echo >&2 "Warning: asciidoc versions other than 8.2.x are unsupported" -${DOC_FILES}: %.html: %.txt $(BASE)/Makefile.common locale/en-US/asciidoc.conf +${DOC_FILES}: %.html: %.txt $(BASE)/Makefile.common $(DOC_DEPS) @echo "DOC $@" - ${ASCIIDOC} --unsafe -a linkcss -a quirks! -a doctitle="$(shell basename $@)" -o $@ $< + $(ASCIIDOC) --unsafe -a linkcss -a quirks! -a doctitle="$(shell basename $@)" -o $@ $< T2T = $(wildcard locale/*/*.t2t) t2t: $(T2T:%.t2t=%.xhtml) diff --git a/muttator/locale/en-US/Makefile b/muttator/locale/en-US/Makefile index 1451eb48..2d2deab1 100644 --- a/muttator/locale/en-US/Makefile +++ b/muttator/locale/en-US/Makefile @@ -1,9 +1,18 @@ -THISLOCALE=$(notdir $(shell pwd)) +THIS_LOCALE = $(notdir $(shell pwd)) +DOC_FILES = $(addsuffix .html,$(basename $(wildcard *.txt))) -all: *.html +.PHONY: all doc clean distclean + +doc: $(DOC_FILES) + +clean: + find . -name '*~' -exec rm -f {} \; + +distclean: clean + rm -f $(DOC_FILES) %: %.html %.txt @ -%.html: %.txt asciidoc.conf - @make -C ../../ locale/$(THISLOCALE)/$@ +%.html: %.txt ../../../common/Makefile.common asciidoc.conf + @make -C ../../ locale/$(THIS_LOCALE)/$@ diff --git a/vimperator/locale/en-US/Makefile b/vimperator/locale/en-US/Makefile index 1451eb48..2d2deab1 100644 --- a/vimperator/locale/en-US/Makefile +++ b/vimperator/locale/en-US/Makefile @@ -1,9 +1,18 @@ -THISLOCALE=$(notdir $(shell pwd)) +THIS_LOCALE = $(notdir $(shell pwd)) +DOC_FILES = $(addsuffix .html,$(basename $(wildcard *.txt))) -all: *.html +.PHONY: all doc clean distclean + +doc: $(DOC_FILES) + +clean: + find . -name '*~' -exec rm -f {} \; + +distclean: clean + rm -f $(DOC_FILES) %: %.html %.txt @ -%.html: %.txt asciidoc.conf - @make -C ../../ locale/$(THISLOCALE)/$@ +%.html: %.txt ../../../common/Makefile.common asciidoc.conf + @make -C ../../ locale/$(THIS_LOCALE)/$@ From 392f33156231ab76bb27021118ccbe6252c73e8a Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Wed, 7 Jan 2009 19:35:03 +0100 Subject: [PATCH 09/71] changed Makefile to a symlink instead of a copy, although symlinking to the vimperator/ dir is not perfect. Do we really need separate Makefiles for each doc dir instead of just make doc? --- muttator/locale/en-US/Makefile | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) mode change 100644 => 120000 muttator/locale/en-US/Makefile diff --git a/muttator/locale/en-US/Makefile b/muttator/locale/en-US/Makefile deleted file mode 100644 index 2d2deab1..00000000 --- a/muttator/locale/en-US/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -THIS_LOCALE = $(notdir $(shell pwd)) -DOC_FILES = $(addsuffix .html,$(basename $(wildcard *.txt))) - -.PHONY: all doc clean distclean - -doc: $(DOC_FILES) - -clean: - find . -name '*~' -exec rm -f {} \; - -distclean: clean - rm -f $(DOC_FILES) - -%: %.html %.txt - @ - -%.html: %.txt ../../../common/Makefile.common asciidoc.conf - @make -C ../../ locale/$(THIS_LOCALE)/$@ diff --git a/muttator/locale/en-US/Makefile b/muttator/locale/en-US/Makefile new file mode 120000 index 00000000..e1e706f9 --- /dev/null +++ b/muttator/locale/en-US/Makefile @@ -0,0 +1 @@ +../../../vimperator/locale/en-US/Makefile \ No newline at end of file From eb9863789c78bcae9961388381cd05a78d7737a5 Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Wed, 7 Jan 2009 13:54:32 -0500 Subject: [PATCH 10/71] Revert "Added NEWS item about using make from within doc dirs." This reverts commit 3767748f8d5540bcc5bd43e2aa4770379ed04c77. (no need for NEWS item about dev build stuff; doc it elsewhere) --- vimperator/NEWS | 1 - 1 file changed, 1 deletion(-) diff --git a/vimperator/NEWS b/vimperator/NEWS index b2161a57..dc72df66 100644 --- a/vimperator/NEWS +++ b/vimperator/NEWS @@ -21,7 +21,6 @@ * IMPORTANT: 'verbose' is now by default at 1, set to 0 to not show any status messages * IMPORTANT: $VIMPERATOR_HOME is no longer used. - * Now dev's can do "make" or even "make marks" from within the locale/*/ directories * Added ~/.vimperator/info/{profile}/, similar to viminfo * added $VIMPERATOR_RUNTIME, $VIMPERATOR_INIT * :hardcopy now supports output redirection to a file on Unix and MacUnix From 9b53463bbb6d93eda5a204846e3780de225664bb Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 7 Jan 2009 14:12:36 -0500 Subject: [PATCH 11/71] Comment on 'new' in HACKING --- HACKING | 19 +++++++++++++++++++ vimperator/TODO | 13 ------------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/HACKING b/HACKING index bd3861c3..5181acb7 100644 --- a/HACKING +++ b/HACKING @@ -123,6 +123,12 @@ We try to be quite consistent, but of course, that's not always possible. There is semantic value to using "new." It's good CBSE. --Ted + There's no semantic value. It's reasonable to infer that any function + named in CamelCase is a constructor. That's the case with all such + internal functions. As far as I'm concerned, 'new' is a hack. Actually, + most of JS is a hack... + --Kris + == Testing/Optimization == TODO: Add some information here about testing/validation/etc. @@ -138,5 +144,18 @@ TODO: Document the existence of remote branches and discuss when and how to look if an old branch needs to be maintained or a feature needs to be added to a new branch. Keep in mind that git is not the most intuitive SCM. + I don't agree. git is about as intuitive as any other SCM, but, + regardless, it's by far one of the most popular. There are + countless git walkthroughs, FAQs, tips pages (not to mention 'git + help') that I don't see the need to duplicate them here. As for + branches, 'git branch' should be sufficient, and, if not, there's + a list on gitweb. --Kris + I wasn't trying to say that git was a problem (though other DVCS + have more accessible help systems; except for very complex + projects, I think Mercurial is a much more comfortable DVCS to + learn, use, and navigate). I was saying that it might be nice if + the remote branches (and related polices) were documented. Yes, + anyone can do a "git branch -r", but seeing that a branch exists + is not the same as understanding why it's there. --Ted # vim: set ft=asciidoc fdm=marker sw=4 ts=4 et ai: diff --git a/vimperator/TODO b/vimperator/TODO index 2f3f6971..4300919c 100644 --- a/vimperator/TODO +++ b/vimperator/TODO @@ -98,19 +98,6 @@ FEATURES: have a look into the split browser extension 1 Add information to liberator/HACKING file about testing and optimization 1 Document remote branches in liberator/HACKING - I don't agree. git is about as intuitive as any other SCM, but, - regardless, it's by far one of the most popular. There are - countless git walkthroughs, FAQs, tips pages (not to mention 'git - help') that I don't see the need to duplicate them here. As for - branches, 'git branch' should be sufficient, and, if not, there's - a list on gitweb. --Kris - I wasn't trying to say that git was a problem (though other DVCS - have more accessible help systems; except for very complex - projects, I think Mercurial is a much more comfortable DVCS to - learn, use, and navigate). I was saying that it might be nice if - the remote branches (and related polices) were documented. Yes, - anyone can do a "git branch -r", but seeing that a branch exists - is not the same as understanding why it's there. --Ted 1 Reformat liberator/HACKING so that git diff can find sections and report changes @ somewhere - many other ideas are listed in the wiki From 16ea6a79d9354a3d9d0e5b293b22c68e075035dc Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Wed, 7 Jan 2009 20:54:09 +0100 Subject: [PATCH 12/71] make :open foo faster on certain hardware/OS configurations (where foo is a completion which might take up to 20 seconds to return all results) Still very, very buggy. --- common/content/ui.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/common/content/ui.js b/common/content/ui.js index 8b74db3e..0ee238b2 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -388,7 +388,30 @@ function CommandLine() //{{{ { function done() !(idx >= n + context.items.length || idx == -2 && !context.items.length); while (context.incomplete && !done()) - liberator.threadYield(true, true); + { + // threadYield(true, true) would be better, but it does not return on my + // machine until all awesomebar completions were reported, making + // :open foo nearly unusable, if the first 2 foo-completions would + // be there fast, but it takes up to 20 sec to find more foo-completions + // + // The strange thing is, I tested the 2009-01-07 nightly at work in Windows + // and it seemed to work perfectly there. Will have to see if it's a + // hardware (dual core there, vs. P4 at home) issue or an OS issue. + // + // While I *really* prefer this solution over my hack + // when it works, we can't have a nearly-defect :open + // prompt when releasing vimp 2.0, even not just on certain + // computers, as :open is probably the most often used ex-command + // in vimperator + // + // liberator.threadYield(false, true); is just a temporary measure as + // it has other problems (hitting tab often in a row), until we find the + // source of the problem (which we hopefully do, as I really don't want to + // have to revert to my hack when better solutions exist) + liberator.dump("before yielding"); + liberator.threadYield(false, true); + liberator.dump("after yielding"); + } if (done()) break; n += context.items.length; From d2a96e447518c8fdbff90195aa91c0e7a548e334 Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Wed, 7 Jan 2009 21:06:31 +0100 Subject: [PATCH 13/71] added comment to HACKING about new --- HACKING | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/HACKING b/HACKING index 5181acb7..bf24f6aa 100644 --- a/HACKING +++ b/HACKING @@ -129,6 +129,15 @@ We try to be quite consistent, but of course, that's not always possible. most of JS is a hack... --Kris + There is semantic value: With new you know for SURE it's calling the + constructor of a class, with CamelCase only you just ASSUME you do. + I am all about making code clearer also to new developers. And this + includes getting rid of as many assumptions as possible, by making + things explicit, when they don't hurt readability (and new doesn't + for me). It's not so important, that i'll change all instances to + new immediately, but will probably do so over time, when I see it. + --mst + == Testing/Optimization == TODO: Add some information here about testing/validation/etc. From 7bb208020c8d4b6eccc075016ada667c77e9f60a Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Wed, 7 Jan 2009 16:06:33 -0500 Subject: [PATCH 14/71] Added expected completion for :delmarks (as discussed on IRC, because expected, it's a bugfix, not a feature) --- common/content/buffer.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index 0205966a..4bea55c2 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -1651,7 +1651,21 @@ function Marks() //{{{ marks.remove(args, special); }, - { bang: true }); + { + bang: true, + completer: function (context) + { + let marks = getSortedMarks(); + + function markinfo( m ) + { + return Math.round(m.position.x * 100) + "% " + Math.round(m.position.y * 100) + "% " + m.location; + } + + context.title = ["Mark", "Line/Column/File"]; + context.completions = [[mark[0], markinfo(mark[1])] for each (mark in marks)]; + } + }); commands.add(["ma[rk]"], "Mark current location within the web page", From 0cc75219d0adb91ac6cb2f9f50f95ebbf941314b Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Wed, 7 Jan 2009 16:11:01 -0500 Subject: [PATCH 15/71] Added completion for :delqmarks. Again, from IRC, bugfix, not feature. --- vimperator/content/bookmarks.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vimperator/content/bookmarks.js b/vimperator/content/bookmarks.js index 753e57a2..c8cb2247 100644 --- a/vimperator/content/bookmarks.js +++ b/vimperator/content/bookmarks.js @@ -962,7 +962,14 @@ function QuickMarks() //{{{ else quickmarks.remove(args.string); }, - { bang: true }); + { + bang: true, + completer: function (context) + { + context.title = ["QuickMark", "URL"]; + context.completions = [[key, val] for ([key, val] in qmarks)]; + } + }); commands.add(["qma[rk]"], "Mark a URL with a letter for quick access", From 15a64a00850af7abef012dfde116e5bbcce73d4c Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 7 Jan 2009 16:41:44 -0500 Subject: [PATCH 16/71] Comment on 'new' in HACKING --- HACKING | 8 ++++++++ common/content/hints.js | 8 +------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/HACKING b/HACKING index bf24f6aa..bc193b4d 100644 --- a/HACKING +++ b/HACKING @@ -138,6 +138,14 @@ We try to be quite consistent, but of course, that's not always possible. new immediately, but will probably do so over time, when I see it. --mst + Actually, you're not sure of anything. You can call new (function (a) + a.substr(2)), and you don't get a new object. The only difference is + that it's called with 'this' set. Given that it's uncouth to name a + non-constructor function in CamelCase, and that most internal + constructors don't require new (and some, like String, break when + you use it), it just seems superfluous and distracting. + --Kris + == Testing/Optimization == TODO: Add some information here about testing/validation/etc. diff --git a/common/content/hints.js b/common/content/hints.js index cdc90dfb..5ae1e892 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -86,13 +86,7 @@ function Hints() //{{{ // Used to open multiple hints function hintSequenceElement(elem) { - // Want to always open sequence hints in background - // (remember: NEW_BACKGROUND_TAB and NEW_TAB semantics assume - // that loadInBackground=true) - if (options.getPref("browser.tabs.loadInBackground")) - buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB); - else - buffer.followLink(elem, liberator.NEW_TAB); + buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB); // Move to next element in sequence // TODO: Maybe we find a *simple* way to keep the hints displayed rather than From 1f2bf969d18bee4040c10776d79ec7d7d45c0542 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 7 Jan 2009 17:16:08 -0500 Subject: [PATCH 17/71] Fix completion bug --- common/content/ui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/content/ui.js b/common/content/ui.js index 0ee238b2..e069478f 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -380,7 +380,7 @@ function CommandLine() //{{{ { // Wait for contexts to complete if necessary. // FIXME: Need to make idx relative to individual contexts. - let list = this.context.contextList.reverse(); + let list = this.context.contextList; if (idx == -2) list = list.slice().reverse(); let n = 0; From 0aeee25e659e22d1d612340c7b455d107b5ccd70 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 7 Jan 2009 17:38:57 -0500 Subject: [PATCH 18/71] Add standard 'mark' completer. Fix x/y transposition in :delm completion --- common/content/buffer.js | 15 +++------------ common/content/completion.js | 13 +++++++++++++ vimperator/content/bookmarks.js | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index 4bea55c2..7985778e 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -1653,18 +1653,7 @@ function Marks() //{{{ }, { bang: true, - completer: function (context) - { - let marks = getSortedMarks(); - - function markinfo( m ) - { - return Math.round(m.position.x * 100) + "% " + Math.round(m.position.y * 100) + "% " + m.location; - } - - context.title = ["Mark", "Line/Column/File"]; - context.completions = [[mark[0], markinfo(mark[1])] for each (mark in marks)]; - } + completer: function (context) completion.mark(context) }); commands.add(["ma[rk]"], @@ -1710,6 +1699,8 @@ function Marks() //{{{ return { + get all() getSortedMarks(), + /** * Add a named mark for the current buffer, at its current position. * If mark matches [A-Z], it's considered a URL mark, and will jump to diff --git a/common/content/completion.js b/common/content/completion.js index 2cf7aa1f..0c1c2dfe 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -1608,6 +1608,19 @@ function Completion() //{{{ context.completions = [item for (item in events.getMacros())]; }, + mark: function mark(context) + { + function percent(i) Math.round(i * 100); + + // FIXME: Line/Column doesn't make sense with % + context.title = ["Mark", "Line Column File"]; + context.keys = { + text: 0, + description: function ([,m]) percent(m.position.y) + "% " + percent(m.position.x) + "% " + m.location + }; + context.completions = marks.all; + }, + menuItem: function menuItem(filter) commands.get("emenu").completer(filter), // XXX option: function option(context, scope) diff --git a/vimperator/content/bookmarks.js b/vimperator/content/bookmarks.js index c8cb2247..7e89fe7d 100644 --- a/vimperator/content/bookmarks.js +++ b/vimperator/content/bookmarks.js @@ -967,7 +967,7 @@ function QuickMarks() //{{{ completer: function (context) { context.title = ["QuickMark", "URL"]; - context.completions = [[key, val] for ([key, val] in qmarks)]; + context.completions = qmarks; } }); From d9418ff43bd39e8393e99bb790ead598aeb44f22 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 7 Jan 2009 17:56:53 -0500 Subject: [PATCH 19/71] Fix menuItem completer, use it for :emenu --- common/content/completion.js | 12 ++++--- common/content/liberator.js | 66 +++++++++++++++++------------------- 2 files changed, 38 insertions(+), 40 deletions(-) diff --git a/common/content/completion.js b/common/content/completion.js index 0c1c2dfe..b59304c2 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -1614,14 +1614,16 @@ function Completion() //{{{ // FIXME: Line/Column doesn't make sense with % context.title = ["Mark", "Line Column File"]; - context.keys = { - text: 0, - description: function ([,m]) percent(m.position.y) + "% " + percent(m.position.x) + "% " + m.location - }; + context.keys.description = function ([,m]) percent(m.position.y) + "% " + percent(m.position.x) + "% " + m.location; context.completions = marks.all; }, - menuItem: function menuItem(filter) commands.get("emenu").completer(filter), // XXX + menuItem: function menuItem(context) + { + context.title = ["Menu Path", "Label"]; + context.keys = { text: "fullMenuPath", description: "label" }; + context.completions = liberator.menuItems; + }, option: function option(context, scope) { diff --git a/common/content/liberator.js b/common/content/liberator.js index dd5d396c..4478c61d 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -206,6 +206,34 @@ const liberator = (function () //{{{ function () { liberator.quit(true); }); }); + // TODO: move this + function getMenuItems() + { + function addChildren(node, parent) + { + for (let [,item] in Iterator(node.childNodes)) + { + if (item.childNodes.length == 0 && item.localName == "menuitem" + && !/rdf:http:/.test(item.label)) // FIXME + { + item.fullMenuPath = parent + item.label; + items.push(item); + } + else + { + let path = parent; + if (item.localName == "menu") + path += item.label + "."; + addChildren(item, path); + } + } + } + + let items = []; + addChildren(document.getElementById(config.guioptions["m"][1]), ""); + return items; + } + registerObserver("load_commands", function () { commands.add(["addo[ns]"], @@ -256,34 +284,6 @@ const liberator = (function () //{{{ completer: function (context, args) completion.dialog(context) }); - // TODO: move this - function getMenuItems() - { - function addChildren(node, parent) - { - for (let [,item] in Iterator(node.childNodes)) - { - if (item.childNodes.length == 0 && item.localName == "menuitem" - && !/rdf:http:/.test(item.label)) // FIXME - { - item.fullMenuPath = parent + item.label; - items.push(item); - } - else - { - let path = parent; - if (item.localName == "menu") - path += item.label + "."; - addChildren(item, path); - } - } - } - - let items = []; - addChildren(document.getElementById(config.guioptions["m"][1]), ""); - return items; - } - commands.add(["em[enu]"], "Execute the specified menu item from the command line", function (args) @@ -305,13 +305,7 @@ const liberator = (function () //{{{ }, { argCount: "1", - // TODO: add this as a standard menu completion function - completer: function (context) - { - context.title = ["Menu Path", "Label"]; - context.keys = { text: "fullMenuPath", description: "label" }; - context.completions = getMenuItems(); - }, + completer: function (context) completion.menuItem(context), literal: 0 }); @@ -597,6 +591,8 @@ const liberator = (function () //{{{ get mode() modes.main, set mode(value) modes.main = value, + get menuItems() getMenuItems(), + // Global constants CURRENT_TAB: 1, NEW_TAB: 2, From 465405bc842b4f590f554b6dafb0abeaf8a20f11 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 7 Jan 2009 18:14:13 -0500 Subject: [PATCH 20/71] Fix :sty site completions --- common/content/completion.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/content/completion.js b/common/content/completion.js index b59304c2..192dfef9 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -285,7 +285,7 @@ CompletionContext.prototype = { set completions(items) { // Accept a generator - if (!(items instanceof Array)) + if (!("length" in items)) items = [x for (x in Iterator(items))]; delete this.cache.filtered; delete this.cache.filter; From ad6557db6d6e290bde5ac34fb0ca97526dc8674a Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 7 Jan 2009 22:29:05 +1100 Subject: [PATCH 21/71] Don't clear the search highlighting when a search is cancelled. --- common/content/find.js | 1 - 1 file changed, 1 deletion(-) diff --git a/common/content/find.js b/common/content/find.js index 0bb125cb..7a426b92 100644 --- a/common/content/find.js +++ b/common/content/find.js @@ -436,7 +436,6 @@ function Search() //{{{ // escape while typing a search searchCanceled: function () { - this.clear(); // TODO: code to reposition the document to the place before search started }, From a98edd97674cca21b5790286234d229ba625b460 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 8 Jan 2009 16:03:05 +1100 Subject: [PATCH 22/71] Ramble on in HACKING. --- HACKING | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/HACKING b/HACKING index bc193b4d..758ab2c1 100644 --- a/HACKING +++ b/HACKING @@ -129,6 +129,10 @@ We try to be quite consistent, but of course, that's not always possible. most of JS is a hack... --Kris + What he said. Although, I would have said "a pretty nifty language + with some regrettable design decisions" now that I'm in therapy. + --djk + There is semantic value: With new you know for SURE it's calling the constructor of a class, with CamelCase only you just ASSUME you do. I am all about making code clearer also to new developers. And this @@ -138,6 +142,14 @@ We try to be quite consistent, but of course, that's not always possible. new immediately, but will probably do so over time, when I see it. --mst + JavaScript doesn't have classes... What about all the other + 'constructor' functions such as Commands? And I think it does hurt + readability because it's pointless. + Anyway, if it's important enough to change it should all be + changed at once. I've removed most of these sorts of + inconsistencies and I wouldn't like to see them reintroduced. + --djk + Actually, you're not sure of anything. You can call new (function (a) a.substr(2)), and you don't get a new object. The only difference is that it's called with 'this' set. Given that it's uncouth to name a @@ -161,12 +173,14 @@ TODO: Document the existence of remote branches and discuss when and how to look if an old branch needs to be maintained or a feature needs to be added to a new branch. Keep in mind that git is not the most intuitive SCM. + I don't agree. git is about as intuitive as any other SCM, but, regardless, it's by far one of the most popular. There are countless git walkthroughs, FAQs, tips pages (not to mention 'git help') that I don't see the need to duplicate them here. As for branches, 'git branch' should be sufficient, and, if not, there's a list on gitweb. --Kris + I wasn't trying to say that git was a problem (though other DVCS have more accessible help systems; except for very complex projects, I think Mercurial is a much more comfortable DVCS to @@ -175,4 +189,6 @@ TODO: Document the existence of remote branches and discuss when and how anyone can do a "git branch -r", but seeing that a branch exists is not the same as understanding why it's there. --Ted + Sure, I agree. --djk + # vim: set ft=asciidoc fdm=marker sw=4 ts=4 et ai: From e581465101a91d4d9a4fafc2f5c9bcbe70342dba Mon Sep 17 00:00:00 2001 From: teramako Date: Thu, 8 Jan 2009 21:19:48 +0900 Subject: [PATCH 23/71] fix: "filesystem is busy" erro on Cygwin --- common/make_jar.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/make_jar.sh b/common/make_jar.sh index 80ddff99..81c23be3 100644 --- a/common/make_jar.sh +++ b/common/make_jar.sh @@ -51,6 +51,6 @@ do ) done -cd $stage; zip -r "$top/$jar" * +(cd $stage; zip -r "$top/$jar" *) rm -rf "$stage" From d90e670d7068c84a33dbc4e0212b374bc151765e Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Thu, 8 Jan 2009 08:51:34 -0500 Subject: [PATCH 24/71] Revert 93b0cf2a063b045268a55fbeac9473ce12234300's changes to hints.js Until liberator.NEW_BACKGROUND_TAB operates differently based on the setting of browser.tabs.loadInBackground, this code must remain. At the moment, NEW_BACKGROUND_TAB only opens a true background tab if loadInBackground=true. When loadInBackground=false, the meaning of NEW_TAB and NEW_BACKGROUND_TAB flip. Hence, until they're invariant, something like ;F (which must always load tabs in the background) has to pay attention to loadInBackground. --- common/content/hints.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/content/hints.js b/common/content/hints.js index 5ae1e892..cdc90dfb 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -86,7 +86,13 @@ function Hints() //{{{ // Used to open multiple hints function hintSequenceElement(elem) { - buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB); + // Want to always open sequence hints in background + // (remember: NEW_BACKGROUND_TAB and NEW_TAB semantics assume + // that loadInBackground=true) + if (options.getPref("browser.tabs.loadInBackground")) + buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB); + else + buffer.followLink(elem, liberator.NEW_TAB); // Move to next element in sequence // TODO: Maybe we find a *simple* way to keep the hints displayed rather than From 994993820f00109da5d80d374cf06726f89e1477 Mon Sep 17 00:00:00 2001 From: teramako Date: Fri, 9 Jan 2009 00:17:18 +0900 Subject: [PATCH 25/71] support multi modifiers --- common/content/events.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/content/events.js b/common/content/events.js index 685754fe..0cd60e18 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -915,7 +915,7 @@ function Events() //{{{ //if (keys[i] == "\\") // FIXME: support the escape key if (keys[i] == "<" && !escapeKey) // start a complex key { - let [match, modifier, keyname] = keys.substr(i).match(/<([CSMA]-)*(.+?)>/i) || []; + let [match, modifier, keyname] = keys.substr(i).match(/<((?:[CSMA]-)*)(.+?)>/i) || []; if (keyname) { if (modifier) // check for modifiers From bfe47dff89ccf51a73b76952069962977494e459 Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Thu, 8 Jan 2009 12:01:31 -0500 Subject: [PATCH 26/71] Fixed browser.followLink so that NEW_TAB semantics are invariant of prefs. --- common/content/buffer.js | 4 +++- common/content/hints.js | 10 ++-------- vimperator/locale/en-US/hints.txt | 9 ++++----- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index 7985778e..5c412b86 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -1123,8 +1123,10 @@ function Buffer() //{{{ { case liberator.NEW_TAB: case liberator.NEW_BACKGROUND_TAB: + let invertLogic = !options.getPref("browser.tabs.loadInBackground"); + let backgroundDesired = (where == liberator.NEW_BACKGROUND_TAB); ctrlKey = true; - shiftKey = (where != liberator.NEW_BACKGROUND_TAB); + shiftKey = invertLogic ? backgroundDesired : !backgroundDesired; break; case liberator.NEW_WINDOW: shiftKey = true; diff --git a/common/content/hints.js b/common/content/hints.js index cdc90dfb..44516a88 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -86,13 +86,7 @@ function Hints() //{{{ // Used to open multiple hints function hintSequenceElement(elem) { - // Want to always open sequence hints in background - // (remember: NEW_BACKGROUND_TAB and NEW_TAB semantics assume - // that loadInBackground=true) - if (options.getPref("browser.tabs.loadInBackground")) - buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB); - else - buffer.followLink(elem, liberator.NEW_TAB); + buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB); // Move to next element in sequence // TODO: Maybe we find a *simple* way to keep the hints displayed rather than @@ -601,7 +595,7 @@ function Hints() //{{{ mappings.add(myModes, ["F"], "Start QuickHint mode, but open link in a new tab", - function () { hints.show("t"); }); + function () { options.getPref("browser.tabs.loadInBackground") ? hints.show("b") : hints.show("t"); }); mappings.add(myModes, [";"], "Start an extended hint mode", diff --git a/vimperator/locale/en-US/hints.txt b/vimperator/locale/en-US/hints.txt index eedaaf91..21796974 100644 --- a/vimperator/locale/en-US/hints.txt +++ b/vimperator/locale/en-US/hints.txt @@ -22,8 +22,10 @@ ________________________________________________________________________________ |F| + ||#F#{hint}|| ________________________________________________________________________________ -Start QuickHint mode, but open link in a new tab. Like normal QuickHint mode -(activated with [m]f[m]) but opens the link in a new tab. +Start QuickHint mode, but open link in a new tab. Like normal QuickHint +mode (activated with [m]f[m]) but opens the link in a new tab. The new +tab will be loaded in background according to the +\'browser.tabs.loadInBackground' Firefox preference. ________________________________________________________________________________ @@ -59,9 +61,6 @@ this hint mode. Then press [a]24[a] to copy the hint location. Hintable elements for all extended hint modes can be set in the 'extendedhinttags' XPath string. - -Note: The behavior of [m];t[m] and [m];b[m] is inverted if the -\'browser.tabs.loadInBackground' Firefox preference is set to false. ________________________________________________________________________________ // vim: set syntax=asciidoc: From f901cb1f42329155a053baad87febcac1accd5c6 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 8 Jan 2009 14:14:57 -0500 Subject: [PATCH 27/71] Fix last commit --- common/content/buffer.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index 5c412b86..688ba8da 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -1123,10 +1123,8 @@ function Buffer() //{{{ { case liberator.NEW_TAB: case liberator.NEW_BACKGROUND_TAB: - let invertLogic = !options.getPref("browser.tabs.loadInBackground"); - let backgroundDesired = (where == liberator.NEW_BACKGROUND_TAB); ctrlKey = true; - shiftKey = invertLogic ? backgroundDesired : !backgroundDesired; + shiftKey = (where != liberator.NEW_BACKGROUND_TAB); break; case liberator.NEW_WINDOW: shiftKey = true; @@ -1140,10 +1138,13 @@ function Buffer() //{{{ elem.focus(); let evt = doc.createEvent("MouseEvents"); - ["mousedown", "mouseup", "click"].forEach(function (event) { - evt.initMouseEvent(event, true, true, view, 1, offsetX, offsetY, 0, 0, - ctrlKey, /*altKey*/0, shiftKey, /*metaKey*/ ctrlKey, 0, null); - elem.dispatchEvent(evt); + options.withContext(function () { + options.setPref("browser.tabs.loadInBackground", true); + ["mousedown", "mouseup", "click"].forEach(function (event) { + evt.initMouseEvent(event, true, true, view, 1, offsetX, offsetY, 0, 0, + ctrlKey, /*altKey*/0, shiftKey, /*metaKey*/ ctrlKey, 0, null); + elem.dispatchEvent(evt); + }); }); }, From 438a648b1446ba09e54ac14b8ab67a4554d691bf Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Thu, 8 Jan 2009 17:25:26 -0500 Subject: [PATCH 28/71] Makefile.doc cleanup. Also made Makefile build t2t's too with doc target. --- common/Makefile.common | 29 +++---------- common/Makefile.doc | 70 ++++++++++++++++++++++++++++++++ muttator/locale/en-US/Makefile | 2 +- vimperator/locale/en-US/Makefile | 19 +-------- 4 files changed, 78 insertions(+), 42 deletions(-) create mode 100644 common/Makefile.doc mode change 100644 => 120000 vimperator/locale/en-US/Makefile diff --git a/common/Makefile.common b/common/Makefile.common index c630005e..f3fbc038 100644 --- a/common/Makefile.common +++ b/common/Makefile.common @@ -5,9 +5,8 @@ OS = $(shell uname -s) BUILD_DATE = $(shell date "+%Y/%m/%d %H:%M:%S") BASE = $(TOP)/../common -DOC_SRC_FILES = $(wildcard locale/*/*.txt) -DOC_FILES = ${DOC_SRC_FILES:%.txt=%.html} -DOC_DEPS = $(wildcard locale/*/asciidoc.conf) +DOC_SRC_FILES = $(wildcard locale/*/*.txt) $(wildcard locale/*/*.t2t) +LOCALES = $(wildcard locale/*) MAKE_JAR = VERSION="$(VERSION)" DATE="$(BUILD_DATE)" sh $(BASE)/make_jar.sh @@ -64,8 +63,6 @@ info: @echo -e "jar files $(shell echo ${JAR_FILES} | sed 's/ /\\n /g' )" @echo "xpi files ${XPI_FILES}" -.PHONY: check-asciidoc -doc: check-asciidoc ${DOC_FILES} xpi: ${XPI} jar: ${JAR} @@ -85,7 +82,7 @@ clean: distclean: clean @echo "More cleanup..." - rm -f ${DOC_FILES} + @set -e; for locale in $(LOCALES); do $(MAKE) -C clean; doc; done rm -rf ${BUILD_DIR} #### xpi @@ -104,21 +101,7 @@ $(JAR): doc $(MAKE_JAR) "$(JAR)" "$(JAR_BASES)" "$(JAR_DIRS)" "$(JAR_TEXTS)" "$(JAR_BINS)" "$(JAR_FILES)" @echo "SUCCESS: $@" -#### doc - -check-asciidoc: - @$(ASCIIDOC) --version | awk '{ exit $$2 !~ /^8\.2\./ }' || \ - echo >&2 "Warning: asciidoc versions other than 8.2.x are unsupported" - -${DOC_FILES}: %.html: %.txt $(BASE)/Makefile.common $(DOC_DEPS) - @echo "DOC $@" - $(ASCIIDOC) --unsafe -a linkcss -a quirks! -a doctitle="$(shell basename $@)" -o $@ $< - -T2T = $(wildcard locale/*/*.t2t) -t2t: $(T2T:%.t2t=%.xhtml) -$(T2T:%.t2t=%.xhtml): locale/en-US/config.t2t - -%.xhtml: %.t2t - @echo "T2T $@" - txt2tags --quiet $< +#### doc (see Makefile.doc) +doc: + @set -e; for locale in $(LOCALES); do $(MAKE) -C $$locale doc; done diff --git a/common/Makefile.doc b/common/Makefile.doc new file mode 100644 index 00000000..2d41d3ac --- /dev/null +++ b/common/Makefile.doc @@ -0,0 +1,70 @@ +# Symlink me to locale/*/Makefile + +#### configuration + +BASE = ../../../common + +THIS_LOCALE = $(notdir $(shell pwd)) + +ADC_SRC_FILES = $(wildcard *.txt) +ADC_FILES = $(ADC_SRC_FILES:%.txt=%.html) +ADC_DEPS = asciidoc.conf + +T2T_SRC_FILES = $(wildcard *.t2t) +T2T_FILES = $(T2T_SRC_FILES:%.t2t=%.xhtml) +T2T_DEPS = config.t2t + +DOC_FILES = $(ADC_FILES) $(T2T_FILES) + +ASCIIDOC = asciidoc +TXT2TAGS = txt2tags +AWK = awk + +.SILENT: + +#### rules + +.PHONY: all help doc asciidoc check-asciidoc clean distclean +all: doc + +doc: asciidoc + +help: + @echo "${NAME} ${VERSION} build" + @echo + @echo " make help - display this help" + @echo " make doc - build doc files" + @echo " make asciidoc - build asciidoc'd files only" + @echo " make t2t - build txt2tags'd files only" + @echo " make clean - clean up" + @echo " make distclean - clean up more" + +clean: + @echo "Cleanup..." + find . -name '*~' -exec rm -f {} \; + +distclean: clean + @echo "More cleanup..." + rm -f $(DOC_FILES) + +#### asciidoc + +asciidoc: check-asciidoc $(ADC_FILES) + +check-asciidoc: + @$(ASCIIDOC) --version | $(AWK) '{ exit $$2 !~ /^8\.2\./ }' || \ + echo >&2 "Warning: asciidoc versions other than 8.2.x are unsupported" + +$(ADC_FILES): %.html: %.txt $(BASE)/Makefile.doc $(ADC_DEPS) + @echo "DOC locale/$(THIS_LOCALE)/$@" + $(ASCIIDOC) --unsafe -a linkcss -a quirks! -a doctitle="$(shell basename $@)" -o $@ $< + +#### txt2tags + +$(T2T_FILES): %.xhtml: %.t2t $(BASE)/Makefile.doc $(T2T_DEPS) + @echo "T2T locale/$(THIS_LOCALE)/$@" + txt2tags --quiet $< + +%.xhtml: %.t2t + @echo "T2T $@" + $(TXT2TAGS) --quiet $< diff --git a/muttator/locale/en-US/Makefile b/muttator/locale/en-US/Makefile index e1e706f9..85510a12 120000 --- a/muttator/locale/en-US/Makefile +++ b/muttator/locale/en-US/Makefile @@ -1 +1 @@ -../../../vimperator/locale/en-US/Makefile \ No newline at end of file +../../../common/Makefile.doc \ No newline at end of file diff --git a/vimperator/locale/en-US/Makefile b/vimperator/locale/en-US/Makefile deleted file mode 100644 index 2d2deab1..00000000 --- a/vimperator/locale/en-US/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -THIS_LOCALE = $(notdir $(shell pwd)) -DOC_FILES = $(addsuffix .html,$(basename $(wildcard *.txt))) - -.PHONY: all doc clean distclean - -doc: $(DOC_FILES) - -clean: - find . -name '*~' -exec rm -f {} \; - -distclean: clean - rm -f $(DOC_FILES) - -%: %.html %.txt - @ - -%.html: %.txt ../../../common/Makefile.common asciidoc.conf - @make -C ../../ locale/$(THIS_LOCALE)/$@ diff --git a/vimperator/locale/en-US/Makefile b/vimperator/locale/en-US/Makefile new file mode 120000 index 00000000..85510a12 --- /dev/null +++ b/vimperator/locale/en-US/Makefile @@ -0,0 +1 @@ +../../../common/Makefile.doc \ No newline at end of file From 4b6186caedbdc1183cb9ee14b5489303e7bc52be Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Thu, 8 Jan 2009 17:37:13 -0500 Subject: [PATCH 29/71] Add a t2t target to Makefile.doc for building t2t only. --- common/Makefile.doc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/Makefile.doc b/common/Makefile.doc index 2d41d3ac..5f5b04d3 100644 --- a/common/Makefile.doc +++ b/common/Makefile.doc @@ -27,7 +27,7 @@ AWK = awk .PHONY: all help doc asciidoc check-asciidoc clean distclean all: doc -doc: asciidoc +doc: asciidoc t2t help: @echo "${NAME} ${VERSION} build" @@ -61,6 +61,8 @@ $(ADC_FILES): %.html: %.txt $(BASE)/Makefile.doc $(ADC_DEPS) #### txt2tags +t2t: $(T2T_FILES) + $(T2T_FILES): %.xhtml: %.t2t $(BASE)/Makefile.doc $(T2T_DEPS) @echo "T2T locale/$(THIS_LOCALE)/$@" txt2tags --quiet $< From 52565d5a4815e386c2d15cc6a3fa1648c288672f Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Thu, 8 Jan 2009 17:54:09 -0500 Subject: [PATCH 30/71] More Makefile.doc refactoring. Also allow 'make shortname' to build either t2t or doc or both. --- common/Makefile.doc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/common/Makefile.doc b/common/Makefile.doc index 5f5b04d3..6777d234 100644 --- a/common/Makefile.doc +++ b/common/Makefile.doc @@ -8,11 +8,11 @@ THIS_LOCALE = $(notdir $(shell pwd)) ADC_SRC_FILES = $(wildcard *.txt) ADC_FILES = $(ADC_SRC_FILES:%.txt=%.html) -ADC_DEPS = asciidoc.conf +ADC_DEPS = $(wildcard asciidoc.conf) T2T_SRC_FILES = $(wildcard *.t2t) T2T_FILES = $(T2T_SRC_FILES:%.t2t=%.xhtml) -T2T_DEPS = config.t2t +T2T_DEPS = $(wildcard config.t2t) DOC_FILES = $(ADC_FILES) $(T2T_FILES) @@ -47,6 +47,14 @@ distclean: clean @echo "More cleanup..." rm -f $(DOC_FILES) +#### Makes single-file makes easier to type + +%: %.html %.t2t %.xhtml %.t2t ; + +%: %.html %.txt ; + +%: %.xhtml %.t2t ; + #### asciidoc asciidoc: check-asciidoc $(ADC_FILES) @@ -66,7 +74,3 @@ t2t: $(T2T_FILES) $(T2T_FILES): %.xhtml: %.t2t $(BASE)/Makefile.doc $(T2T_DEPS) @echo "T2T locale/$(THIS_LOCALE)/$@" txt2tags --quiet $< - -%.xhtml: %.t2t - @echo "T2T $@" - $(TXT2TAGS) --quiet $< From 48d8b7cacd92e3fa135fba1d52be4fee3486aad7 Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Thu, 8 Jan 2009 18:04:55 -0500 Subject: [PATCH 31/71] Added comment/query about why mappings.add("F") is doing what it's doing. --- common/content/hints.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/common/content/hints.js b/common/content/hints.js index 44516a88..7ca6801b 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -89,7 +89,7 @@ function Hints() //{{{ buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB); // Move to next element in sequence - // TODO: Maybe we find a *simple* way to keep the hints displayed rather than + // TODO: Maybe we find a *simple* way to keep the hints displayed rather than // showing them again, or is this short flash actually needed as a "usability // feature"? --mst hints.show("F"); @@ -593,6 +593,16 @@ function Hints() //{{{ "Start QuickHint mode", function () { hints.show("o"); }); + // At the moment, "F" calls + // buffer.followLink(clicked_element, DO_WHAT_FIREFOX_DOES_WITH_CNTRL_CLICK) + // It is not clear that it shouldn't be: + // buffer.followLink(clicked_element, !DO_WHAT_FIREFOX_DOES_WITH_CNTRL_CLICK) + // In fact, it might be nice if there was a "dual" to F (like H and + // gH, except that gF is already taken). --tpp + // + // Likewise, it might be nice to have a liberator.NEW_FOREGROUND_TAB + // and then make liberator.NEW_TAB always do what a Cntrl+Click + // does. --tpp mappings.add(myModes, ["F"], "Start QuickHint mode, but open link in a new tab", function () { options.getPref("browser.tabs.loadInBackground") ? hints.show("b") : hints.show("t"); }); From 6534a0c665a07a811aeaf09010420af24f08d1b1 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 8 Jan 2009 20:55:45 -0500 Subject: [PATCH 32/71] Fix tab-completion bugs --- common/content/ui.js | 115 ++++++++++++++++++++++++------------------- 1 file changed, 64 insertions(+), 51 deletions(-) diff --git a/common/content/ui.js b/common/content/ui.js index e069478f..f67f89a5 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -384,37 +384,41 @@ function CommandLine() //{{{ if (idx == -2) list = list.slice().reverse(); let n = 0; - for (let [,context] in Iterator(list)) + try { - function done() !(idx >= n + context.items.length || idx == -2 && !context.items.length); - while (context.incomplete && !done()) + this.waiting = true; + for (let [,context] in Iterator(list)) { - // threadYield(true, true) would be better, but it does not return on my - // machine until all awesomebar completions were reported, making - // :open foo nearly unusable, if the first 2 foo-completions would - // be there fast, but it takes up to 20 sec to find more foo-completions - // - // The strange thing is, I tested the 2009-01-07 nightly at work in Windows - // and it seemed to work perfectly there. Will have to see if it's a - // hardware (dual core there, vs. P4 at home) issue or an OS issue. - // - // While I *really* prefer this solution over my hack - // when it works, we can't have a nearly-defect :open - // prompt when releasing vimp 2.0, even not just on certain - // computers, as :open is probably the most often used ex-command - // in vimperator - // - // liberator.threadYield(false, true); is just a temporary measure as - // it has other problems (hitting tab often in a row), until we find the - // source of the problem (which we hopefully do, as I really don't want to - // have to revert to my hack when better solutions exist) - liberator.dump("before yielding"); - liberator.threadYield(false, true); - liberator.dump("after yielding"); + function done() !(idx >= n + context.items.length || idx == -2 && !context.items.length); + while (context.incomplete && !done()) + // threadYield(true, true) would be better, but it does not return on my + // machine until all awesomebar completions were reported, making + // :open foo nearly unusable, if the first 2 foo-completions would + // be there fast, but it takes up to 20 sec to find more foo-completions + // + // The strange thing is, I tested the 2009-01-07 nightly at work in Windows + // and it seemed to work perfectly there. Will have to see if it's a + // hardware (dual core there, vs. P4 at home) issue or an OS issue. + // + // While I *really* prefer this solution over my hack + // when it works, we can't have a nearly-defect :open + // prompt when releasing vimp 2.0, even not just on certain + // computers, as :open is probably the most often used ex-command + // in vimperator + // + // liberator.threadYield(false, true); is just a temporary measure as + // it has other problems (hitting tab often in a row), until we find the + // source of the problem (which we hopefully do, as I really don't want to + // have to revert to my hack when better solutions exist) + liberator.threadYield(false, true); + if (done()) + break; + n += context.items.length; } - if (done()) - break; - n += context.items.length; + } + finally + { + this.waiting = false; } // See previous FIXME. This will break if new items in @@ -429,6 +433,8 @@ function CommandLine() //{{{ this.itemList.selectItem(idx); }, + ntab: 0, + tab: function tab(reverse) { autocompleteTimer.flush(); @@ -436,34 +442,41 @@ function CommandLine() //{{{ if (this.context.waitingForTab || this.wildIndex == -1) this.complete(true, true); - switch (this.wildtype.replace(/.*:/, "")) + this.ntab++; + if (this.waiting) + return; + + while (this.ntab--) { - case "": - this.select(0); - break; - case "longest": - if (this.items.length > 1) - { - if (this.substring && this.substring != this.completion) - this.completion = this.substring; + switch (this.wildtype.replace(/.*:/, "")) + { + case "": + this.select(0); break; - } - // Fallthrough - case "full": - this.select(reverse ? this.UP : this.DOWN) - break; + case "longest": + if (this.items.length > 1) + { + if (this.substring && this.substring != this.completion) + this.completion = this.substring; + break; + } + // Fallthrough + case "full": + this.select(reverse ? this.UP : this.DOWN) + break; + } + + if (this.type.list) + completionList.show(); + + this.wildIndex = Math.max(0, Math.min(this.wildtypes.length - 1, this.wildIndex + 1)); + this.preview(); + + statusTimer.tell(); } if (this.items.length == 0) - return void liberator.beep(); - - if (this.type.list) - completionList.show(); - - this.wildIndex = Math.max(0, Math.min(this.wildtypes.length - 1, this.wildIndex + 1)); - this.preview(); - - statusTimer.tell(); + liberator.beep(); } } From c4f5d4f84de2f889670477f7eb1606af01c3b31a Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 8 Jan 2009 20:56:26 -0500 Subject: [PATCH 33/71] Fix some inline/help docs. --- common/content/buffer.js | 7 +- common/content/hints.js | 25 ++--- common/content/liberator.js | 2 +- common/content/tabs.js | 64 +++++------ common/content/ui.js | 154 +++++++++++++-------------- vimperator/content/bookmarks.js | 4 +- vimperator/locale/en-US/browsing.txt | 30 +++--- vimperator/locale/en-US/hints.txt | 6 +- vimperator/locale/en-US/starting.txt | 35 +++--- 9 files changed, 154 insertions(+), 173 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index 688ba8da..e4b7450e 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -156,7 +156,7 @@ function Buffer() //{{{ options.add(["pageinfo", "pa"], "Desired info on :pa[geinfo]", "charlist", "gfm", { - completer: function (filter) [[k, v[1]] for ([k, v] in Iterator(pageInfo))], + completer: function (context) [[k, v[1]] for ([k, v] in Iterator(pageInfo))], validator: Option.validateCompleter }); @@ -169,7 +169,7 @@ function Buffer() //{{{ "Show the destination of the link under the cursor in the status bar", "number", 1, { - completer: function (filter) [ + completer: function (context) [ ["0", "Don't show link destination"], ["1", "Show the link in the status line"], ["2", "Show the link in the command line"] @@ -355,8 +355,7 @@ function Buffer() //{{{ function () { liberator.open(util.readFromClipboard(), - /\bpaste\b/.test(options["activate"]) ? - liberator.NEW_BACKGROUND_TAB : liberator.NEW_TAB); + liberator[options.get("activate").has("paste") ? "NEW_BACKGROUND_TAB" : "NEW_TAB"]); }); mappings.add(myModes, ["p", ""], diff --git a/common/content/hints.js b/common/content/hints.js index 7ca6801b..ee8c0c9a 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -73,10 +73,10 @@ function Hints() //{{{ t: Mode("Follow hint in a new tab", function (elem) buffer.followLink(elem, liberator.NEW_TAB)), b: Mode("Follow hint in a background tab", function (elem) buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB)), w: Mode("Follow hint in a new window", function (elem) buffer.followLink(elem, liberator.NEW_WINDOW), extended), - F: Mode("Follow hint sequence in tabs", hintSequenceElement), - O: Mode("Preselect hint in an :open query", function (elem, loc) commandline.open(":", "open " + loc, modes.EX)), - T: Mode("Preselect hint in a :tabopen query", function (elem, loc) commandline.open(":", "tabopen " + loc, modes.EX)), - W: Mode("Preselect hint in a :winopen query", function (elem, loc) commandline.open(":", "winopen " + loc, modes.EX)), + F: Mode("Open multiple hints in tabs", hintAction_F), + O: Mode(":open URL based on hint location", function (elem, loc) commandline.open(":", "open " + loc, modes.EX)), + T: Mode(":tabopen URL based on hint location", function (elem, loc) commandline.open(":", "tabopen " + loc, modes.EX)), + W: Mode(":winopen URL based on hint location", function (elem, loc) commandline.open(":", "winopen " + loc, modes.EX)), v: Mode("View hint source", function (elem, loc) buffer.viewSource(loc, false), extended), V: Mode("View hint source in external editor", function (elem, loc) buffer.viewSource(loc, true), extended), y: Mode("Yank hint location", function (elem, loc) util.copyToClipboard(loc, true)), @@ -84,12 +84,11 @@ function Hints() //{{{ }; // Used to open multiple hints - function hintSequenceElement(elem) + function hintAction_F(elem) { buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB); - // Move to next element in sequence - // TODO: Maybe we find a *simple* way to keep the hints displayed rather than + // TODO: Maybe we find a *simple* way to keep the hints displayed rather than // showing them again, or is this short flash actually needed as a "usability // feature"? --mst hints.show("F"); @@ -574,10 +573,12 @@ function Hints() //{{{ "How links are matched", "string", "contains", { - completer: function (filter) - { - return [[m, ""] for each (m in ["contains", "wordstartswith", "firstletters", "custom"])]; - }, + completer: function (context) [ + ["contains", "The typed characters are split on whitespace. The resulting groups must all appear in the hint."], + ["wordstartswith", "The typed characters are split on whitespace. The resulting groups must all match the beginings of words, in order."], + ["firstletters", "Behaves like wordstartswith, but all groups much match a sequence of words."], + ["custom", "Delegate to a custom function: liberator.plugins.customHintMatcher(hintString)"], + ], validator: Option.validateCompleter }); @@ -605,7 +606,7 @@ function Hints() //{{{ // does. --tpp mappings.add(myModes, ["F"], "Start QuickHint mode, but open link in a new tab", - function () { options.getPref("browser.tabs.loadInBackground") ? hints.show("b") : hints.show("t"); }); + function () { hints.show(options.getPref("browser.tabs.loadInBackground") ? "b" : "t"); }); mappings.add(myModes, [";"], "Start an extended hint mode", diff --git a/common/content/liberator.js b/common/content/liberator.js index 4478c61d..d6a1b8c8 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -153,7 +153,7 @@ const liberator = (function () //{{{ group.setter(value); return value; }, - completer: function (filter) + completer: function (context) { let opts = [v.opts for ([k, v] in Iterator(groups))]; opts = opts.map(function (opt) [[k, v[0]] for ([k, v] in Iterator(opt))]); diff --git a/common/content/tabs.js b/common/content/tabs.js index 0fcefb70..ee4c1b85 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -140,14 +140,11 @@ function Tabs() //{{{ return value; }, - completer: function (filter) - { - return [ - ["0", "Never show tab bar"], - ["1", "Show tab bar only if more than one tab is open"], - ["2", "Always show tab bar"] - ]; - }, + completer: function (context) [ + ["0", "Never show tab bar"], + ["1", "Show tab bar only if more than one tab is open"], + ["2", "Always show tab bar"] + ], validator: Option.validateCompleter }); @@ -157,15 +154,12 @@ function Tabs() //{{{ "Define when tabs are automatically activated", "stringlist", "homepage,quickmark,tabopen,paste", { - completer: function (filter) - { - return [ - ["homepage", "gH mapping"], - ["quickmark", "go and gn mappings"], - ["tabopen", ":tabopen[!] command"], - ["paste", "P and gP mappings"] - ]; - }, + completer: function (context) [ + ["homepage", "gH mapping"], + ["quickmark", "go and gn mappings"], + ["tabopen", ":tabopen[!] command"], + ["paste", "P and gP mappings"] + ], validator: Option.validateCompleter }); @@ -173,17 +167,14 @@ function Tabs() //{{{ "Define which commands should output in a new tab by default", "stringlist", "", { - completer: function (filter) - { - return [ - ["all", "All commands"], - ["addons", ":addo[ns] command"], - ["downloads", ":downl[oads] command"], - ["help", ":h[elp] command"], - ["javascript", ":javascript! or :js! command"], - ["prefs", ":pref[erences]! or :prefs! command"] - ]; - }, + completer: function (context) [ + ["all", "All commands"], + ["addons", ":addo[ns] command"], + ["downloads", ":downl[oads] command"], + ["help", ":h[elp] command"], + ["javascript", ":javascript! or :js! command"], + ["prefs", ":pref[erences]! or :prefs! command"] + ], validator: Option.validateCompleter }); @@ -204,16 +195,13 @@ function Tabs() //{{{ return value; }, - completer: function (filter) - { - return [ - ["0", "Force to open in the current tab"], - ["1", "Always open in a new tab"], - ["2", "Open in a new window if it has a specific requested size (default in Firefox)"], - ["3", "Always open in a new window"], - ["4", "Open in the same tab unless it has a specific requested size"] - ]; - }, + completer: function (context) [ + ["0", "Force to open in the current tab"], + ["1", "Always open in a new tab"], + ["2", "Open in a new window if it has a specific requested size (default in Firefox)"], + ["3", "Always open in a new window"], + ["4", "Open in the same tab unless it has a specific requested size"] + ], validator: Option.validateCompleter }); let fragment = liberator.has("MacUnix") ? "tab-mac" : "tab"; diff --git a/common/content/ui.js b/common/content/ui.js index f67f89a5..12e34a68 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -122,10 +122,11 @@ function CommandLine() //{{{ }, /** - * move up or (if backward) down in the history + * Move forward or backward in history. * - * @param {boolean} backward - * @param {boolean} matchCurrent XXX: what? + * @param {boolean} backward Direction to move. + * @param {boolean} matchCurrent Search for matches starting + * with the current input value. */ select: function (backward, matchCurrent) { @@ -590,7 +591,7 @@ function CommandLine() //{{{ var multilineCallback = null; /** - * @private - highlight the messageBox according to group + * Highlight the messageBox according to group. */ function setHighlightGroup(group) { @@ -598,7 +599,7 @@ function CommandLine() //{{{ } /** - * @private - Determines whether the command line should be visible. + * Determines whether the command line should be visible. * * @return {boolean} */ @@ -606,7 +607,7 @@ function CommandLine() //{{{ !(modes.extended & (modes.INPUT_MULTILINE | modes.OUTPUT_MULTILINE)); /** - * @private - set the prompt to val styled with highlightGroup + * Set the command-line prompt. * * @param {string} val * @param {string} highlightGroup @@ -620,7 +621,8 @@ function CommandLine() //{{{ } /** - * @private - set the command to cmd and move the user's cursor to the end. + * Set the command-line input value. The caret is reset to the + * end of the line. * * @param {string} cmd */ @@ -632,12 +634,12 @@ function CommandLine() //{{{ } /** - * @private - display a message styled with highlightGroup - * and, if forceSingle is true, ensure it takes only one line. + * Display a message in the command-line area. * * @param {string} str * @param {string} highlightGroup - * @param {boolean} forceSingle + * @param {boolean} forceSingle If provided, don't let over-long + * messages move to the MOW. */ function echoLine(str, highlightGroup, forceSingle) { @@ -655,13 +657,12 @@ function CommandLine() //{{{ } /** - * Display a multiline message, possible through a "more" like interface - * - * TODO: resize upon a window resize + * Display a multiline message. * * @param {string} str * @param {string} highlightGroup */ + // TODO: resize upon a window resize function echoMultiline(str, highlightGroup) { let doc = multilineOutputWidget.contentDocument; @@ -707,7 +708,7 @@ function CommandLine() //{{{ } /** - * @private - ensure that the Multiline input widget is the + * Ensure that the Multiline input widget is the * correct size. */ function autosizeMultilineInputWidget() @@ -718,14 +719,12 @@ function CommandLine() //{{{ } /** - * @private - eval()s a javascript expression - * and returns a string suitable to be echo'd. - * - * If useColor is true, util.objectToString will - * colorize object output. + * eval() a JavaScript expression and return a string suitable + * to be echoed. * * @param {string} arg - * @param {boolean} useColor + * @param {boolean} useColor When true, the result is a + * highlighted XML object. */ function echoArgumentToString(arg, useColor) { @@ -793,7 +792,7 @@ function CommandLine() //{{{ "Items which are completed at the :[tab]open prompt", "charlist", "sfl", { - completer: function completer(filter) [k for each (k in completion.urlCompleters)], + completer: function (context) [k for each (k in completion.urlCompleters)], validator: Option.validateCompleter }); @@ -832,18 +831,15 @@ function CommandLine() //{{{ "Define how command line completion works", "stringlist", "list:full", { - completer: function completer(filter) - { - return [ - // Why do we need ""? - ["", "Complete only the first match"], - ["full", "Complete the next full match"], - ["longest", "Complete to longest common string"], - ["list", "If more than one match, list all matches"], - ["list:full", "List all and complete first match"], - ["list:longest", "List all and complete common string"] - ]; - }, + completer: function (context) [ + // Why do we need ""? + ["", "Complete only the first match"], + ["full", "Complete the next full match"], + ["longest", "Complete to longest common string"], + ["list", "If more than one match, list all matches"], + ["list:full", "List all and complete first match"], + ["list:longest", "List all and complete common string"] + ], validator: Option.validateCompleter, checkHas: function (value, val) { @@ -995,9 +991,6 @@ function CommandLine() //{{{ storage.styles.removeSheet(true, "silent-mode"); }, - /** - * XXX: This function is not used! - */ runSilently: function (fn, self) { let wasSilent = this.silent; @@ -1026,14 +1019,14 @@ function CommandLine() //{{{ get message() messageBox.value, /** - * Changes the command line to display the following prompt (usually ":") - * followed by the command, in the given mode. Valid modes are - * attributes of the "modes" variable, and modes.EX is probably - * a good choice. + * Open the command line. The main mode is set to + * COMMAND_LINE, the extended mode to extendedMode. + * Further, callbacks defined for extendedMode are + * triggered as appropriate (see {@link Liberator#registerCallback}). * * @param {string} prompt * @param {string} cmd - * @param {number} mode + * @param {number} extendedMode */ open: function open(prompt, cmd, extendedMode) { @@ -1060,9 +1053,10 @@ function CommandLine() //{{{ }, /** - * Removes any input from the command line, without executing its - * contents. Removes any "More" windows or other such output. - * Pressing in EX mode normally has this effect. + * Closes the command line. This is ordinarilly triggered + * automatically by a mode change. Will not hide the command + * line immediately if called directly after a successful + * command, otherwise it will. */ close: function close() { @@ -1099,7 +1093,8 @@ function CommandLine() //{{{ /** - * Hide any auto-completion/More-ing that is happening. + * Hides the command line, and shows any status messages that + * are under it. */ hide: function hide() { @@ -1107,19 +1102,24 @@ function CommandLine() //{{{ }, /** - * Output the given string onto the command line coloured - * using the rules according to highlightGroup. If not - * given higlightGroup defaults to commandline.HL_NORMAL - * and other possibe values are at commandline.HL_[A-Z]*. - * - * Flags can be any of: - * commandline.APPEND_TO_MESSAGES (causes message to be added to the messagesHistory) - * commandline.FORCE_SINGLELINE | commandline.DISALLOW_MULTILINE - * commandline.FORCE_MULTILINE + * Output the given string onto the command line. With no + * flags, the message will be shown in the status line if it's + * short enough to fit, and contains no new lines, and isn't + * XML. Otherwise, it will be shown in the MOW. * * @param {string} str - * @param {string} highlightGroup - * @param {number} flags + * @param {string} highlightGroup The Highlight group for the + * message. @default "Normal" + * @param {number} flags Changes the bahavior as follows: + * commandline.APPEND_TO_MESSAGES - Causes message to be added to the messages + * history, and shown by :messages. + * commandline.FORCE_SINGLELINE - Forbids the command from + * being pushed to the MOW if it's too long or of + * there are already status messages being shown. + * commandline.DISALLOW_MULTILINE - Cancels the operation if + * the MOW is already visible. + * commandline.FORCE_MULTILINE - Forces the message to + * appear in the MOW. */ echo: function echo(str, highlightGroup, flags) { @@ -1169,21 +1169,15 @@ function CommandLine() //{{{ }, /** - * Prompt the user for a string and execute the given - * callback with that as the only argument on - * extra can have any of the following attributes: + * Prompt the user. Sets modes.main to COMMAND_LINE, which the + * user may pop at any time to close the prompt. * - * onChange: A function to be called with the current input every time it changes - * completer: A function called with a ?context? when the user tries to tabcomplete - * promptHighlight: The HighlightGroup to use (default commandline.HL_QUESTION, others - * can be found at commandline.HL_[A-Z]*) - * - * This function sets the mode to modes.COMMAND_LINE, and thus popping the mode will - * stop further input from being waited for (useful for stopping onChange) - * - * @param {string} prompt + * @param {string} prompt The input prompt to use. * @param {function(string)} callback - * @param {Object} extra + * @param {object} extra + * @... {function} onChange - A function to be called with the current input every time it changes + * @... {function(CompletionContext)} completer - A completion function for the user's input. + * @... {string} promptHighlight - The HighlightGroup used for the prompt. @default "Question" */ input: function input(prompt, callback, extra) { @@ -1212,6 +1206,7 @@ function CommandLine() //{{{ * @param {RegExp} untilRegexp * @param {function(string)} callbackFunc */ + // FIXME: Buggy, especially when pasting. Shouldn't use a RegExp. inputMultiline: function inputMultiline(untilRegexp, callbackFunc) { // Kludge. @@ -1232,11 +1227,13 @@ function CommandLine() //{{{ }, /** - * Handle events, the come from liberator when liberator.mode = modes.COMMAND_LINE - * but also takes blur/focus/input events raw from #liberator-commandline-command - * in the XUL + * Handles all command line events. All key events are passed + * here when COMMAND_LINE mode is active, as well as all + * input, keyup, focus, and blur events sent to the + * command-line XUL element. * * @param {Event} event + * @private */ onEvent: function onEvent(event) { @@ -1970,14 +1967,11 @@ function StatusLine() //{{{ return value; }, - completer: function completer(filter) - { - return [ - ["0", "Never display status line"], - ["1", "Display status line only if there are multiple windows"], - ["2", "Always display status line"] - ]; - }, + completer: function completer(context) [ + ["0", "Never display status line"], + ["1", "Display status line only if there are multiple windows"], + ["2", "Always display status line"] + ], validator: Option.validateCompleter }); diff --git a/vimperator/content/bookmarks.js b/vimperator/content/bookmarks.js index 7e89fe7d..45b7a70b 100644 --- a/vimperator/content/bookmarks.js +++ b/vimperator/content/bookmarks.js @@ -792,9 +792,9 @@ function History() //{{{ function (args) { history.list(args.join(" "), args.bang, args["-max"] || 1000); }, { bang: true, - completer: function (context) { context.quote = null, completion.history(context); }, - options: [[["-max", "-m"], options.OPTION_INT]] + completer: function (context) { context.quote = null; completion.history(context); }, // completer: function (filter) completion.history(filter) + options: [[["-max", "-m"], options.OPTION_INT]] }); /////////////////////////////////////////////////////////////////////////////}}} diff --git a/vimperator/locale/en-US/browsing.txt b/vimperator/locale/en-US/browsing.txt index aebc802a..ff373878 100644 --- a/vimperator/locale/en-US/browsing.txt +++ b/vimperator/locale/en-US/browsing.txt @@ -40,21 +40,21 @@ The first URL is opened in the current tab, and all other URLs are opened in new tabs. Each token is analyzed and in this order: -. Opened as a local file if it is an existing relative or absolute filename. - * [c]:open /etc/fstab[c] shows the file system table. - * [c]:open ../other/foo.html[c] in your home directory opens - [a]/home/other/foo.html[a] -. Opened with the specified search engine if the token looks like a search - string and the first word is the name of a search engine ([c]:open wikipedia - linus torvalds[c] opens the Wikipedia entry for linus torvalds). The short - name of a search engine is automatically guessed from its name. If you want - to set a custom name, you can change it with [c]:dialog searchengines[c]. -. Opened with the default search engine or keyword (specified with the - 'defsearch' option) if the first word is no search engine ([c]:open linus - torvalds[c] opens a Google search for linux torvalds). -. Passed directly to Firefox in all other cases ([c]:open www.osnews.com, - www.slashdot.org[c] opens OSNews in the current, and Slashdot in a new - background tab). +1. Opened as a local file if it is an existing relative or absolute filename. + - [c]:open /etc/fstab[c] shows the file system table. + - [c]:open ../other/foo.html[c] in your home directory opens + [a]/home/other/foo.html[a] +2. Opened with the specified search engine if the token looks like a search + string and the first word is the name of a search engine ([c]:open wikipedia + linus torvalds[c] opens the Wikipedia entry for linus torvalds). The short + name of a search engine is automatically guessed from its name. If you want + to set a custom name, you can change it with [c]:dialog searchengines[c]. +3. Opened with the default search engine or keyword (specified with the + 'defsearch' option) if the first word is no search engine ([c]:open linus + torvalds[c] opens a Google search for linux torvalds). +4. Passed directly to Firefox in all other cases ([c]:open www.osnews.com, + www.slashdot.org[c] opens OSNews in the current, and Slashdot in a new + background tab). You can use [c]:open -tags linux torvalds[c] to complete bookmarks with tag "linux" and which contain "torvalds". Note that -tags support is only diff --git a/vimperator/locale/en-US/hints.txt b/vimperator/locale/en-US/hints.txt index 21796974..d4bc1059 100644 --- a/vimperator/locale/en-US/hints.txt +++ b/vimperator/locale/en-US/hints.txt @@ -51,9 +51,9 @@ this hint mode. Then press [a]24[a] to copy the hint location. * |;b| [m]b[m] to open its location in a new background tab * |;w| [m]w[m] to open its destination in a new window * |;F| [m]F[m] to follow a sequence of [m][m]-delimited hints in background tabs -* |;O| [m]O[m] to preselect its location in an [c]:open[c] query -* |;T| [m]T[m] to preselect its location in a [c]:tabopen[c] query -* |;W| [m]W[m] to preselect its location in a [c]:winopen[c] query +* |;O| [m]O[m] to [c]:open[c] a URL based on hint location +* |;T| [m]T[m] to [c]:tabopen[c] a URL based on its location +* |;W| [m]W[m] to [c]:winopen[c] a URL based on its location * |;v| [m]v[m] to view its destination source * |;V| [m]V[m] to view its destination source in the external editor * |;y| [m]y[m] to yank its destination location diff --git a/vimperator/locale/en-US/starting.txt b/vimperator/locale/en-US/starting.txt index 0e6d060d..b971a2f4 100644 --- a/vimperator/locale/en-US/starting.txt +++ b/vimperator/locale/en-US/starting.txt @@ -7,27 +7,26 @@ section:Initialization[initialization,startup] At startup, Vimperator completes the following tasks in order. -. Vimperator can perform user initialization commands. When - one of the following is successfully located, it is executed, and no - further locations are tried. +1. Vimperator can perform user initialization commands. When +one of the following is successfully located, it is executed, and no +further locations are tried. +|$VIMPERATOR_INIT| - .. |$VIMPERATOR_INIT| _$VIMPERATOR_INIT_ -- May contain a single ex - command (e.g., - "[c]:source {file}[c]"). - .. [a]\~/_vimperatorrc[a] -- Windows only. If this file exists, its - contents are executed. - .. [a]\~/.vimperatorrc[a] -- If this file exists, its contents are - executed. + a. _$VIMPERATOR_INIT_ -- May contain a single ex command (e.g., + "[c]:source {file}[c]"). + b. [a]\~/_vimperatorrc[a] -- Windows only. If this file exists, its contents + are executed. + c. [a]\~/.vimperatorrc[a] -- If this file exists, its contents are executed. -. If 'exrc' is set, then any RC file in the current directory is also sourced. +2. If 'exrc' is set, then any RC file in the current directory is also sourced. -. All directories in 'runtimepath' are searched for a "plugin" - subdirectory and all yet unloaded plugins are loaded. For each - plugin directory, all *.\{js,vimp} files (including those in further - subdirectories) are sourced alphabetically. No plugins will be sourced - if 'noloadplugins' is set. Any particular plugin will not be loaded - if it has already been loaded (e.g., by an earlier [c]:loadplugins[c] - command). +3. All directories in 'runtimepath' are searched for a "plugin" +subdirectory and all yet unloaded plugins are loaded. For each plugin +directory, all *.\{js,vimp} files (including those in further +subdirectories) are sourced alphabetically. No plugins will be sourced +if 'noloadplugins' is set. Any particular plugin will not be loaded if +it has already been loaded (e.g., by an earlier [c]:loadplugins[c] +command). The user's ~ (i.e., "home") directory is determined as follows: From b096266e75d349c6a1bb2c32c8262bda0bd562b5 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 8 Jan 2009 21:07:14 -0500 Subject: [PATCH 34/71] More tab-completion fixes --- common/modules/storage.jsm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/modules/storage.jsm b/common/modules/storage.jsm index c2f8705f..9f13228f 100644 --- a/common/modules/storage.jsm +++ b/common/modules/storage.jsm @@ -80,10 +80,10 @@ function Timer(minInterval, maxInterval, callback) { timer.cancel(); this.doneAt = 0; - } + }; this.flush = function () { - if (this.latest) + if (this.doneAt == -1) this.notify(); }; } From 7a38e534939290fe8b60d627ba5895bdfd4a68f3 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 8 Jan 2009 21:21:00 -0500 Subject: [PATCH 35/71] Fix stupid autocomplete sluggishness. --- common/content/ui.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/content/ui.js b/common/content/ui.js index 12e34a68..ac926018 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -492,9 +492,10 @@ function CommandLine() //{{{ statusline.updateProgress("match " + (completions.selected + 1) + " of " + completions.items.length); }); - var autocompleteTimer = new Timer(201, 500, function autocompleteTell(tabPressed) { + var autocompleteTimer = new Timer(200, 500, function autocompleteTell(tabPressed) { if (events.feedingKeys || !completions) return; + completions.complete(true, false); completions.itemList.show(); }); @@ -1649,8 +1650,6 @@ function CommandLine() //{{{ */ resetCompletions: function resetCompletions() { - autocompleteTimer.reset(); - // liberator.dump("Resetting completions..."); if (completions) { From 2f2ea98a9c5e451d9d33c46a057864d5b02e0a5a Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 8 Jan 2009 21:58:59 -0500 Subject: [PATCH 36/71] Update more inline docs in ui.js --- common/content/ui.js | 140 +++++++++++++++++++++---------------------- 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/common/content/ui.js b/common/content/ui.js index ac926018..42245d6b 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -493,13 +493,17 @@ function CommandLine() //{{{ }); var autocompleteTimer = new Timer(200, 500, function autocompleteTell(tabPressed) { - if (events.feedingKeys || !completions) - return; - - completions.complete(true, false); - completions.itemList.show(); + if (!events.feedingKeys && completions) + { + completions.complete(true, false); + completions.itemList.show(); + } }); + // This timer just prevents s from queueing up when the + // system is under load (and, thus, giving us several minutes of + // the completion list scrolling). Multiple presses are + // still processed normally, as the time is flushed on "keyup". var tabTimer = new Timer(0, 0, function tabTell(event) { if (completions) completions.tab(event.shiftKey); @@ -870,7 +874,7 @@ function CommandLine() //{{{ var myModes = [modes.COMMAND_LINE]; - // TODO: move "", "", "" here from mappings mappings.add(myModes, [""], "Focus content", function () { events.onEscape(); }); @@ -963,14 +967,14 @@ function CommandLine() //{{{ return { - HL_NORMAL : "Normal", - HL_ERRORMSG : "ErrorMsg", - HL_MODEMSG : "ModeMsg", - HL_MOREMSG : "MoreMsg", - HL_QUESTION : "Question", - HL_INFOMSG : "InfoMsg", - HL_WARNINGMSG : "WarningMsg", - HL_LINENR : "LineNr", + HL_NORMAL: "Normal", + HL_ERRORMSG: "ErrorMsg", + HL_MODEMSG: "ModeMsg", + HL_MOREMSG: "MoreMsg", + HL_QUESTION: "Question", + HL_INFOMSG: "InfoMsg", + HL_WARNINGMSG: "WarningMsg", + HL_LINENR: "LineNr", FORCE_MULTILINE : 1 << 0, FORCE_SINGLELINE : 1 << 1, @@ -1010,6 +1014,8 @@ function CommandLine() //{{{ { try { + // The long path is because of complications with the + // completion preview. return commandWidget.inputField.editor.rootElement.firstChild.textContent; } catch (e) {} @@ -1068,7 +1074,7 @@ function CommandLine() //{{{ if (history) history.save(); - this.resetCompletions(); // cancels any asynchronous completion still going on, must be before completions = null + this.resetCompletions(); // cancels any asynchronous completion still going on, must be before we set completions = null completions = null; history = null; @@ -1124,7 +1130,7 @@ function CommandLine() //{{{ */ echo: function echo(str, highlightGroup, flags) { - // liberator.echo uses different order of flags as it omits the highlight group, change v.commandline.echo argument order? --mst + // liberator.echo uses different order of flags as it omits the highlight group, change commandline.echo argument order? --mst if (silent) return false; @@ -1374,11 +1380,10 @@ function CommandLine() //{{{ * these come from liberator when modes.extended & modes.MULTILINE_OUTPUT * and also from #liberator-multiline-output in the XUL * - * FIXME: if 'more' is set and the MOW is not scrollable we should still - * allow a down motion after an up rather than closing - * * @param {Event} event */ + // FIXME: if 'more' is set and the MOW is not scrollable we should still + // allow a down motion after an up rather than closing onMultilineOutputEvent: function onMultilineOutputEvent(event) { let win = multilineOutputWidget.contentWindow; @@ -1589,13 +1594,13 @@ function CommandLine() //{{{ }, /** - * Refresh or remove the prompt that displays when in multiline mode. - * showHelp will cause the possible key-options to be displayed, - * force will cause a display of the default message even if it - * could be at the end of the output. + * Update or remove the multiline output widget's "MORE" + * prompt. * - * @param {boolean} force - * @param {boolean} showHelp + * @param {boolean} force If true, "-- More --" is shown + * even if we're at the end of the output. + * @param {boolean} showHelp When true, show the valid key + * sequences and what they do. */ updateMorePrompt: function updateMorePrompt(force, showHelp) { @@ -1615,12 +1620,11 @@ function CommandLine() //{{{ }, /** - * Changes the height of the multilineOutputWidget to fit - * its contents, if open is true, it will cause the - * widget to uncollapse, if not it will leave the widget - * closed. + * Changes the height of the multilineOutputWidget to fit in + * the available space. * - * @param {boolean} open + * @param {boolean} open If true, the widget will be opened if + * it's not already so. */ updateOutputHeight: function updateOutputHeight(open) { @@ -1644,13 +1648,8 @@ function CommandLine() //{{{ outputContainer.collapsed = false; }, - /** - * Disable any active completion functions by calling their cancelFunc's - * Will also remove the completions preview window. - */ resetCompletions: function resetCompletions() { - // liberator.dump("Resetting completions..."); if (completions) { completions.context.cancelAll(); @@ -1665,11 +1664,12 @@ function CommandLine() //{{{ }; //}}} /** - * The list which is used for the completion box (and QuickFix window in future) + * The list which is used for the completion box (and QuickFix window + * in future). * - * @param {string} id The id of the XUL