Commit graph

54 commits

Author SHA1 Message Date
Oliver Blanthorn
0895b268c0
Mitigate our race conditions with a speed limit
I am not proud of this but it seems to work
2019-11-07 19:19:33 +00:00
Jakub Okoński
dd422cd136 Enable some low-hanging TypeScript strictness options 2019-10-20 13:09:21 +02:00
rektrex
8f0b2a5ab8 add exmcmds to load RC file from url 2019-09-19 22:14:51 +05:30
Anton Vilhelm Ásgeirsson
5ddce6763b
Implement writerc native messenger call
This allows us to write the rc to OS. The only way to overwrite your current
rc file is to use mkt!, mktridactylrc! or mktridactylrc -f. mkt* commands
issued without the force/exclamation mark will not overwrite existing files.

Native messenger was updated to 0.1.11 and the mktridactylrc command is
unavailable in prior versions.

Fixed some random indentation errors that occurred in earlier commit.
2019-06-02 14:02:00 +01:00
Anton Vilhelm Ásgeirsson
bdc6a39180
Hook mktridactylrc up to native messenger
Still need to doublecheck subconfigs and fallbacks.
Also need to make sure that ! overwrites and error out if it isn't
supplied.
2019-06-02 14:01:45 +01:00
Anton Vilhelm Ásgeirsson
07d1ed6586
Revive mktridactylrc and add autocontainer parsing
Partially written write function in the config_rc.
2019-06-02 14:01:21 +01:00
glacambre
f050f68740
Turn hint mode into a real mode
This commit turns hint mode into a real mode. This required several
changes:
- In `src/content/hinting.ts`: create a function named getHintCommands
  which returns an object containing functions that can be used as ex
  commands.
- In `src/content/hinting.ts`: rewriting the `parser` function to have
  it check the `hintmaps` object in the config and trigger these if
  they're bound to anything. We can't use a generic parser because
  vimperator hints need to catch every single keypress, even the ones
  that aren't bound to anything and act on them.
- Creating `src/background/hinting.ts`, which just wraps ex commands
  from src/content/hintings.ts in a proxy which will forward calls to the
  content script.
2019-05-28 12:41:40 +02:00
Saul Reynolds-Haertle
0c63944b15 Add tri omnibox keyword as another escape hatch
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/omnibox
2019-05-05 13:42:07 -07:00
Saul Reynolds-Haertle
53b1106b14 Move nearley_utils into lib
It doesn't actually use anything that requires it to live in the
background script, as far as I can tell.
2019-04-30 23:43:39 -07:00
Saul Reynolds-Haertle
2e5fdfb63c Run excmds in content. 2019-04-21 02:42:59 -07:00
glacambre
973ec07f92
Remove BGSELF
BGSELF was a hack that I used when implementing ex commands for the
command line. It consisted of having .excmds_background.generated.ts
import itself as BGSELF in order to dynamically add commands to it. This
let us define excmds in other files while not changing anything in
parsers/exmode.ts.

This was awful so I decided to remove it. This required performing the
following changes:
- Moving text.* and ex.* command definitions to their own files where
  they have zero side effects. While this was easy for text commands, ex
  commands rely a lot on side effects. In order to work around this,
  lib/commandline_cmds exports a single function, getCommandlineFns(),
  which expects an object representing the commandline's state as
  parameter.
- In the background script, import our side effect free files and wrap
  them in proxys that will send "commandline_cmd" and "editorfn_content"
  messages to tabs when needed.
- In the content script, add a listener that will either execute an
  editor function or forward it to the command line when it receives an
  "editorfn_content" message.
- In the commandline script, add a listener that will execute exmode
  commands.
2019-04-21 10:33:05 +02: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
3fe1e5a091
TSLint: re-enable no-empty rule 2019-04-14 10:27:22 +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
bd65146ca8
TSLint: re-enable no-unnecessary-initializer rule 2019-04-10 06:47:46 +02:00
glacambre
c5948c640d
TSLint: re-enable object-literal-shorthand rule 2019-04-04 13:30:11 +02:00
glacambre
85b3e33719
Remove commandline_background
This commit removes commandline_background.ts. I believe this is useful
because the only thing it did was provide recvExStr, which just
triggered a synthetic "onLine" event the only consumer of which was the
parser. Since we already used controller_background + acceptExCmd in
some places, it made sense to me to directly use controller_background +
acceptExCmd everywhere.
2019-02-26 08:41:19 +01:00
glacambre
68a8fccb50
Mobe background/native_background.ts to lib/native.ts
All functions in native_background.ts use browserBg in order to interact
with the native messenger. This means that these functions can also be
used in the content script. This means that there's no point in keeping
these functions in the background/ folder and that there's no point in
having a native_background message type.
2019-02-20 07:09:01 +01:00
Oliver Blanthorn
7e844fe23b
Merge pull request #1356 from glacambre/win_fail_profiledir
native_background.ts: make getProfileDir fail on win if profiledir unset
2019-02-13 12:26:58 +00:00
glacambre
aed8338427
native_background.ts: Fail if profile couldn't be found on linux
profilecmd.code is not necessarily different from 0 if `find` doesn't
return any results. This commit makes sure getProfileDir() checks for
such situations.
2019-02-13 13:22:58 +01:00
glacambre
4734214f9e
native_background.ts: make getProfileDir fail on win if profiledir unset
`profiledir` defaults to "auto" which is not a valid profile path, yet
that's what getProfileDir() returned before this commit.
2019-02-13 12:58:53 +01:00
glacambre
3c9fc84f6d
nativeopen: detect profile, enable space in URLs
This commit does two things:
- If the user didn't specify any arguments, try to detect what profile
  is currently being used and specify it in the command passed to
  firefox. This makes sure tabs opened with `:nativeopen` are opened
  with the right profile if multiple firefox profiles are running.
