Commit graph

699 commits

Author SHA1 Message Date
Saul Reynolds-Haertle
c531aa5481 Move src/config.ts to src/lib/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
539fcb18c1 Move src/commandline_content.ts to src/content/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
9dad2e4ae8 Move src/commandline_background.ts to src/background/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
11e28ce1fc Move src/aliases.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
glacambre
484fcd946a excmds.ts: Add im_{forward,backward}_word
im_{forward,backward}_word are functions meant to be used when in
insert/input mode. They should be functionnally equivalent to readline's
{forward,backward}-word. They move the cursor one word forward or
backward.
2018-09-29 20:28:06 +02:00
glacambre
24974eb17a excmds.ts: Add im_{forward,backward}_char
im_{forward,backward}_char are functions meant to be used when in
insert/input mode. They should be functionnally equivalent to readline's
{forward,backward}-char. They move the cursor one character forward or
backward.
2018-09-29 20:18:33 +02:00
glacambre
91c006c9aa excmds.ts: Add im_end_of_line
im_end_of_line is a function meant to be used when in insert/input
mode. It should be functionnally equivalent to readline's
end-of-line. It moves the cursor to the end of the current line.
2018-09-29 20:14:49 +02:00
glacambre
292fa69567 excmds.ts: Add im_beginning_of_line
im_beginning_of_line is a function meant to be used when in insert/input
mode. It should be functionnally equivalent to readline's
beginning-of-line. It moves the cursor to the beginning of the line.
2018-09-29 20:11:36 +02:00
glacambre
4733e759e9 excmds.ts: Add im_backward_kill_word
im_backward_kill_word is a function meant to be used when in
insert/input mode. It should be functionnally equivalent to readline's
kill-word. It removes the word before the cursor.
2018-09-29 20:02:06 +02:00
glacambre
53a9c043a0 excmds.ts: Add im_kill_word
im_kill_word is a function meant to be used when in insert/input
mode. It should be functionnally equivalent to readline's
kill-word. It deletes every character from the cursor to the end of the
word.
2018-09-29 19:17:10 +02:00
glacambre
05915d3dbb excmds.ts: Add im_kill_whole_line
im_kill_whole_line is a function meant to be used when in insert/input
mode. It should be functionnally equivalent to readline's
kill-whole-line. It removes every character of a line, including the
newline character.
2018-09-29 09:22:45 +02:00
glacambre
dbb173770f excmds.ts: Add im_backward_kill_line
im_backward_kill_line is a function meant to be used when in
insert/input mode. It should be functionnally equivalent to readline's
backward-kill-line. It removes every character from the beginning of the
line up to the cursor. If the cursor is at the beginning of the line, it
removes the newline before the cursor.
2018-09-28 22:38:50 +02:00
glacambre
90a501e802 excmds.ts: Add im_kill_line
im_kill_line is a function meant to be used when in insert/input
mode. It should be functionnally equivalent to readline's
kill-line. It deletes every character from the cursor to the end of a
line, merging lines if the character right after the cursor is a
newline.
2018-09-28 22:04:13 +02:00
glacambre
72a44e9f85 excmds.ts: Add im_{upcase,downcase,capitalize}_word
im_{upcase,downcase,capitalize}_word are functions meant to be used when
in insert/input mode. They should be equivalent to their readline
counterparts.
2018-09-28 20:23:33 +02:00
glacambre
7fcee7e3eb excmds.ts: Add im_transpose_words
im_transpose_words is a function meant to be used when in insert/input
mode. It should be functionnally equivalent to readline's
transpose-words. It transposes the word the cursor is in (or, if the
cursor is not in a word, the word before it) with the next word (or the
previous word if the word to transpose is the last word of the text).

