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.
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.
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.
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.
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.
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.
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.
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.
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.
im_{upcase,downcase,capitalize}_word are functions meant to be used when
in insert/input mode. They should be equivalent to their readline
counterparts.
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?,.;:/!()\[\]\\{}"'`+=].
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.
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.
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.
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.
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.
`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.
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.
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.
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.
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.
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.