Commit graph

39 commits

Author SHA1 Message Date
Oliver Blanthorn
9eb8a12792
Remove more code I can't see the point of 2018-07-25 12:25:56 +01:00
Oliver Blanthorn
d26402929d
Remove obsolete code >:D 2018-07-25 12:08:04 +01:00
glacambre
b9ff5703a2
{excmds,controller}.ts: Fix race condition in state.mode synchronization
This fixes https://github.com/cmcaine/tridactyl/issues/613.
This was a really fun bug. What happened was this:
- First, the content script set state.mode to "hint", which was then
  synchronized
- The event listener in the background script noticed the update and set
  state.mode to "hint" in the background script
- Then, the content script translated the hint selection into an excmd
  that needed to be executed in the background script and sent said
  command to the controller, which lives in the background script
- The content script then set state.mode to "normal"
- The background script executed the command and saved it in
  state.last_ex_str, which was then synchronized
- The event listener in the content script noticed the update and set
  last_ex_str to the last executed str and "state.mode" to "hint"

So basically, the problem was that the background script didn't notice
the state.mode update right after it happened. I fixed this by moving
last_ex_str out of "state" since it doesn't need to be synchronized with
the content script.

This means that the same kind of race condition can still happen. I'm
not sure how to fix this. We could just kill state completely and
instead have state be updated through message passing, but this probably
wouldn't be very ergonomic.
Another solution, the one envisioned for Tridactylv2, is to move to the
content script entirely. This is probably the best option.
2018-06-05 21:13:29 +02:00
Oliver Blanthorn
9b72e4d761
Fix #536 2018-05-18 14:09:12 +01:00
Oliver Blanthorn
e408f080d1
Allow composite to pipe return values and add js eval 2018-05-16 16:44:53 +01:00
Colin Caine
2f1974a9c0 Fix error wording 2018-05-13 14:40:24 +01:00
Oliver Blanthorn
47409e4fd2
Make Logging.Logger.error print an error to the command line 2018-04-23 15:09:20 +01:00
Oliver Blanthorn
786261d019
Fix #337: Make composite and ex-parser more sequential
Allows one to bind `composite tabprev | sleep 100 | tabclose #` and have
the command work; `composite tabclose | tabprev` also works but looks a
little janky. The sleep is required in the first command so that the
value of `#` has time to update.
2018-04-22 17:40:55 +01:00
Oliver Blanthorn
fad7851829
Fix #394: rename generated source .name.generated.ext 2018-04-22 17:15:40 +01:00
Oliver Blanthorn
f8dfb7addb
Fix annoying inputmode bug, mark II 2018-04-22 15:52:39 +01:00
Oliver Blanthorn
027371029c
Fix annoying inputmode bug 2018-04-20 17:25:10 +01:00
Colin Caine
2ccfdda110 Use keyseq for normalmode
Also rename ex_str to exstr in a bunch of places for no real reason.
2018-04-16 00:07:49 +01:00
Oliver Blanthorn
095ce771ea
Formatting: run all typescript through prettier 2018-04-13 19:28:03 +01:00
Oliver Blanthorn
6d8fe17069
Add nascent find mode 2018-03-18 13:11:11 +00:00
Colin Caine
96e32f57e5 Fix #311 - Don't write to browser.storage so often
Turns out writing to browser.storage is expensive because state.ts and
config.ts both listen for it in every tab. I'd vaguely assumed that
Firefox would run other tabs as low priority tasks and that this would
not be an issue, but it doesn't.

I also wrote the code in a rush, and while I mused that this potential
risk exists I didn't document it or explore it.

Retrospective: Content switches are expensive - think before you do
anything that may wake many processes and don't make wild assumptions
about how Firefox handles multiprocessing.
2018-03-07 02:17:50 +00:00
Colin Caine
53e51497e7 logging: rewrite in OOP style 2017-12-30 00:46:26 +00:00
Colin Caine
f398895dce logging: introduce convenience functions 2017-12-29 23:58:23 +00:00
John Beard
baefd09973 Allow levelled logging for debug
This is useful for suppressing spew, but still allowing easy debugging
when needed, without rebuilding.

