Commit graph

39 commits

Author SHA1 Message Date
glacambre
e19b3ce49d
Fix excmd completion not working with nested aliases 2018-08-18 07:15:14 +02:00
glacambre
e6639ceb85
Fix aliases breaking excmd completion
As mentioned in https://github.com/cmcaine/tridactyl/issues/912, there
was a problem with aliases preventing some excmd completion options from
being displayed. For example, `b` would be expanded to `buffer` in the
command line completion mechanism and thus prevent `back` from being
displayed.

This commit fixes that by treating aliases as "real" excmds when
building completion sources. Basically, we check for aliases to the
prefixes given as CompletionSource parameter and add them to the list of
prefixes that can trigger the completion source.

We use this opportunity to remove the constraint of having to add a
space to each prefix, they're instead automatically added by the
CompletionSource constructor.
2018-08-17 23:09:17 +02:00
glacambre
c0c83fb320
completions.ts: Remove unused and buggy code
This commit removes an if statement that is always true and a caching
optimization that can go wrong.

The caching optimization is the `if (!this.fuse)` statement. This
optimization can be buggy because it relies on this.options not
changing between two calls to scoredOptions but as far as I can tell,
this.options always changes between two scoredOptions calls.

If this.options changes, the array indexes used in searchThis do not
point to the right elements anymore and everything can break
(completions that should be matched disappear, completions with a lower
score get higher priority etc).

As far as I can tell, removing this optimization does not make
completions slower, but I couldn't test this with a large history.
2018-07-07 20:10:42 +02:00
glacambre
4bd8216a41
Fix race condition in BufferAll 2018-06-19 08:29:24 +02:00
glacambre
9e225db2d4
Split completions in multiple files, move them to src/completions 2018-06-19 07:59:39 +02:00
glacambre
e27f93c913
Improve :bufferall, bind it to 'B' 2018-06-18 07:55:46 +02:00
glacambre
575693a65e
Implement :bufferall 2018-06-17 06:21:10 +02:00
Oliver Blanthorn
4a8870c363
Ameliorate #454: allow historyresults to be configured 2018-05-03 17:48:03 +01:00
glacambre
e4ddeb0cf2
completions.ts: Make sure selected completion options are visible 2018-05-01 11:44:35 +02:00
glacambre
20dfaed659
completions.ts: Add empty completion option for option deselection 2018-04-14 10:44:44 +02:00
Oliver Blanthorn
095ce771ea
Formatting: run all typescript through prettier 2018-04-13 19:28:03 +01:00
Colin Caine
b2dcbc7ff3 completions: improve buffer index logic 2017-12-28 17:07:07 +00:00
Colin Caine
c2c5d2b5ef completions: passthrough # in buffercompletion
Fix @gsbabil's complaint in #189.
2017-12-11 13:51:55 +00:00
Oliver Blanthorn
6e9bf93665
Merge branch 'master' of github.com:cmcaine/tridactyl into azuwis-master 2017-12-09 15:44:54 +00:00
Oliver Blanthorn
8c32dcb121
Use tab ID even if buffer has a trailing space (#223) 2017-12-09 15:34:12 +00:00
Zhong Jianxin
f4d4f8f74f Blacklist default newtab url from history completions 2017-12-07 10:03:25 +08:00
Oliver Blanthorn
7574146e65
Merge branch 'master' of github.com:cmcaine/tridactyl into glacambre-fix_completions_not_looping 2017-11-30 19:15:42 +00:00
Oliver Blanthorn
4ad4291b7f
Fix initial shift-tab skipping an item 2017-11-30 19:15:34 +00:00
glacambre
d6bf2f4c69 src/completions.ts: Fix shift-tab not looping backwards. 2017-11-30 19:03:12 +01:00
Oliver Blanthorn
9fc0e9c0cf
Fix #167: Add bmarks command for searching through bookmarks 2017-11-30 17:02:31 +00:00
Colin Caine
7334777714 completions: backport improved history 2017-11-29 23:56:54 +00:00
Colin Caine
edd53f197b completions: Support numbers for buffer 2017-11-27 19:59:43 +00:00
Oliver Blanthorn
9e2c21123f
Revert async history update and number of history items
The async history issue was too annoying, and the number of history
items being above 50 meant that it was too slow.
2017-11-25 23:26:16 +00:00
Oliver Blanthorn
bf8d65f14d
Only add visible items to HTML, make update more async
Introduces an issue where the commandline cannot be seen until a
character is typed on *open.
2017-11-25 13:00:15 +00:00
Oliver Blanthorn
ef3bb11654
Add shift-tab bind for completion 2017-11-24 19:17:51 +00:00
Oliver Blanthorn
56c7b0ceff
First working version of next 2017-11-24 18:46:49 +00:00
Oliver Blanthorn
a04c693e68
Start next/prev functions for completions 2017-11-23 21:48:48 +00:00
Oliver Blanthorn
7a747312ee
Start work on history completions 2017-11-23 19:55:46 +00:00
Colin Caine
2877934cc4 completions: use a table instead
Absolutely positioned elements are absolutely a pain in the arse.
2017-11-23 01:09:10 +00:00
Colin Caine
8a44732227 completions:
Done:
	Working completion for buffers
	Substitute values into command line
	Prepare for non-buffers completions
	Wrote too many classes and helper functions

Todo:
	Learn inferno and hopefully simplify
	If not, simplify the main functions so that people can actually
	build for it.
	Define an interface for tabbing through options
	Allow more than one CompletionSource per command
2017-11-22 21:43:29 +00:00
Colin Caine
8d771e578c completions 1 2017-11-22 21:30:37 +00:00
Koushien
f982233a49 completions: initial implementation
This commit squashes a load of work by @Koushien, a dozen hours from
@cmcaine and some CSS by @bovine3dom.

@cmcaine is writing this commit message, but the work was mostly by
Koushien so the author is set to them. Thanks Koushien!

The following issues need to be fixed:

 - The interface is over complicated (my fault)
 - commandline_frame is hard-coded to use BufferCompletionSource. This
   needs to be made more general
 - BufferCompletionSource should be generalised
 - completions.ts calls helper functions in commandline_frame. Should
   just use browser proxy. If that's too slow can define a
   completions_background.ts

After that's done, this should be fixed:

 - Completion hiding/unhiding is currently too messy.
2017-11-22 21:30:37 +00:00
Oliver Blanthorn
85d6eba2b5
Revert "Merge branch 'Koushien-completions'"
This reverts commit 0aa14bb754, reversing
changes made to eae9cd0dab.
2017-11-21 20:28:48 +00:00
Colin Caine
7bbe81f327 completions: works properly, but code expects only one completionsource 2017-11-21 09:14:22 +00:00
Colin Caine
8e48f69c27 completions: another WIP 2017-11-21 05:16:47 +00:00
Koushien
cf620959ec Do not merge: quick WIP
In case I get hit by a bus or something.
Reminder to myself to rebase next commit on
previous patch for some coherency.
2017-11-21 05:15:52 +00:00
Koushien
5bbb133c5c Begin transitioning completions refactor
Start laying groundwork for buffersall excmd
2017-11-21 05:15:52 +00:00
Colin Caine
1045eadc0e completions: WIP 2017-11-21 05:15:52 +00:00
Koushien
a389d6dde3 Move buffers to general completion system.
User shouldn't notice any difference besides:
* removing "buffer " from cli clears buffers
* retyping "buffer " repopulates buffers
* text after "buffer " filters with smartcase.

We no longer directly set completion's innerHTML.
2017-11-21 05:15:52 +00:00