Commit graph

559 commits

Author SHA1 Message Date
Saul Reynolds-Haertle
d1e6a86539 Janky proof of concept for per-tab state, incl mode and parsers
I've been programming on pure instinct for like five hours and I'm not
sure what exactly I did any more. I *think* that what I did was
something like:
* Split `state.ts` into `state.ts` and `content_state.ts`, then
  removed mode from state and moved it to content_state.
* Made the types in content_state.ts a hair more powerful
* Fixed all errors resulting from those two changes, in the process
  swapping state out for content_state wherever appropriate.
* Moved a couple excmds from background into content since they
  depended heavily on the mode and should live with the mode
* Split the controller in half, moving the parser logic to the content
  script and leaving acceptExCmds in the background
  version. content_controller forwards excmds to background script
  using messaging.
* Nuked the keydown_* code, since we no longer need to forward keys to
  the background.
* Went around fixing everything resulting from *those* changes, mostly
  the various perversions of keydown listeners
* Various tweaks here and there that probably didn't do anything but I
  was just changing things at random a third of the time and I really
  need to go through this and clean it up.

Things that work:
* excmds are nice now. each tab has its own commandline; they stay
  open when you navigate between tabs and you can come back to them
  after doing stuff in another tab and finish your command line input.
* keybinds that don't don't involve mode switching: `[[`, `]]`, `j`,
  `k`, `r`, etc, all still functional.
* You can turn on hinting mode and, again, navigate to another tab
  which will *not* be in hinting mode, do whatever you need to do
  there including excmds or more hinting, and then come back to finish
  the hint you started in the first tab
* You can exit hint mode by pressing escape. :P

Things that I broke:
* ...Actually quite a bunch of stuff, I think.
* I don't seem to be able to *finish* a hint any more. Sometimes I
  can't even get one key in.
2018-09-02 16:25:34 -07:00
Oliver Blanthorn
0aa919f73d
Fix link to configuration 2018-09-02 11:08:26 +01:00
glacambre
3e9c212b3e
Implement typechecking for known settings
This commit implements typechecking in the `:set` excmd. It uses metadata
to make sure the given argument is valid.

Some of the settings were stored as numbers in the config while they
were passed as strings to `:set()`. This prevented them from being
configurable. This has been fixed by turning them into string in the
config and ensuring that they are correctly deserialized when retrieved
from the config.

Note that there still are a few settings that are stored as int in the
config (namely the tts ones). This should probably be fixed at some
point but is not urgent as it has always been impossible to configure
them and nobody ever complained about it.
2018-09-01 22:45:48 +02:00
Oliver Blanthorn
c1a7dfbab1
Merge branch 'configdocs' 2018-08-30 21:40:38 +01:00
Colin Caine
7b8fada4d3 Fix doc typo for :help 2018-08-30 13:47:35 +01:00
Oliver Blanthorn
fd218e060b
Merge branch 'master' of github.com:cmcaine/tridactyl into configdocs 2018-08-29 10:58:34 +01:00
Oliver Blanthorn
15140b1bea
Fix #948: set newtab about:home kinda works subject to usual caveats 2018-08-28 15:44:04 +01:00
Oliver Blanthorn
84001143c3
Merge branch 'update_typescript' 2018-08-19 14:10:15 +01:00
Anton Vilhelm Ásgeirsson
7c1f0cecfb Fix undo current_window_id check. 2018-08-19 12:32:04 +00:00
glacambre
cc94f7f790
Fix #926: rebind all rapid binds from g; to ;g 2018-08-19 13:13:11 +01:00
Anton Vilhelm Ásgeirsson
0908af9100 Refactor undo excmd to comply with ts 3.0.1. 2018-08-19 11:56:51 +00:00
Oliver Blanthorn
4f1d96767b
Merge branch 'port_hints_to_new_fangled_way' 2018-08-18 18:28:47 +01:00
Oliver Blanthorn
85030eb7d9
Add binds for rapid and some old Pentadactyl binds 2018-08-18 18:28:11 +01:00
glacambre
f43adc9467
Make rapid hinting return an array
Rapid hinting now returns an array. When no hints have been selected, an
empty array is returned. When no hints have been selected in regular
hinting mode, an empty string is returned.
2018-08-17 07:59:00 +02:00
glacambre
0d8957b536
Fix hint breaking when no option is given 2018-08-16 17:22:30 +02:00
Oliver Blanthorn
57446fe57c
Merge branch 'master' of github.com:cmcaine/tridactyl into configdocs 2018-08-16 15:46:24 +01:00
glacambre
703a8ac611
excmds.ts: Hide bind_args type and parse_bind_args function 2018-08-09 06:21:00 +02:00
glacambre
6c3c04fc8d
Make rapid hint mode less janky, enable hint mode for every action
Making hint mode less janky is achieved by not resetting hint mode when
a hint has been selected. New command line options, `-q*` where `*`
stands for any alread-existing flag, are added.

