Commit graph

109 commits

Author SHA1 Message Date
glacambre
be315ac967
Implement getrss completions 2018-12-27 11:05:47 +01:00
glacambre
55d6a1e0e6
commandline_frame.ts: stop using dirty hacks for completions
The previous code simulated an input event in order to trigger the input
event handler which recomputed completions. This was ok until delays
were added to the input event handlers in order to reduce the lag that
could happen when typing fast/keeping a key pressed. This delay also
affects completion computation on other actions, such as fillcmdline.

In order to remove this delay, we move completion computation out of the
event handler and directly call this functions everywhere we previously
triggered an input event.

This should help with https://github.com/tridactyl/tridactyl/issues/1242
2018-12-24 09:26:57 +01:00
glacambre
4a6305df47
Fix "tab" alias breaking completions
PR#1183 broke completions for users that had a tab -> buffer alias. This
is because having such an alias created a loop, which made
BufferCompletionSource throw errors when being instanciated, which
resulted in the activeCompletions array not being created.

This is fixed in two ways: first, a config updater is created in order
to remove the alias. Second, completions are instantiated in
try/catchs, which should hopefully prevent a faulty completion source
constructor from breaking every completion source.
2018-12-10 07:00:11 +01:00
glacambre
6e1e24b3d3
Fix 'clipboard yanksel' not working in commandline frame
Closes #1205.
2018-12-04 07:12:26 +01:00
Oliver Blanthorn
7e21d64025
Fix broken completions 2018-11-20 20:16:07 +00:00
glacambre
c412c8dad0
Rename buffers to tabs
Note: The CSS class names are kept as they were, see #1183 for more
information.
2018-11-19 18:35:37 +01:00
glacambre
8d9795a19b
commandline_frame.ts: Make sure activeCompletions is defined
This is a temporary fix for
https://github.com/tridactyl/tridactyl/issues/1167 . I couldn't find
where this issue might come from and since there are no reproduction
steps this will have to do.

I plan on modeling Tridactyl in TLA+ when I have time in order to find
out where our hard-to-reproduce bugs come from. Hopefully this bug will
be among them.

Closes #1167.
2018-11-13 18:35:11 +01:00
glacambre
cd55b6f0f8
Update documentation links
As cmcaine said in #1149, the help page links are currently broken
because typedoc tries to generate documentation for source files in the
`compiler/` directory. I just realized that before #1026, these files
were not referenced in any of the files in the `src` directory and this
is why typedoc ignored them. This change happened because I wanted to
type the metadata.

There are three possible solution to #1149.
- Go back to untyped metadata.
- Move the metadata types to Tridactyl's src directory on build.
- Update all links to the doc.

I believe having typed metadata is useful and I'd like to keep it that
way. Moving the metadata types to Tridactyl's src directory is certainly
doable but doesn't sound like the best idea to me, we're unnecessarily
copying files. Updating the links to the doc sounds reasonable as it's
only a one-time thing and so this is what this commit does in order to
close #1149.
2018-11-08 07:00:35 +01:00
glacambre
7b5f7ef298
Minor code cleanups
This commit makes error messages when the native messenger is
unavailable easier to read. Since they're easier to read, there's no
need for custom errors in setclip/getclip anymore, provided that the
errors they throw are correctly logged. In order to make sure of that,
we remove the try/catch in excmds.ts:clipboard(), which should let
errors bubble up as needed.

I also noticed that while {set,get}Clipboard relied on the command line
being focused in order to work, they didn't do that themselves and
instead expected their callers to have set things up. This didn't make
sense to me so I moved the focusing code inside of {set,get}Clipboard.

