Commit graph

101 commits

Author SHA1 Message Date
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
Fabian Furger
7ceaf84358 Apply theme to command line
Use dark theme from
https://gist.github.com/KrazyCavin/cebb807e961a4a32bb04aa0c1757bab8
Relates to #230.
2018-03-08 21:57:21 +00:00
Colin Caine
8a500bbf92 Blur iframe after clipboard actions 2018-02-19 00:15:44 +00:00
Colin Caine
0693cdc45d Merge remote-tracking branch 'origin/master' into HEAD 2018-01-28 15:04:47 +00:00
Isaac Khor
1203dbd86b
Make let/const consistent 2018-01-09 17:33:52 +08:00
Isaac Khor
1a20a646b5 Extract core aliasing functionality into separate file and change to recursively expand aliases 2018-01-09 00:15:06 +08:00
Koushien
dbf3ad8414
Support Emacs-style C-(a|e|k|u) in cmdline
By default, C-c in Vimperator copies selection if
present. We reimplement this.
2018-01-05 21:36:12 -08:00
Isaac Khor
2441fba8c0 Merge branch 'master' into i236-common-ex-aliases 2017-12-31 16:57:57 +08:00
Isaac Khor
29d58cd571 Change from 'alias' to 'command' and access config options differently 2017-12-31 16:53:35 +08:00