The global hint flow is as following:
- User goes into hint mode
- hint mode promise is created
- When a hint is selected, the corresponding action is performed (e.g.
  opening a link, killing an element...)
- The result of the action is saved in the hint
- If we're not in rapid hint mode, modeState is reset, and the hint mode
  promise is resolved with the result of the action as parameter
- If we're in rapid hint mode, modeState is not reset. Instead its
  filter is reset and all its hints are displayed again.
- Rapid hint mode is only left on escape, and this means that the
  promise will be rejected.

Rejecting the promise means that we can't pipe elements selected in hint
rapid hint mode to other commands. This makes sense because pursuing
execution of a pipe several times in parallel, on top of being possibly
hard to implement, would probably be confusing.

Instead of using a pipe in order to execute arbitrary commands in hint
mode, users can use `-qW excmd`. Contrary to the pipe, this makes clear that
the excmd will be executed multiple times, once per focused hint.

This way of handling rapid hint mode has the advantage of simplifying
the `hint` function. Now, instead of having to return a tuple with the
number of available hints, the function can just return the selected
element or whatever the command line arguments specifies it should
return.
2018-08-04 20:18:43 +02:00
glacambre
fcf204f82e
Make most hint modes return their result for easy rapid hinting 2018-08-04 18:52:27 +02:00
glacambre
b94c3dccab
Merge source code for hint -s/-S/-a/-A 2018-08-04 18:52:22 +02:00
glacambre
b5287290e0
excmds.ts:hint(): Turn big if/else into switch/case 2018-08-04 18:52:19 +02:00
glacambre
caf76bb186
Port hint -w/-wp to newfangled way 2018-08-04 18:52:16 +02:00
glacambre
93acb6831b
Port hint -r to newfangled way 2018-08-04 18:52:13 +02:00
glacambre
59d030bd54
Port hint -; to newfangled way 2018-08-04 18:51:31 +02:00
glacambre
87a360a1f9
Port hint -s/-S/-a/-A to newfangled way 2018-08-04 18:51:28 +02:00
glacambre
1537ada421
Port hint -k to newfangled way 2018-08-04 18:49:21 +02:00
glacambre
74d58cdc46
Port hint -i/-I to newfangled way 2018-08-04 18:49:17 +02:00
Mohammad AlSaleh
d9258f7993 tabmove: We don't need separate branches for + and - anymore
Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2018-08-04 19:14:32 +03:00
Mohammad AlSaleh
728b5ccadf tabmove: Make 0 a real alias to $
Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2018-08-04 18:01:19 +03:00
Mohammad AlSaleh
9df30d2dce tabmove: Fix absolute and default moves
Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2018-08-04 17:48:53 +03:00
Mohammad AlSaleh
6bab32f99b tabmove: Treat pinned and unpinned tabs as separate groups
Fixes #877

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2018-08-04 15:44:47 +03:00
Oliver Blanthorn
b7158d2dba
Fix default hint case 2018-08-03 22:25:15 +01:00
Oliver Blanthorn
cd89a1d1e9
Merge branch 'master' of github.com:cmcaine/tridactyl into glacambre-fix_hint_bug 2018-08-03 22:09:07 +01:00
glacambre
49309d9486
Improve hint error handling.
Instead of returning null when no hint has been selected, hinting.pipe
will now return a promise that will be resolved once a hint has been
selected or rejected if hintstate is destroyed without a hint being
explicitly selected by the user or if there are no hints to select.