This was all done while chasing the elusive #1135 but probably doesn't
change anything about it.
2018-11-07 06:21:36 +01:00
glacambre
b30c68fa51
Fix commandline failing to insert spaces in middle of words
Before this commit, it was impossible to insert a space in the middle of
a word in the command line ; the space would always be inserted at its
end.
2018-11-06 02:19:34 +01:00
Oliver Blanthorn
d796f3bf14
Merge branch 'generic_cmdline' 2018-11-04 12:28:31 +00:00
glacambre
def94f795d
Document ex.* functions 2018-11-02 06:33:09 +01:00
glacambre
cfe5b5c597
commandline_frame.ts: Reset keyEvents
Before this commit, keyEvents was never reset. This caused weird issues
like control closing the commandline after a first ex command had been
accepted. We now reset keyEvents in two places ; when an ex command is
accepted (which could happen when inserting a completion, for example)
and when the command line is closed (which could be triggered by an
outside event).
2018-11-01 19:11:57 +01:00
glacambre
c0bffbd4e3
commandline_frame.ts: Remove unnecessary insert_completion_or_space fn 2018-11-01 18:43:59 +01:00
glacambre
00c01ec6ec
Enable rebinding keys in command line
We re-use the ex-command parser in order to enable rebinding keys in
command-line mode. Command-line manipulation is re-implemented using
previously-abstracter editor commands.
2018-10-31 08:16:58 +01:00
glacambre
a6a3e4ac2f
commandline_frame.ts: Try to get rid of input lag
We try to get rid of input lag by only starting completion computation
some time after the user stopped pressing letters. This should in theory
help with https://github.com/tridactyl/tridactyl/issues/1092 and close
https://github.com/tridactyl/tridactyl/issues/454 and
https://github.com/tridactyl/tridactyl/issues/229.
2018-10-24 22:08:24 +02:00
Oliver Blanthorn
701ac4c4d0
Merge branch 'setpref' 2018-10-17 20:58:52 +01:00
glacambre
6a9cab153c
Add FileSystem completion 2018-10-16 18:07:40 +02:00
glacambre
3dbfe46c3a
Add preferences completion source 2018-10-12 12:44:14 +02:00
Oliver Blanthorn
5c0647242c
Merge branch 'improve_docs2' 2018-10-10 17:53:06 +01:00
glacambre
f51e08d9eb
commandline_frame.ts: Fix exception thrown because of 'tri' not existing
The commandline_frame document does not have a window.tri object. This
makes the commandline throw an exception on page load. We fix this by
using 'window.tri || {}' in order to avoid to avoid issues should
'window.tri' be defined in the command line one day.
2018-10-10 16:21:33 +02:00
glacambre
1c63478b5c
Add HelpCompletionSource
The help completion source provides completions for settings, excmds,
aliases and bindings, sorted in lexicographical order. It's basically a
huge copy-paste of the Settings and Excmd completion sources but should
be enough until we have a way to provide multiple completion sources for
a single excmd.
2018-10-10 11:31:27 +02:00
glacambre
0fff3056cd
commandline_frame.ts: Catch exception in input handler
Because of the await in the input handler, exceptions that are thrown
for previous computations will be thrown for the current one too, even
if there's no reason for it to go wrong. We fix this by surrounding the
await keyword with a try/catch and simply logging the error.
2018-10-05 13:10:52 +02:00
Oliver Blanthorn
3ec27fd40c
Merge branch 'reorganize-directories' 2018-10-04 13:59:19 +01:00
Oliver Blanthorn
2a05a2ffc7
Merge branch 'performance-counters' 2018-10-04 13:25:11 +01:00
glacambre
f7775bfbb0
commandline_frame.ts: Make completions async again
This commit makes completions a bit less slow by making sure that the
previous completion round finished before starting a new one. The
optimal thing to do here would be to interrupt previous computations and
starting new ones right off the bat but this doesn't seem possible with
the current JS APIs.
2018-10-02 16:40:38 +02:00
glacambre
313a55c0eb
commandline_frame.ts: Message own tab rather than background script
I believe this fixes two out of the three bugs mentionned in
https://github.com/tridactyl/tridactyl/issues/804
2018-10-02 12:45:30 +02:00
Saul Reynolds-Haertle
77832fd8a2 Add documentation for perf counts library and clean up the interface
Most importantly, provide some convenience functions for hooking up
listeners and messaging.
2018-09-30 12:01:07 -07:00
Saul Reynolds-Haertle
b8e0459e6b Build a performance counters system so I can start optimizing things
Complete a circular buffer so we don't log too much data, config
settings for turning it on and off (default off, becuase performance)
and for changing the size of the buffer, an excmd for dumping the raw
json so you can pore over it, and for when you just want to
sanity-check yourself instead of groveling over your data for six days
with a deep learning toolkit and three hundred CPUs of compute, an
excmd for pretty-printing your stats in a nice histogram.