The notion of word is defined by the "wordpattern" setting, which is a
regex that matches every character that a word can contain. The default
pattern is [^\s], which means a word can be any character except
whitespace. Other useful patterns could be [^\s/] or
[^\s?,.;:/!()\[\]\\{}"'`+=].
2018-09-28 17:45:39 +02:00
glacambre
f461d85d2f Add :saveas ex command
This commit adds a `:saveas` ex command that behaves mostly like
pentadactyl's `saveas`. This requires adding a new `move` primitive to
the native messenger which behaves like `cp` (but isn't actually a call
to `cp` in order to stay compatible with windows). Then
native_background.ts uses that in order to move files when their
download is complete.
2018-09-28 07:33:00 +02:00
Oliver Blanthorn
6bfa641b32
Fix #1028 and maybe some other errors: persuade buildbot to rebuild help 2018-09-27 13:01:33 +01:00
glacambre
f2df3b9e4e excmds.ts: Add im_transpose_chars
im_transpose_chars is a function meant to be used when in insert/input
mode. It should be functionnally equivalent to readline's
transpose-chars. It transposes the character before the cursor with the
one after it and then moves the cursor one character to the right.
2018-09-26 22:29:39 +02:00
glacambre
5138b7bf35 excmds.ts: Add im_tab_insert
im_tab_insert is a function meant to be used when in insert/input mode.
It should be functionnally equivalent to readline's tab-insert. It
behaves like the <Tab> key.
2018-09-26 22:15:34 +02:00
glacambre
1783086c13 excmds.ts: Add im_delete_backward_char
im_delete_backward__char is a function meant to be used when in
insert/input mode. It should be functionnally equivalent to readline's
delete-backward-char. It behaves like the <BackSpace> key.
2018-09-26 22:08:27 +02:00
glacambre
4b830dbaf9 excmds.ts: Add im_delete_char
im_delete_char is a function meant to be used when in insert/input mode.
It should be functionnally equivalent to readline's delete-char. It
behaves like the <Del> key.
2018-09-26 22:07:55 +02:00
Oliver Blanthorn
318423b1e6
Merge branch 'urlspecific_config' 2018-09-21 11:33:23 +01:00
Oliver Blanthorn
576ff17df6
Merge pull request #1014 from WorldCodeCentral/master
Change :set home to :set homepages
2018-09-19 11:04:24 +01:00
WorldCodeCentral
dfc1e73499
Change home to homepages
Correct documentation of home to show "set homepages" instead of "set home" which was incorrect.
2018-09-19 00:50:45 +02:00
glacambre
46ca5daf64
excmds.ts: Make editor() return a [filepath, content] tuple
`editor()` didn't return anything useful. This partially fixes #1005 by
letting users create commands to automatically delete a the temporary
file after `editor()` finishes.
2018-09-15 08:17:10 +02:00
Oliver Blanthorn
64f1422187
Remove reference to ESR since it no longer supports Vimperator 2018-09-14 10:30:26 +01:00
glacambre
601cffbab8
config.ts: Implement priority setting for site-specific settings 2018-09-12 11:12:17 +02:00
glacambre
547065fed7
Add unseturl ex command 2018-09-11 06:34:36 +02:00
glacambre
1a1688a83f
Implement site-specific settings
This PR implements site-specific settings. It requires multiple changes
and new features.

First, I needed to create a new value in `window.tri` named
`contentLocation`. This contentLocation object is either a Location or
URL object containing the URL of the currently selected tab of the
currently selected window. This is required because config.get() is not
asynchronous and we probably want to keep it that way, thus we can't
message the content script just to get the current url.

Then, we create a new object, URLCONFIGS, in content.ts. It behaves
exactly the same as USERCONFIG, except it has a level of indirection,
matching url patterns to config objects. This requires creating new
seturl, geturl and unseturl functions which behave mostly the same as
set, get and unset.

Last, we create a `seturl` ex command in order to interact with this new
object.
2018-09-10 18:51:31 +02:00
glacambre
7bf5198e65
Turn logging levels into string in the config
Using numbers instead of strings made things complicated when dealing
with logging (:set was more complex, :get returned a number instead of a
string...). This commit fixes this.

Note that this commit removes validation for logging levels. This means
that users can now set erroneous logging levels. Fixing this will
require better type info generation in the compiler and will happen in
another commit.
2018-09-10 17:39:08 +02:00
glacambre
a7ddcb1b5a
Respect the tabs.move/tabs.create API
According to MDN[1], when you create a tab that should be placed at the
end of a window, you should use the number of tabs of the window as
index.
But if you use tabs.move(), you should use an index value of -1[2].

Probably fixes https://github.com/tridactyl/tridactyl/issues/990 .

1: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/create#Parameters
2: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/move#Parameters
2018-09-10 07:05:47 +02:00
Alex Griffin
e8f216f441 Some small fixes to the native messenger installer 2018-09-06 10:02:31 -05:00
Oliver Blanthorn
35f48ae1f5
Merge branch 'key-translation-map' 2018-09-05 14:37:58 +01:00
Oliver Blanthorn
79fec22109
Add keymap excmd 2018-09-05 14:34:10 +01:00
Saul Reynolds-Haertle
8c8b0a680f Unbreak gobble-mode
I apparently missed putting the relevant excmd into content-mode where
it could actually act on the state. >_>
2018-09-05 03:15:12 -07:00
Oliver Blanthorn
8a2ec6fda0
Fix link to config help 2018-09-04 13:00:32 +01:00
Saul Reynolds-Haertle
77d17a6d5f Fix typo in exmcds docstring, add TODO in bind-args mode mapping 2018-09-02 16:25:34 -07:00
Saul Reynolds-Haertle
e4757a72a0 blacklistadd now only needs DocStart since mode is per-document
Per-document modes might actually leave `TabLeft` completely unused by
most people, so we should be careful to not let that code start to
decay.

Sample tridactylrc turned out to not need updating

It looks like help docs don't reference this functionality anywhere
else, so this should be all the autocommand-related changes.
2018-09-02 16:25:34 -07:00
Saul Reynolds-Haertle
90fa242e84 fix name of content state script to fit style 2018-09-02 16:25:34 -07:00
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