To use, use excmd:

     setlogginglevel <prefix> <level>

Where the level is one of:

    - never:  never log
    - error
    - warning
    - info
    - debug:  most verbose

Output is directed to console methods "error", "warn", "log", "debug".
2017-12-29 18:57:16 +00:00
Colin Caine
cdf53966c0 mode change: fix #176
Thanks @Koushien
2017-12-11 13:26:42 +00:00
glacambre
91d8bd1e39 src/controller.ts: Use func instead of ex_str to check if command is "repeat" 2017-12-06 16:36:18 +00:00
glacambre
dab97fea10 src/{controller,excmds}.ts: Fix endless repeat, implement more intuitive behavior. 2017-12-06 16:31:53 +00:00
glacambre
e61358b63f src/{config,controller,excmds,state}.ts: Implement dot repeat. 2017-12-06 16:31:53 +00:00
Zhong Jianxin
01221f3052 Add inputmode
- Add `focusinput -n` and `focusinput -N`
- Press `gi` to focus input and enter inputmode
- When in inputmode, `Tab` to focus input after last focussed one, `Shift+Tab`
  to focus input before last focussed one
2017-12-05 22:12:34 +00:00
Colin Caine
9683e11f70 Tidy up gobble mode. Re-use key classification. 2017-11-20 23:23:25 +00:00
D.B
0a0c31230e add gobble mode and quickmarks 2017-11-20 23:23:25 +00:00
Oliver Blanthorn
cf684c7935
Fix #86: Add metakey to list of ignored keys in normal mode for Macs 2017-11-20 09:21:07 +00:00
Colin Caine
75ede02bc6 keydown: improve suppression logic 2017-11-19 02:41:01 +00:00
Oliver Blanthorn
49bbcb7fc9
Add rudimentary ignore mode bound to I 2017-11-15 00:03:34 +00:00
Colin Caine
d8e1eb4506 insert: Add 'Escape' bind 2017-11-09 21:01:57 +00:00
Colin Caine
927e19c818 hinting: First working version
state.ts also reworked into a sexy new machine. Check it out!
2017-11-09 05:44:48 +00:00
Colin Caine
fad94a697e parsers: split into real modules
This is to fix an issue with multiple imports of typescript namespaces.
2017-11-09 05:44:47 +00:00
Colin Caine
adfca7cf69 hinting WIP: plumb to background 2017-11-09 05:44:40 +00:00
Oliver Blanthorn
37119e510a
Dirty workaround to allow ^L, ^G to be passed through to Firefox correctly 2017-11-04 18:03:58 +00:00
Colin Caine
8d53fd60eb Rework messaging, key suppression, exmode parser
exmode.parser now converts strings to the types given in excmd
signatures.

Messaging now works in both directions (but I haven't made excmds.ts use
the new system yet. Exercise for the reader (see keydown_* state() for a
simple example)).

keys are now being suppressed, but in a pretty stupid way.

I got fed up of not having proper itertools, or str conversions, so I
wrote some. Others have written them in JS, but they were fun to make.
Only the ones I'm using are tested.
2017-10-23 09:42:50 +01:00
Colin Caine
bed1109cc9 types: extend type checking 2017-10-06 03:30:51 +01:00
Colin Caine
7736042ea3 src: fix tsc -d; use insert mode for inputs
The input detection is very naive at the moment. Fix soon.
2017-10-05 18:15:27 +01:00
Colin Caine
24fbd85a75 src: log errors from exmode.parser to browser console 2017-10-05 13:26:28 +01:00
Oliver Blanthorn
38923d8876
Add sketch of insert mode 2017-10-02 21:09:10 +01:00
Colin Caine
5964430fe1 Convert to es6 modules
Motivation:

 - Most test frameworks expect modules
 - I'm told they're the future

Changes:

 - Every typescript source file is now an es6 module
 - Build system is now webpack (tho rollup makes nicer outputs)
 - Outputs of buildsystem are one js file per entry point (background,
   content, commandline_frame)
 - These bundled js files are generated by traversing the dependency
   graph of each entry point
2017-10-02 01:17:32 +01:00