- Quote url argument to enable adding spaces and quotes to the URL
  (closes #555)
2019-02-13 07:51:42 +01:00
heshamsafi
e0545aca65
native_background.ts: Fix terminator not working as editorcmd
There were two problems: first, the format string used by terminator and
termite was wrong: tuicmd was appended after "%f", which resulted in
tridactyl telling the emulator to execute the file rather than the
tuicmd.
The second issue was that, as mentionned in
https://github.com/tridactyl/tridactyl/issues/1346, `-u` was missing
from terminator's options.
2019-02-11 05:15:16 +01:00
Oliver Blanthorn
66cdc89536
Merge pull request #1290 from glacambre/fix_1197
Make more functions return their last promise
2019-01-21 20:14:45 +00:00
glacambre
ae506cc65b
Make more functions return their last promises
https://github.com/tridactyl/tridactyl/issues/1197 is a bug where
settings aren't properly loaded on `:source` because tridactyl performs
concurrent writes on the config. Making sure every function/excmd
returns its last promise restores synchronicity when it's needed and
should thus fix #1197.
2019-01-21 19:49:24 +01:00
glacambre
cfc4bccba9
native_background.ts: Improve error messages on native messenger ops
This should help with situations such as https://github.com/tridactyl/tridactyl/issues/1284.
2019-01-20 09:15:28 +01:00
glacambre
ab196175ac
Replace return await promise with return promise
Awaiting a promise before returning it doesn't make sense if the await
isn't in a try/catch as awaiting forces a function to be async and thus
turns its return value and any error it might throw into a promise.
Worse than that, it can result in an unnecessary context switch which
could be bad for performance.
2018-12-26 15:33:22 +01:00
glacambre
b97b6dc62e
completions: Use browserBg instead of messaging background
commandline_background.ts:history() isn't used anywhere and is wrong (it
doesn't respect the historyresults setting) so this commit removes it.
Also, currentWindowTabs and allWindowTabs are both used in a single
place (respectively Tab and TabAll completions) and do not perform anything
complicated, thus it's better to have completions juste use browserBg
instead of manually messaging the background process.
2018-12-23 16:37:34 +01:00
glacambre
c259283e96
excmds.ts: Move hidecmdline to content script 2018-12-20 07:47:54 +01:00
glacambre
c9bcd37033
excmds.ts: Move showcmdline to content script 2018-12-20 07:47:33 +01:00
glacambre
2f1fdd4981
native_background.ts: Add more editors 2018-11-10 12:07:45 +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
Oliver Blanthorn
fcdafefa6c
Merge pull request #1093 from glacambre/remove_gnome_terminal
Kill the gnome
2018-10-18 19:12:20 +01:00
glacambre
c5d5120b5c
Kill the gnome
Gnome terminal doesn't work consistently: it doesn't block but some
distros add wrappers that will make it block when given the right
arguments. See https://github.com/tridactyl/tridactyl/issues/1035.
2018-10-18 18:48:29 +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
Oliver Blanthorn
830065c4c6
Revert "Add FileSystem completion"
This partially reverts commit 698fc6a and 25af877. The completion
was  causing breaking  tabopen and  other completions  for people
with outdated native messengers.
2018-10-14 00:28:00 +01:00
glacambre
698fc6ad36
Add FileSystem completion 2018-10-13 20:48:47 +01:00
glacambre
3dbfe46c3a
Add preferences completion source 2018-10-12 12:44:14 +02:00
glacambre
2acce706e0
Implement setpref excmd 2018-10-12 11:42:31 +02:00
Oliver Blanthorn
1123554970
Merge pull request #1073 from joaomsa/feature/control-filename-position-in-editorcmd
Allow control over filename position in editorcmd
2018-10-09 17:24:17 +01:00
Joao Sa
9f39b6fb53 use %f instead of {} for editorcmd 2018-10-09 15:56:02 +00:00
Joao Sa
fe62ebe96b Allow control over filename position in editorcmd 2018-10-08 23:56:35 +00:00
glacambre
113fd9ef80
Implement loading themes from disk.
This fixes https://github.com/cmcaine/tridactyl/issues/491.
2018-10-08 14:47:06 +02:00
Oliver Blanthorn
3ec27fd40c
Merge branch 'reorganize-directories' 2018-10-04 13:59:19 +01:00
Saul Reynolds-Haertle
9df56bbd64 move src/url_util.ts to src/lib/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
6b77696de7 move src/nearley_utils.ts to src/background/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
eeb74c95c6 move src/native_background.ts to src/background/ 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