I didn't think far enough ahead and only implemented the easy way to
instrument a function, which is with a decorator. I'm getting _really_
angry at typescript not being able to handle decorators on free
functions. bah. I'll figure out a good way to wrap free
functions. Maybe just go the stupid route and make you change
`export async function foo(args)` to `export foo = measured(async
function(args) ...`. But that would break excmd parsing, so... :/

I think that I already want to do a refactor to break excmd.ts into a
bunch of one-line wrappers referencing implementations spread
throughout a bunch of libraries. This would go nicely with that.

Other things I did while I was here:
* Fix the ugliness we had with (window as any).tri by monkey-patching
  the tri property into the window object in tridactyl.d.ts
2018-09-30 12:01:07 -07:00
Saul Reynolds-Haertle
f95a33d76c Fix remaining relative imports 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
987bf32976 move src/styling.ts into src/content 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
3100dca4a3 move src/number.clamp.ts to src/lib 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
3160137c57 move src/messaging.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
10248f4cee Move src/logging.ts to src/lib/ 2018-09-29 18:03:36 -07:00
Oliver Blanthorn
ede3936b82
Add rudimentary settings completion
Obvious enhancements: allow for setting.key.subkey completion; add docstrings; add all options for settings.
2018-08-21 20:06:13 +01: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
35466971b7
Implement basic excmd completion
This implements excmd completion. We're using the typescript compiler
API in order to get the documentation and the type of every function of
Tridactyl and generate a file named "src/metadata.ts" which contains
this information. Since this file is dependency-less it can be imported
from every source file.

We then write a regular completion source which just uses the data
contained in metadata.ts in order to generate its completions.
2018-08-05 17:12:49 +02:00
Oliver Blanthorn
756c29673a
Fix #850: Dodgy yy
I don't quite understand how it worked at all without focusing the commandline first.

Peppered code with some more awaits as part of debugging and couldn't be bothered to test which were necessary.
2018-07-26 10:17:46 +01:00
glacambre
cb06d3b9d5
Fix fillcmdline_tmp not closing the cmdline when changing tabs 2018-07-05 19:50:32 +02:00
glacambre
8211a435e4
fillcmdline_tmp: Don't close the cmdline if its content changed 2018-07-01 18:17:35 +02:00
glacambre
bcc13786dc
Make fillcmdline replace cmdline content on empty string 2018-07-01 17:30:10 +02:00
glacambre
52f8cd7060
Implement notification mechanism that does not steal focus 2018-06-30 16:59:10 +02:00
glacambre
9e225db2d4
Split completions in multiple files, move them to src/completions 2018-06-19 07:59:39 +02:00
glacambre
575693a65e
Implement :bufferall 2018-06-17 06:21:10 +02:00
Bruno Oliveira
0feaa3d2ca
Improve Tridactyl theming capabilities 2018-05-20 16:22:46 +01:00
Oliver Blanthorn
c948658e56
Fix #446: you can now edit completions you select with space 2018-04-27 16:45:50 +01:00
Colin Caine
8e05cd2918 Don't record empty strings or src/controller.tss. Don't send them to exstr parser either. 2018-04-25 22:30:57 +01:00
glacambre
8f70717f18
commandline_frame.ts: Make <Space> put selected completion in cmdline 2018-04-14 10:41:16 +02:00
Oliver Blanthorn
095ce771ea
Formatting: run all typescript through prettier 2018-04-13 19:28:03 +01:00