Promise rejection is then handled at the end of excmds.ts:hint(), as
suggested by bovine3dom on Riot.
2018-08-03 22:56:12 +02:00
glacambre
e1affec065
Implement mode for unbind
Closes https://github.com/cmcaine/tridactyl/issues/887.
2018-08-03 06:50:04 +02:00
glacambre
2f6bd1726e
Fix hint bug.
In hinting.ts, pipe() and pipe_elements() assumed that the resolve
function they passed to hintPage() would always be called, which wasn't
always the case (e.g. when a users goes into hint mode but presses
`<Esc>`).

This caused unresolved promises to linger in the tab. When the tab was
closed, an error was thrown about the message manager being
disconnected. This was caught by Tridactyl and displayed in the command
line.

We're fixing this bug by passing no-op functions as onSelect to
hintPage() and explicitly passing the resolve function. The resolve
function is then saved in HintState and called when destroying
HintState.

We parametrize reset() in order to be able to distinguish between resets
caused by a hint being selected and by the user pressing `<Esc>`. This
is necessary because we need to know when the function should resolve
the last focused hint and when it shouldn't.

We then add a bunch of null handling in excmds.ts:hint() in order to
make sure not to introduce other bugs.

This fixes https://github.com/cmcaine/tridactyl/issues/855.
2018-08-01 20:41:01 +02:00
Oliver Blanthorn
083abf029e
Mention hint case setting in hint help 2018-08-01 14:04:47 +01:00
Colin Caine
876050d410 milliseconds aren't strings 2018-07-30 23:51:08 +01:00
Oliver Blanthorn
bf1a2ad5c0
Fix #866: add yet another flag syntax, this time for binds 2018-07-30 18:27:08 +01:00
Oliver Blanthorn
dd94e5a493
Fix #671: support _ prefix for RC, improve docs 2018-07-30 17:56:05 +01:00
Oliver Blanthorn
ab94d9dd4e
Merge branch 'master' of github.com:cmcaine/tridactyl into container-aucmds 2018-07-30 14:56:53 +01:00
Oliver Blanthorn
3f64853114
Merge branch 'master' of github.com:cmcaine/tridactyl into MoSal-master 2018-07-30 14:51:14 +01:00
Oliver Blanthorn
d00d84c0fc
Add magic indices to tabmove 2018-07-30 14:51:06 +01:00
Oliver Blanthorn
59da8d417f
Fix #867: deprecate !js{,b}. 2018-07-30 14:37:52 +01:00
Mohammad AlSaleh
50d1ddae8d Fix another tuple unpacking on the wrong side of brackets
Missed in 66af0b8be4

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2018-07-29 23:12:56 +03:00
Mohammad AlSaleh
fcfb9afda6 Make tabmove circular
Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2018-07-29 17:46:01 +03:00
Anton Vilhelm Ásgeirsson
66af0b8be4 Fix tuple unpacking on the wrong side of brackets. 2018-07-26 17:02:09 +00:00
Anton Vilhelm Ásgeirsson
524bce91c5 Remove traces of old rapid hint fix and address the correct element of
hinting.pipe.
2018-07-26 13:21:38 +00:00
Anton Vilhelm Ásgeirsson
4b8576646a Refactor hinting.pipe to return a tuple.
Now returns a tuple of the element and the number of hints available
when the function was run. This mainly fixes the rapid hint bug
encountered when the user enters rapid hint mode with only one link
available.

Another application idea would be modeline info or something in that
vein.
2018-07-26 12:05:49 +00:00
Oliver Blanthorn
041d8f6388
Hide some internal functions from help 2018-07-26 10:45:11 +01:00