Commit graph

79 commits

Author SHA1 Message Date
Denis Revunov
8ab665e565 Fix completions for tabmove (#4602)
Force default tabsort for tabmove.
Also return trimmed prefix from splitOnPrefix for consistency.
2023-03-02 00:19:36 +03:00
Oliver Blanthorn
a58fa7830b
Merge pull request #3589 from tridactyl/no_reuse_option_container
Avoid updating DOM in-place
2021-05-07 15:42:20 +01:00
Oliver Blanthorn
fd038c491b
Update src/completions.ts
Co-authored-by: Rummskartoffel <20257197+Rummskartoffel@users.noreply.github.com>
2021-05-07 15:14:57 +01:00
Oliver Blanthorn
afda42e7f9
Fix various minor typescript errors 2021-05-01 14:25:38 +02:00
Oliver Blanthorn
fab765b70f
Fix formatting with minimal thought 2021-04-21 18:02:54 +02:00
mozbug
712c5fd696
Avoid updating DOM in-place 2021-04-21 17:58:58 +02:00
Oliver Blanthorn
43b70c16dd
Make fuzziness less arbitrary
Long URLs are no longer penalised
2021-04-11 17:49:09 +02:00
Oliver Blanthorn
8115c0dd8d
Improve help and rename option 2021-04-09 12:40:35 +02:00
meep
20dc1918e5
WIP: Make fuzzy matching less fuzzy
Known issues: single characters often no longer produce any results
2021-04-08 14:35:16 +02:00
Oliver Blanthorn
a3d9f5c942
Switch to no-unused-vars-experimental
`no-unused-vars` doesn't work for types so we had to switch
2020-12-16 16:48:57 +01:00
Oliver Blanthorn
e11008a616
Remove special casing for tabclose 2020-08-02 17:56:48 +01:00
Oliver Blanthorn
ae2966d9c0
Retry completion.next until there are completions
This improves the experience of  e.g. pressing b<Tab> as it means
that it will, within reason, wait until the completions have been
populated before firing
2020-06-27 18:47:46 +01:00
Oliver Blanthorn
a6ca46d147
Re-enable arrow-body-style 2020-06-19 13:08:23 +01:00
Oliver Blanthorn
eac06ae39a
Re-enable no-empty-function 2020-06-18 22:35:24 +01:00
Oliver Blanthorn
a146306d0b
Re-enable member-ordering 2020-06-18 22:18:13 +01:00
Oliver Blanthorn
5412e6ebc7
Fix #2401: update completions for new fuse 2020-05-21 12:24:16 +01:00
Oliver Blanthorn
fa8b6e87c2
Update completions and container match for fuse v6 2020-05-18 14:15:09 +01:00
Oliver Blanthorn
3b38f093b7
Merge pull request #2194 from mozbugbox/bind-completion
Binding completion
2020-02-28 21:10:04 +00:00
mozbug
32500c86ae Completion popup scrolls only on necessary 2020-02-27 22:27:15 +08:00
mozbug
75777d0788 Force scroll to focus in completion updateDisplay 2020-02-18 12:55:10 +08:00
mozbug
c46bd5aa59 Sort completions by score on demand 2020-02-18 09:22:41 +08:00
mozbug
4fcf8a7a44 Sort completion result based on Fuse.js score
The completion uses Fuse.js to match user filter. The matching is fuzzy,
therefore sometime looks weird. The results are much easier to follow by
putting better matched results at the top.
2020-02-18 00:12:06 +08:00
Saul Reynolds-Haertle
031883e85c browser.extension.getURL -> browser.runtime.getURL
Function is deprecated:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/extension/getURL

Replacement has essentially identical functionality:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/getURL

I'm sure that there's _some_ difference between the "path in install
directory" and "path relative to manifest.json", but I don't think
that we're going to be the ones running into it.
2019-05-26 22:03:34 -07:00
glacambre
923f9caf92
TSLint: enable no-unused-declaration rule
This rule requires adding a new set of rules, tslint-etc.
no-unused-declaration used to be available in tslint:recommended but was
deprecated when --noUnusedVariables was added to typescript. The problem
with using TypeScript's --noUnusedVariables is that it turns unused
declarations into an error and prevents compilation, which isn't fun
when you're just prototyping things.
2019-04-16 08:30:31 +02:00
glacambre
2b11d1d464
TSLint: re-enable prefer-const rule 2019-04-14 08:01:26 +02:00
glacambre
ff8f313aa5
Turn double-equals into triple-equals
See https://github.com/tridactyl/tridactyl/pull/1451
2019-04-10 12:28:47 +02:00
glacambre
1b7c4f2052
TSLint: re-enable no-useless-cast rule 2019-04-04 07:09:44 +02:00
glacambre
270a1dbf9c
TSLint: re-enable no-dead-store rule
No point in storing things that we're not going to use.
2019-04-03 07:45:09 +02:00
glacambre
2ccd6bd4a4
Fix completions broken by prettier 2019-04-02 18:59:47 +02:00
glacambre
673bf6f280
TSLint: re-enable member-ordering rule
The member-ordering rule enforces declaring public functions before
private functions.
2019-04-02 18:37:02 +02:00
glacambre
f8419b20ed
TSLint: re-enable interface-over-type-literal rule
The interface-over-type-literal rule specifies that object types should
be represented with `interface` instead of `type` if possible.
2019-04-02 18:22:54 +02:00
glacambre
8ed07362e0
TSLint: re-enable ban-types rule
This rule disallows using Number, String or Boolean constructors as
types and instead forces using the actual type, `number`, `string` or
`boolean`.
2019-04-01 12:57:19 +02:00
glacambre
5dd1ec3a74
completions: Make sure completion computation has ended before resizeArea
Before this commit, Tridactyl had a bug where resizeArea could be called
before completion computation had ended, which resulted in completions
pushing the input field out of the viewport (easy way to reproduce this:
open a lot of tabs and press `b` to open buffer completions).
This happened because for some of the completion sources, `filter`
returned before completion computation had actually ended. This is fixed
by making sure that filter() (and all underlying calls to updateOptions,
onInput, updateChain...) return a promise that will only be resolved
once completion computation has actually ended.
2019-03-05 07:45:07 +01:00
glacambre
4e6e9aadac
Resize command line only once per available completion source
One of the problems of the command line was that it made a resizeArea()
call for each enabled completion, no matter whether its status was
"hidden" or "normal". This was a problem because a resizeArea call
results in 2 cross-script messages: a "show" and a "focus" message. This
means that for each keystroke, we sent 28 messages. This commit fixes
that thanks to modifications in multiple files:

- commandline_frame.ts: Stop accumulating event listeners on resizeArea
  calls. Make sure completion sources actually need a refresh before
  calling resizeArea().
- completions.ts: Add logic to know whether a completion source needs a
  refresh or not.
- {Rss,Sessions,Tab,TabAll,Window}.ts: Make sure that completions are
  actually needed before computing them.

This seems to make opening the command line slightly faster for me,
although I can't tell if this is placebo or not.
2019-03-01 06:18:07 +01:00
glacambre
bdd3e04199
Implement deselect_completion ex command
Left unbound by default.
2019-02-28 18:27:21 +01:00
Oliver Blanthorn
d385e65a76
Update dependencies
Add focus signature with no argument and Document.fullscreenElement to Document interface.

Add sloppy typing to fuseOptions.
2018-11-05 13:12:08 +00:00
Saul Reynolds-Haertle
c02ef5a90e Move src/itertools.ts to src/lib/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
4bdd07308a Move src/convert.ts to src/lib/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
c531aa5481 Move src/config.ts to src/lib/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
11e28ce1fc Move src/aliases.ts to src/lib/ 2018-09-29 18:03:36 -07:00
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