summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrafa_99 <raroma09@gmail.com>2021-09-25 01:23:25 +0100
committerrafa_99 <raroma09@gmail.com>2021-09-25 01:23:25 +0100
commitb1518d7d72421cae4b157943dd07e2030a918289 (patch)
treeb882d71068852d0de1841b70e68a1ed104e640b4
parentbc11211ffb6ecc5bed00f144ab03cd8c770035a5 (diff)
Project branch off
-rw-r--r--.github/ISSUE_TEMPLATE.md7
-rw-r--r--.github/stale.yml21
-rw-r--r--.travis.yml17
-rw-r--r--CHANGELOG.md317
-rw-r--r--CONTRIBUTING.md107
-rw-r--r--Makefile25
-rw-r--r--README.md73
-rw-r--r--config.mk8
-rw-r--r--doc/neovimb.1 (renamed from doc/vimb.1)143
-rw-r--r--neovimb.desktop (renamed from vimb.desktop)4
-rw-r--r--src/.gitignore2
-rw-r--r--src/Makefile8
-rw-r--r--src/bookmark.c2
-rw-r--r--src/completion.c2
-rw-r--r--src/config.def.h4
-rw-r--r--src/ex.c10
-rw-r--r--src/ext-proxy.c4
-rw-r--r--src/handler.c2
-rw-r--r--src/hints.c4
-rw-r--r--src/input.c12
-rw-r--r--src/main.c40
-rw-r--r--src/main.h2
-rw-r--r--src/map.c2
-rw-r--r--src/normal.c8
-rw-r--r--src/scripts/focus_editor_map_element.js4
-rw-r--r--src/scripts/hints.css8
-rw-r--r--src/scripts/hints.js6
-rw-r--r--src/scripts/set_editor_map_element.js6
-rw-r--r--src/setting.c4
-rw-r--r--src/shortcut.c2
-rw-r--r--src/util.c2
-rw-r--r--src/webextension/ext-main.h6
-rw-r--r--tests/.gitignore2
-rw-r--r--tests/Makefile20
-rw-r--r--tests/manual/dummy.html10
-rw-r--r--tests/manual/editable-focus-in-iframe.html9
-rw-r--r--tests/manual/editable-focus.html41
-rw-r--r--tests/manual/hints/hints.html30
-rw-r--r--tests/manual/hints/label-positioning.html28
-rw-r--r--tests/manual/hints/wrapped.html13
-rw-r--r--tests/manual/js-window-close.html9
-rw-r--r--tests/manual/window-open.html21
-rw-r--r--tests/test-file-storage.c147
-rw-r--r--tests/test-handler.c112
-rw-r--r--tests/test-shortcut.c122
-rw-r--r--tests/test-util.c334
46 files changed, 154 insertions, 1606 deletions
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
deleted file mode 100644
index 91bdb03..0000000
--- a/.github/ISSUE_TEMPLATE.md
+++ /dev/null
@@ -1,7 +0,0 @@
-<!-- If this is a bug report, please provide your version information
-$ vimb --bug-info -->
-### Steps to reproduce
-
-### Expected behaviour
-
-### Actual behaviour
diff --git a/.github/stale.yml b/.github/stale.yml
deleted file mode 100644
index 9aea690..0000000
--- a/.github/stale.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-# Configuration for probot-stale - https://github.com/probot/stale
-# Number of days of inactivity before an issue becomes stale
-daysUntilStale: 60
-# Number of days of inactivity before a stale issue is closed
-daysUntilClose: false
-# Issues with these labels will never be considered stale
-exemptLabels:
- - rfc
- - security
- - pinned
- - bug
-# Label to use when marking an issue as stale
-staleLabel: stale
-# Comment to post when marking an issue as stale. Set to `false` to disable
-markComment: >
- This issue has been automatically marked as stale because it has not had
- activity within the last 60 days.
-# Comment to post when closing a stale issue. Set to `false` to disable
-# closeComment: >
-# This issue has been automatically closed because it has not had activity
-# since it was marked as stale. Thank you for your contributions.
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 7dbb4bc..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-branches:
- except:
- gh-pages
-
-language: c
-dist: bionic
-sudo: required
-
-compiler:
- - gcc
- - clang
-
-before_install:
- - sudo apt-get update -q
- - sudo apt-get install -y --allow-unauthenticated --no-install-recommends libwebkit2gtk-4.0-dev
-
-script: make options && make -j test
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index 0674e71..0000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1,317 +0,0 @@
-# Changelog
-
-All notable changes to this project will be documented in this file.
-
-The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
-and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
-
-## [Unreleased]
-### Added
-* The new env variable `$VIMB_SELECTION` is set to the current selected text
- whenever a `shellcmd` is run #592.
-* Allow to push link url to queue by `<S-LeftMouse>` #610.
-* Allow to decide if html5 notfication are allowed #651. New setting
- 'notification=[ask,always,never]' added.
-* Add new env `VIMB_WIN_ID` var for `:shellcmd` which holds the own window id.
-### Changed
-* Modes some files from `$XDG_CONFIG_HOME/vimb` into `$XDG_DATA_HOME/vimb` #582.
- Following files are affected `bookmark`, `closed`, `command`, `config`,
- `cookies.db`, `history`, `queue` and `search`.
- Existing files could be moved to the new location by
- ```
- mv $XDG_CONFIG_HOME/vimb/{bookmark,closed,command,cookies.db,history,queue,search} \
- $XDG_DATA_HOME/vimb
-
- # and same for existing profiles
- mkdir $XDG_DATA_HOME/vimb/<ProfileName>
- mv $XDG_CONFIG_HOME/vimb/<ProfileName>/{bookmark,closed,command,cookies.db,history,queue,search} \
- $XDG_DATA_HOME/vimb/<ProfileName>
- ```
-### Fixed
-* Fixed ignored last line in config file if this line did not end in newline.
-* Fixed crash in normal_focus_last_active (Thanks to Maxime Coste)
-* Fixed hint keys going to webview if the hinted element had no src-attribut
- (thanks to Maxime Coste)
-* Fixed erro in hinting on gitlab which caused the hints to have ho labels #659.
-### Removed
-* Expansion of `%` to the current opened URI for `:shellcmd` was removed
- because it breaks the `x-hint-command` with URIs containing '%'. But it is
- still possible to use `$VIMB_URI` for the `:shellcmd` which has the same
- effect.
-
-## [3.6.0] - 2020-01-02
-### Added
-* `:cleardata [listOfDataTypes] [timeSpan]` command to clear various types of
- stored website data modified in the last _timeSpan_.
-* Setting `hint-match-element` to allow to disable the hinting to filter hints
- by the elements text content. This is useful if 'hint-keys' are set the
- chars instead of numbers.
-* New autocmd event `LoadStarting` to run auto commands before the first page
- content is loaded (Thanks to Patrick Steinhardt).
-* Setting `geolocation` with values ('ask', 'always' and 'never') to allow the
- user to permit or disable geolcation requests by default (Thanks to Alva).
-* Setting `dark-mode` to switch the webview into dark mode, which might be
- picked up by pages media query to setup dark styling (Thanks to Alva).
-* Option `--cmd, -C` to run ex commands on startup.
-### Changed
-### Fixed
-### Removed
-* `:clearcache` was removed in favor of more advanced `:cleardata` command.
- The previous behaviour of `:clearcache` could be replaces by
- `:cleardata memory-cache,disk-cache`.
-
-## [3.5.0] - 2019-07-29
-### Added
-* Add external download command #543 #348.
-* Added ephemeral mode by new option `--incognito` #562.
-### Changed
-* Hinting shows the current focused elements URI in the statusbar.
-* Show error if printing with `:hardcopy` fails #564.
-### Fixed
-* Fixed compilation if source is not in a git repo (Thanks to Patrick Steinhardt).
-* Fixed partial hidden hint labels on top of screen.
-* Fix segfault on open in new tabe from context menu #556.
-* Fix "... (null)" shown in title during url sanitization.
-### Removed
-* Setting `private-browsing` was removed in favor of `--incognito` option.
-
-## [3.4.0] - 2019-03-26
-### Added
-* Allow to show video in fullscreen, without statusbar and inputbox, if requested.
-* Added option `--no-maximize` to no start with maximized window #483.
-* New setting `prevent-newwindow` to enforce opening links into same window
- even if they are crafted by `target="_blank"` or using `window.open(...)` #544.
-### Changed
-* Increased min required webkit version to 2.20.x.
-* Use man page date instead of build date ot make reproducible builds.
-* URLs shown on statusbar and title are now shown as punicode if they contain
- homographs.
-### Fixed
-* Fix out-of-bounds buffer access in parse_command (Thanks to Sören Tempel) #529.
-* Fixed none shown hint labels by Content-Security-Policy headers #531.
-* Fixed segfault on JavaScript `window.close()` call #537.
-* Fixed no char inserted in input mode after timeout and imap/inoremap
- candidate #546.
-
-## [3.3.0] - 2018-11-06
-
-### Added
-* Allow to change following webkit settings during runtime
- * allow-file-access-from-file-urls
- * allow-universal-access-from-file-urls
-* Added `#define CHECK_WEBEXTENSION_ON_STARTUP 1` to config.def.h to enable
- checks during runtime if the webextension file could be found. Hope that
- this helps user to fix compile/installation issues easier.
-* Re-Added support for page marks to jump around within long single pages by
- using names marks.
- Set a marks by `m{a-z}` in normal mode. Jump to marks by `'{a-z}`.
-* Re-Added `gf` to show page source (Thanks to Leonardo Taccari) #361.
- Webkit2 does not allow to show the page in the source view mode so the `gf`
- writes the HTML to a temporary files and opens it in the editor configured
- by `:set editor-command=...`
-### Changed
-* New created files in `$XDG_CONFIG_HOME/vimb` are generated with `0600`
- permission to prevent cookies be observed on multi users systems. Existing
- files are not affected by this change. It's a good advice to change the
- permission of all the files in `$XDG_CONFIG_HOME/vimb` to `0600` by
- hand.
-### Fixed
-* Fixed missing dependency in Makefile which possibly caused broken builds
- (Thanks to Patrick Steinhardt).
-* Fixed weird scroll position values shown in scroll indicator on some pages #501.
-* Fixed wrong hint label position on xkcd.com #506.
-* Fixed wrong hint label position in case of hints within iframes.
-
-## [3.2.0] - 2018-06-16
-
-### Added
-* Allow basic motion commands for hinting too.
-* Show the numbers of search matches in status bar.
-* Show dialog if the page makes a permission request e.g. geolocation to allow
- the user to make a decision.
-* new Setting `show-titlebar` to toggle window decorations.
-
-### Changed
-* Use sqlite as cookie storage #470 to prevent cookies lost on running many
- vimb instances.
-* Start vimb with maximized window #483.
-* Hints are now styled based on the vimbhint attributes. The old additional set
- classes are not set anymore to the hints. So customized css for the hints have
- to be adapted to this.
-* Element ID is stored in case the editor was spawned. So it's now possible to
- start the editor, load another page, come back and paste the editor contents
- (thanks to Sven Speckmaier).
-
-### Fixed
-* Fixed none cleaned webextension object files on `make clean`.
-* Remove none used gui styling for completion.
-
-### Removed
-* Removed webkit1 combat code.
-
-## [3.1.0] - 2017-12-18
-
-### Added
-
-* Added completion of bookmarked URIs for `:bmr` to allow to easily remove
- bookmarks without loading the page first.
-* Refresh hints after scrolling the page or resizing the window which makes
- extended hint mode more comfortable.
-* Reintroduce the automatic commands from vimb2. An automatic command is
- executed automatically in response to some event, such as a URI being opened.
-
-### Changed
-
-* Number of webprocesses in no longer limited to one.
-* Treat hint label generation depending on the first hint-key char.
- If first char is '0' generate numeric style labels else the labels start with
- the first char (thanks to Yoann Blein).
- * `hint-keys=0123` -> `1 2 3 10 11 12 13`
- * `hint-keys=asdf` -> `a s d f aa as ad af`
-* Show versions of used libs on `vimb --bug-info` and the extension directory
- for easier issue investigation.
-* During hinting JavaScript is enabled and reset to it's previous setting after
- hinting is done might be security relevant.
-* Allow extended hints mode also for open `g;o` to allow the user to toggle
- checkboxes and radiobuttons of forms.
-* Rename `hint-number-same-length` into `hint-keys-same-length` for consistency.
-* Search is restarted on pressing `n` or `N` with previous search query if no
- one was given (thanks to Yoann Blein).
-
-### Fixed
-
-* Deduced min required webkit version 2.16.x -> 2.8.x to compile vimb also on
- older systems.
-* Fixed undeleted desktop file on `make uninstall`.
-* Fixed window not redrawn properly in case vimb was run within tabbed.
-* Fixed cursor appearing in empty inputbox on searching in case a normal mode
- command was used that switches vimb into command mode like 'T' or ':'.
-* Fixed hint labels never started by the first char of the 'hint-keys'.
-* Fixed items where added to history even when `history-max-items` is set to 0
- (thanks to Patrick Steinhardt).
-* Fixed hinting caused dbus timeout on attempt to open URI with location hash.
-* Fixed wrong scroll position shown in the right of the statusbar on some pages.
-* Fixed vimb keeping in normal mode when HTTP Authentication dialog is shown.
-* Fixed password show in title bar and beeing written to hisotry in case the
- pssword was given by URI like https://user:password@host.tdl.
-
-## [3.0-alpha] - 2017-05-27
-
-### Changed
-
-* completely rebuild of vimb on webkit2 api.
-* Syntax for the font related gui settings has be changed.
- Fonts have to be given as `[ font-style | font-variant | font-weight | font-stretch ]? font-size font-family`
- Example `set input-font-normal=bold 10pt "DejaVu Sans Mono"` instead of
- previous `set input-fg-normal=DejaVu Sans Mono Bold 10`
-* Renames some settings to consequently use dashed setting names. Following
- settings where changed.
- ```
- previous setting - new setting name
- --------------------------------------
- cursivfont - cursiv-font
- defaultfont - default-font
- fontsize - font-size
- hintkeys - hint-keys
- minimumfontsize - minimum-font-size
- monofont - monospace-font
- monofontsize - monospace-font-size
- offlinecache - offline-cache
- useragent - user-agent
- sansfont - sans-serif-font
- scrollstep - scroll-step
- seriffont - serif-font
- statusbar - status-bar
- userscripts - user-scripts
- xssauditor - xss-auditor
- ```
-
-### Removed
-
-* There where many features removed during the webkit2 migration. That will
- hopefully be added again soon.
- * auto-response-headers
- * autocommands and augroups
- * external downloader
- * HSTS
- * kiosk mode
- * multiple ex commands on startup via `--cmd, -C`
- * page marks
- * prevnext
- * showing page source via `gF` this viewtype is not supported by webkit
- anymore.
- * socket support
-
----
-
-## [2.12] - 2017-04-11
-
-### Added
-
-* Queueing of key events - fixes swallowed chars in case of some imap bindings
- #258 (thanks to Michael Mackus)
-* Allow to disable xembed by `FEATURE_NO_XEMBED` to compile on wayland only
- platforms (thanks to Patrick Steinhardt)
-* Custom default_zoom setting disables HIGH_DPI logic (thanks to Robert Timm)
-* Allow link activation from search result via `<CR>` #131
-
-### Changed
-
-* Allow shortcuts without parameters #329
-* Write soup cache to disk after each page load to allow other instances to
- pick this up.
-* Use the beginning position of links for hinting (thanks to Yutao Yuan)
-
-### Fixed
-
-* Fix path expansion to accept only valid POSIX.1-2008 usernames (thanks to
- Manzur Mukhitdinov)
-* Fix default previouspattern (thanks to Nicolas Porcel)
-
-## [2.11] - 2015-12-17
-
-### Added
-
-* Added hint-number-same-length option
-* VERBOSE flag to Makefile to toggle verbose make on
-* `<Esc>` removes selections in normal mode
-* Support for multiple configuration profiles. New parameter `-p` or
- `--profile`
-* Adds support for contenteditable attribute as input mode trigger
- [#237](https://github.com/fanglingsu/vimb/issues/237)
-* Added `^` as normal mode alias of `0`
- [#236](https://github.com/fanglingsu/vimb/issues/236)
-* Added :source command to source a config file
-* Added path completion for :save command too
-* Added closed-max-items option to allow to store more than one closed page
-
-### Changed
-
-* Set only required CFLAGS
-* Replaced `-Wpedantic` with `-pedantic` CFLAGS for older gcc versions
-* Check for focused editable element as soon as possible
-* Do not blur the focused element after alt-tabbing
-* Show typed text as last completion entry to easily change it
- [#253](https://github.com/fanglingsu/vimb/issues/253)
-
-### Fixed
-
-* Fixed [#224](https://github.com/fanglingsu/vimb/issues/224): Wrong URL and
- titles shown in case one or more pages could not be loaded.
-* Fixed Makefile install target using -D
-* Fixed [#232](https://github.com/fanglingsu/vimb/issues/232): Fixed misplaced
- hint labels on some sites
-* Fixed [#235](https://github.com/fanglingsu/vimb/issues/235): Randomly reset
- cookie file
-* Fixed none POSIX `echo -n` call
-
-[Unreleased]: https://github.com/fanglingsu/vimb/compare/3.6.0...master
-[3.6.0]: https://github.com/fanglingsu/vimb/compare/3.5.0...3.6.0
-[3.5.0]: https://github.com/fanglingsu/vimb/compare/3.4.0...3.5.0
-[3.4.0]: https://github.com/fanglingsu/vimb/compare/3.3.0...3.4.0
-[3.3.0]: https://github.com/fanglingsu/vimb/compare/3.2.0...3.3.0
-[3.2.0]: https://github.com/fanglingsu/vimb/compare/3.1.0...3.2.0
-[3.1.0]: https://github.com/fanglingsu/vimb/compare/3.0-alpha...3.1.0
-[3.0-alpha]: https://github.com/fanglingsu/vimb/compare/2.12...3.0-alpha
-[2.12]: https://github.com/fanglingsu/vimb/compare/2.11...2.12
-[2.11]: https://github.com/fanglingsu/vimb/compare/2.10...2.11
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index 39a938a..0000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,107 +0,0 @@
-# Contribute
-
-This document contains guidelines for contributing to vimb, as well as useful
-hints when doing so.
-
-## Goals
-
-Getting a light, fast and keyboard-driven browser that is easy to use for
-those users familiar with vim.
-
-- Provide powerful knobs allowing the user to tweak vimb to fit the own needs
- and usecases.
-- Add only knobs/features that do not do what other knobs do. In this point
- vimb is in contrast to vim.
-- If there are two colliding features we should pick the mightier one, or that
- which need less code or resources.
-
-## Find something to work on
-
-If you are interested to contribute to vimb it's a good idea to check if
-someone else is already working on. I would be a shame when you work was for
-nothing.
-
-If you have some ideas how to improve vimb by new features or to simplify it.
-Write an issue so that other contributors can comment/vote on it or help you
-with it.
-
-If you do not want to write code you are pretty welcome to update
-[documentation][issue-doc] or to argue and vote for features and [request for
-comments][issue-rfc].
-
-## Communication
-
-If you want to discuss some feature or provide some suggestion that can't be
-done very well with the github issues. You should use the [mailing list][mail]
-for this purpose. Else it's a good decision to use the features provided by
-github for that.
-
-## Patching and Coding style
-
-### File Layout
-
-- Comment with LICENSE and possibly short explanation of file/tool
-- Headers
-- Macros
-- Types
-- Function declarations
- - Include variable names
- - For short files these can be left out
- - Group/order in logical manner
-- Global variables
-- Function definitions in same order as declarations
-- main
-
-### C Features
-
-- Do not mix declarations and code
-- Do not use for loop initial declarations
-- Use `/* */` for comments, not `//`
-
-### Headers
-
-- Place system/libc headers first in alphabetical order
- - If headers must be included in a specific order comment to explain
-- Place local headers after an empty line
-
-### Variables
-
-- Global variables not used outside translation unit should be declared static
-- In declaration of pointers the `*` is adjacent to variable name, not type
-
-### Indentation
-
-- the code is indented by 4 spaces - if you use vim to code you can set
- `:set expandtab ts=4 sts=4 sw=4`
-- it's a good advice to orientate on the already available code
-- if you are using `indent`, following options describe best the code style
- - `--k-and-r-style`
- - `--case-indentation4`
- - `--dont-break-function-decl-args`
- - `--dont-break-procedure-type`
- - `--dont-line-up-parentheses`
- - `--no-tabs`
-
-## directories
-
- ├── doc documentation like manual page
- └── src all sources to build vimb
- ├── scripts JavaScripts and CSS that are compiled in for various purposes
- └── webextension Source files for the webextension
-
-## compile and run
-
-To inform vimb during compile time where the webextension should be loaded
-from, the `RUNPREFIX` option can be set to a full qualified path to the
-directory where the extension should be stored in.
-
-To run vimb without installation you could run as a sandbox like this
-
- make runsandbox
-
-This will compile and install vimb into the local _sandbox_ folder in the
-project directory.
-
-[mail]: https://lists.sourceforge.net/lists/listinfo/vimb-users "vimb - mailing list"
-[issue-doc]: https://github.com/fanglingsu/vimb/labels/component%3A%20docu
-[issue-rfc]: https://github.com/fanglingsu/vimb/labels/rfc
diff --git a/Makefile b/Makefile
index 35d8d3a..6ebb261 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ version.h: Makefile $(wildcard .git/index)
echo "#define VERSION \"$${v:-$(version)}\"" > $@
options:
- @echo "vimb build options:"
+ @echo "neovimb build options:"
@echo "LIBS = $(LIBS)"
@echo "CFLAGS = $(CFLAGS)"
@echo "LDFLAGS = $(LDFLAGS)"
@@ -19,7 +19,7 @@ options:
install: all
@# binary
install -d $(BINPREFIX)
- install -m 755 src/vimb $(BINPREFIX)/vimb
+ install -m 755 src/neovimb $(BINPREFIX)/neovimb
@# extension
install -d $(LIBDIR)
install -m 644 src/webextension/$(EXTTARGET) $(LIBDIR)/$(EXTTARGET)
@@ -27,31 +27,24 @@ install: all
install -d $(MANPREFIX)/man1
@sed -e "s!VERSION!$(version)!g" \
-e "s!PREFIX!$(PREFIX)!g" \
- -e "s!DATE!`date -u -r $(DOCDIR)/vimb.1 +'%m %Y' 2>/dev/null || date +'%m %Y'`!g" $(DOCDIR)/vimb.1 > $(MANPREFIX)/man1/vimb.1
+ -e "s!DATE!`date -u -r $(DOCDIR)/neovimb.1 +'%m %Y' 2>/dev/null || date +'%m %Y'`!g" $(DOCDIR)/neovimb.1 > $(MANPREFIX)/man1/neovimb.1
@# .desktop file
install -d $(DOTDESKTOPPREFIX)
- install -m 644 vimb.desktop $(DOTDESKTOPPREFIX)/vimb.desktop
+ install -m 644 neovimb.desktop $(DOTDESKTOPPREFIX)/neovimb.desktop
uninstall:
- $(RM) $(BINPREFIX)/vimb
- $(RM) $(DESTDIR)$(MANDIR)/man1/vimb.1
+ $(RM) $(BINPREFIX)/neovimb
+ $(RM) $(DESTDIR)$(MANDIR)/man1/neovimb.1
$(RM) $(LIBDIR)/$(EXTTARGET)
- $(RM) $(DOTDESKTOPPREFIX)/vimb.desktop
+ $(RM) $(DOTDESKTOPPREFIX)/neovimb.desktop
-clean: src.subdir-clean test-clean
+clean: src.subdir-clean
sandbox:
$(Q)$(MAKE) RUNPREFIX=$(CURDIR)/sandbox/usr PREFIX=/usr DESTDIR=./sandbox install
runsandbox: sandbox
- sandbox/usr/bin/vimb
-
-test: version.h
- $(MAKE) -C src vimb.so
- $(MAKE) -C tests
-
-test-clean:
- $(MAKE) -C tests clean
+ sandbox/usr/bin/neovimb
%.subdir-all:
$(Q)$(MAKE) -C $*
diff --git a/README.md b/README.md
index 21ace91..0acef17 100644
--- a/README.md
+++ b/README.md
@@ -1,39 +1,6 @@
-# Vimb - the Vim-like browser
+# neovimb
-[![Build Status](https://travis-ci.com/fanglingsu/vimb.svg?branch=master)](https://travis-ci.com/fanglingsu/vimb)
-[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
-[![Latest Release](https://img.shields.io/github/release/fanglingsu/vimb.svg?style=flat)](https://github.com/fanglingsu/vimb/releases/latest)
-
-Vimb is a Vim-like web browser that is inspired by Pentadactyl and Vimprobable.
-The goal of Vimb is to build a completely keyboard-driven, efficient and
-pleasurable browsing-experience with low memory and CPU usage that is
-intuitive to use for Vim users.
-
-More information and some screenshots of Vimb browser in action can be found on
-the project page of [Vimb][].
-
-## Features
-
-- it's modal like Vim
-- Vim like keybindings - assignable for each browser mode
-- nearly every configuration can be changed at runtime with Vim like set syntax
-- history for `ex` commands, search queries, URLs
-- completions for: commands, URLs, bookmarked URLs, variable names of settings, search-queries
-- hinting - marks links, form fields and other clickable elements to
- be clicked, opened or inspected
-- SSL validation against ca-certificate file
-- user defined URL-shortcuts with placeholders
-- read it later queue to collect URIs for later use
-- multiple yank/paste registers
-- Vim like autocmd - execute commands automatically after an event on specific URIs
-
-## Packages
-
-- Arch Linux: [community/vimb][], [aur/vimb-git][], [aur/vimb-gtk2][]
-- Gentoo: [gentoo-git][], [gentoo][]
-- openSUSE: [network/vimb][]
-- pkgsrc: [pkgsrc/www/vimb][], [pkgsrc/wip/vimb-git][]
-- Slackware: [slackbuild/vimb][]
+neovimb is a fork of [vimb](https://github.com/fanglingsu/vimb) but with a couple different tweaks like default settings oriented torwards privacy and a bit more config.h customizability.
## dependencies
@@ -43,8 +10,8 @@ the project page of [Vimb][].
## Install
-Edit `config.mk` to match your local setup. You might need to do this if
-you use another compiler, like tcc. Most people, however, will almost never
+Edit `config.mk` to match your local setup. You might need to do this if
+you use another compiler, like tcc. Most people, however, will almost never
need to do this on systems like Ubuntu or Debian.
Edit `src/config.h` to match your personal preferences, like changing the
@@ -56,47 +23,21 @@ Therefore, you should always compare your customised `config.h` with
`config.def.h` and make sure you include any changes to the latter in your
`config.h`.
-Run the following commands to compile and install Vimb (if necessary, the last one as
+Run the following commands to compile and install neovimb (if necessary, the last one as
root). If you want to change the `PREFIX`, note that it's required to give it on both stages, build and install.
make PREFIX=/usr
make PREFIX=/usr install
-To run vimb without installation for testing it out use the 'runsandbox' make
+To run neovimb without installation for testing it out use the 'runsandbox' make
target.
make runsandbox
-## Mailing list
-
-- feature requests, issues and patches can be discussed on the [mailing list][mail] ([list archive][mail-archive])
-
## Similar projects
-- [luakit](https://luakit.github.io/)
-- [qutebrowser](https://www.qutebrowser.org/)
-- [surf](https://surf.suckless.org/)
-- [uzbl](https://www.uzbl.org/)
+- [vimb](https://github.com/fanglingsu/vimb)
## license
Information about the license are found in the file LICENSE.
-
-## about
-
-- https://en.wikipedia.org/wiki/Vimb
-- http://thedarnedestthing.com/vimb
-- https://blog.jeaye.com/2015/08/23/vimb/
-
-[aur/vimb-git]: https://aur.archlinux.org/packages/vimb-git
-[aur/vimb-gtk2]: https://aur.archlinux.org/packages/vimb-gtk2/
-[community/vimb]: https://www.archlinux.org/packages/community/x86_64/vimb/
-[gentoo-git]: https://github.com/tharvik/overlay/tree/master/www-client/vimb
-[gentoo]: https://github.com/hsoft/portage-overlay/tree/master/www-client/vimb
-[mail-archive]: https://sourceforge.net/p/vimb/vimb/vimb-users/ "vimb - mailing list archive"
-[mail]: https://lists.sourceforge.net/lists/listinfo/vimb-users "vimb - mailing list"
-[network/vimb]: https://build.opensuse.org/package/show/network/vimb
-[pkgsrc/wip/vimb-git]: http://pkgsrc.se/wip/vimb-git
-[pkgsrc/www/vimb]: http://pkgsrc.se/www/vimb
-[slackbuild/vimb]: https://slackbuilds.org/repository/14.2/network/vimb/
-[vimb]: https://fanglingsu.github.io/vimb/ "Vimb - Vim like browser project page"
diff --git a/config.mk b/config.mk
index f5c6042..74dffc1 100644
--- a/config.mk
+++ b/config.mk
@@ -5,11 +5,11 @@ endif
PREFIX ?= /usr/local
BINPREFIX := $(DESTDIR)$(PREFIX)/bin
MANPREFIX := $(DESTDIR)$(PREFIX)/share/man
-EXAMPLEPREFIX := $(DESTDIR)$(PREFIX)/share/vimb/example
+EXAMPLEPREFIX := $(DESTDIR)$(PREFIX)/share/neovimb/example
DOTDESKTOPPREFIX := $(DESTDIR)$(PREFIX)/share/applications
-LIBDIR := $(DESTDIR)$(PREFIX)/lib/vimb
+LIBDIR := $(DESTDIR)$(PREFIX)/lib/neovimb
RUNPREFIX := $(PREFIX)
-EXTENSIONDIR := $(RUNPREFIX)/lib/vimb
+EXTENSIONDIR := $(RUNPREFIX)/lib/neovimb
OS := $(shell uname -s)
# define some directories
@@ -22,7 +22,7 @@ LIBS = gtk+-3.0 'webkit2gtk-4.0 >= 2.20.0'
# setup general used CFLAGS
CFLAGS += -std=c99 -pipe -Wall -fPIC
CPPFLAGS += -DEXTENSIONDIR=\"${EXTENSIONDIR}\"
-CPPFLAGS += -DPROJECT=\"vimb\" -DPROJECT_UCFIRST=\"Vimb\"
+CPPFLAGS += -DPROJECT=\"neovimb\" -DPROJECT_UCFIRST=\"neovimb\"
CPPFLAGS += -DGSEAL_ENABLE
CPPFLAGS += -DGTK_DISABLE_SINGLE_INCLUDES
CPPFLAGS += -DGDK_DISABLE_DEPRECATED
diff --git a/doc/vimb.1 b/doc/neovimb.1
index e2c6a40..f62f102 100644
--- a/doc/vimb.1
+++ b/doc/neovimb.1
@@ -1,27 +1,26 @@
.\" vim: ft=groff
-.TH VIMB 1 "DATE" "vimb/VERSION" "Vimb Manual"
+.TH neovimb 1 "DATE" "neovimb/VERSION" "neovimb Manual"
.SH NAME
-Vimb - Vim Browser - A modal web browser based on WebKit, inspired by Vim: the
-great editor.
+neovimb - Vim Browser - A modal web browser based on WebKit, inspired by vimb.
.
.
.SH SYNOPSIS
-.B vimb
+.B neovimb
.OP OPTIONS
.RI [ URI "|" file "|" - ]
.
.
.SH DESCRIPTION
-Vimb is a WebKit based web browser that behaves like the Vimperator
+neovimb is a WebKit based web browser that behaves like the Vimperator
plugin for Firefox and has usage paradigms from the great editor, Vim.
-The goal of Vimb is to build a completely keyboard-driven, efficient
+The goal of neovimb is to build a completely keyboard-driven, efficient
and pleasurable browsing-experience.
.
.
.SH OPTIONS
-If no \fIURI\fP or \fIfile\fP is given, Vimb will open the configured
+If no \fIURI\fP or \fIfile\fP is given, neovimb will open the configured
home-page.
-If \fIURI\fP is '-', Vimb reads the HTML to display from stdin.
+If \fIURI\fP is '-', neovimb reads the HTML to display from stdin.
.P
Mandatory arguments to long options are mandatory for short options too.
.TP
@@ -33,7 +32,7 @@ You could also pass several ex commands in one \fICMD\fP,
if they are separated by "|".
.sp
.EX
-vimb --cmd "set dark-mode=on|set header=Referer,DNT=1"
+neovimb --cmd "set dark-mode=on|set header=Referer,DNT=1"
.EE
.TP
.BI "\-c, \-\-config " "FILE"
@@ -42,7 +41,7 @@ This will also be applied on new spawned instances.
.TP
.BI "\-e, \-\-embed " "WINID"
.I WINID
-of an XEmbed-aware application, that Vimb will use as its parent.
+of an XEmbed-aware application, that neovimb will use as its parent.
.TP
.B "\-i, \-\-incognito"
Start an instance with user data read-only (see \fIFILES\fP section).
@@ -66,7 +65,7 @@ Prints information about used libraries for bug reports and then quit.
.
.
.SH MODES
-Vimb is modal and has the following main modes:
+neovimb is modal and has the following main modes:
.IP "Normal Mode"
The default mode.
Pressing Escape always enter normal mode.
@@ -76,9 +75,9 @@ Used for editing text elements in a webpage.
Execute `ex` commands from the builtin inputbox (commandline).
.IP "Pass-Through Mode"
In Pass-Through mode only the `<Esc>` and `<C-[>` keybindings are interpreted
-by Vimb, all other keystrokes are given to the webview to handle them.
+by neovimb, all other keystrokes are given to the webview to handle them.
This allows the use of a website's configured keybindings, that might otherwise
-be swallowed by Vimb.
+be swallowed by neovimb.
.
.
.SH NORMAL MODE COMMANDS
@@ -100,7 +99,7 @@ Set cursor to the last focused element in the page and switch to Input Mode.
If no element was focused before the first element is focused like with `gi'.
.TP
.B CTRL\-Z
-Switch Vimb into Pass-Through Mode.
+Switch neovimb into Pass-Through Mode.
.TP
.B gf
Open the configured editor (`editor-command') with the current page's content.
@@ -233,7 +232,7 @@ Jumps to the position before the latest jump, or where the last "m'" command
was given.
.
.SS Hinting
-Hinting in Vimb is how you accomplish the tasks that you would do with the
+Hinting in neovimb is how you accomplish the tasks that you would do with the
mouse in common mouse-driven browsers: open a URI, yank a URI, save a page and
so on. When hinting is started, the relevant elements on the page will
be marked by labels generated from configured `hint-keys'.
@@ -319,16 +318,16 @@ Kill (remove) hinted element from the page.
.B ;p
Push the hint's URI to the end of the Read It Later queue like the `:qpush'
command.
-This is only available if Vimb was compiled with the QUEUE feature.
+This is only available if neovimb was compiled with the QUEUE feature.
.TP
.B ;P
Push the hint's URI to the beginning of the Read It Later queue like the
`:qunshift' command.
-This is only available if Vimb was compiled with the QUEUE feature.
+This is only available if neovimb was compiled with the QUEUE feature.
.TP
.B ;x
Hints like ;o, but instead of opening the hinted URI, the
-`x-hint-command' is run in Vimb.
+`x-hint-command' is run in neovimb.
.TP
.BI [ \(dqx ];y
Yank hint's destination location into primary and secondary clipboard and into
@@ -432,7 +431,7 @@ Yank the current selection into register x and clipboard.
.
.SH COMMAND MODE
Commands that are listed below are ex-commands like in Vim, that are typed
-into the inputbox (the command line of vimb).
+into the inputbox (the command line of neovimb).
The commands may vary in their syntax or in the parts they allow,
but in general they follow a simple syntax.
.P
@@ -444,8 +443,6 @@ command.
At the moment the count parts [N] of commands is parsed, but currently there is
no command that uses the count.
.sp
-Commands that are typed interactivly are normally recorded into command
-history and register.
To avoid this, the commands can be prefixed by one or more additional `:' or
whitespace.
.P
@@ -554,7 +551,7 @@ Normal mode: when browsing normally.
Insert mode: when interacting with text fields on a website.
.TP
.B c
-Command Line mode: when typing into Vimb's command line.
+Command Line mode: when typing into neovimb's command line.
.PD
.P
Most keys in key sequences are represented simply by the character that you
@@ -665,7 +662,7 @@ to setup a search engine.
Can be called by `:open dl my search phrase'.
.IP ":shortcut-add gh=https://github.com/$0/$1"
to build URIs from given parameters.
-Can be called `:open gh fanglingsu vimb'.
+Can be called `:open gh fanglingsu neovimb'.
.IP ":shortcut-add map=https://maps.google.com/maps?saddr=$0&daddr=$1"
to search for a route, all but the last parameter must be quoted if they
contain spaces like `:open map "city hall, London" railway station, London'
@@ -717,7 +714,7 @@ Toggle the value of boolean variable \fIvar\fP and display the new set value.
.
.SS Queue
The queue allows the marking of URIs for later reading.
-This list is shared between the single instances of Vimb.
+This list is shared between the single instances of neovimb.
.TP
.BI ":qpu[sh] [" URI ]
Push \fIURI\fP or, if not given, the current URI to the end of the queue.
@@ -741,8 +738,8 @@ Use them with care and they will help you avoid typing many commands.
Autocommands are built with following properties.
.TP
.I group
-When the [\fIgroup\fP] argument is not given, Vimb uses the current group as
-defined with ':augroup', otherwise, Vimb uses the group defined with
+When the [\fIgroup\fP] argument is not given, neovimb uses the current group as
+defined with ':augroup', otherwise, neovimb uses the group defined with
[\fIgroup\fP].
Groups are useful to remove multiple grouped autocommands.
.TP
@@ -775,10 +772,10 @@ Fires when everything that was required to display on the page has been loaded.
Fired right after a download is started.
.TP
.B DownloadFinished
-Fired if a Vimb managed download is finished.
+Fired if a neovimb managed download is finished.
.TP
.B DownloadFailed
-Fired if a Vimb managed download failed.
+Fired if a neovimb managed download failed.
.PD
.RE
.TP
@@ -806,14 +803,14 @@ pattern list.
.RE
.TP
.I cmd
-Any `ex` command vimb understands.
+Any `ex` command neovimb understands.
The leading ':' is not required.
Multiple commands can be separated by '|'.
.TP
.BI ":au[tocmd] [" group "] {" event "} {" pat "} {" cmd "}"
-Add \fIcmd\fP to the list of commands that Vimb will execute automatically on
+Add \fIcmd\fP to the list of commands that neovimb will execute automatically on
\fIevent\fP for a URI matching \fIpat\fP autocmd-patterns.
-Vimb always adds the \fIcmd\fP after existing autocommands, so that the
+neovimb always adds the \fIcmd\fP after existing autocommands, so that the
autocommands are executed in the order in which they were given.
.TP
.BI ":au[tocmd]! [" group "] {" event "} {" pat "} {" cmd "}"
@@ -821,7 +818,7 @@ Remove all autocommands associated with \fIevent\fP and which pattern match
\fIpat\fP, and add the command \fIcmd\fP.
Note that the pattern is not matches literally to find autocommands
to remove, like Vim does.
-Vimb matches the autocommand pattern with \fIpat\fP.
+neovimb matches the autocommand pattern with \fIpat\fP.
If [\fIgroup\fP] is not given, deletes autocommands in current group,
as noted above.
.TP
@@ -862,7 +859,7 @@ Asynchronously clears the website data of the given list of \fIdataTypes\fP
modified in the past \fItimespan\fP.
Note that the \fIdataTypes\fP must not contain spaces.
If \fItimespan\fP is not given, all website data will be removed.
-Note that this effects all running instances of vimb.
+Note that this effects all running instances of neovimb.
.RS
.P
.PD 0
@@ -944,7 +941,7 @@ Like :sh[ellcmd] but asynchronous.
.sp
Example:
.EX
-:sh! /bin/sh -c 'echo "`date` $VIMB_URI" >> myhistory.txt'
+:sh! /bin/sh -c 'echo "`date` $neovimb_URI" >> myhistory.txt'
.EE
.TP
.TP
@@ -959,24 +956,24 @@ A '\e' before these patterns disables the expansion.
.PD 0
The following environment variables are set for called shell commands.
.TP
-.B VIMB_URI
-This variable is set by Vimb everytime a new page is opened to the URI of the
+.B neovimb_URI
+This variable is set by neovimb everytime a new page is opened to the URI of the
page.
.TP
-.B VIMB_SELECTION
+.B neovimb_SELECTION
This variable is set to the current selected text on the page.
.TP
-.B VIMB_TITLE
+.B neovimb_TITLE
Contains the title of the current opened page.
.TP
-.B VIMB_PID
-Contains the pid of the running Vimb instance.
+.B neovimb_PID
+Contains the pid of the running neovimb instance.
.TP
-.B VIMB_WIN_ID
-Holds the X-Window id of the Vimb window.
+.B neovimb_WIN_ID
+Holds the X-Window id of the neovimb window.
.TP
-.B VIMB_XID
-Holds the X-Window id of the Vimb window or of the embedding window if Vimb is
+.B neovimb_XID
+Holds the X-Window id of the neovimb window or of the embedding window if neovimb is
compiled with XEMBED and started with the -e option.
.EE
.RE
@@ -986,7 +983,7 @@ Like :sh[ellcmd] but asynchronous.
.sp
Example:
.EX
-:sh! /bin/sh -c 'echo "`date` $VIMB_URI" >> myhistory.txt'
+:sh! /bin/sh -c 'echo "`date` $neovimb_URI" >> myhistory.txt'
.EE
.TP
.BI ":s[ave] [" path "]"
@@ -1014,7 +1011,7 @@ Registers:
.TP
.BR \(dqa " \(em " \(dqz
26 named registers "a to "z.
-Vimb fills these registers only when you say so.
+neovimb fills these registers only when you say so.
.TP
.B \(dq:
Last executed `ex` command.
@@ -1096,18 +1093,12 @@ The setting name completion is started if at least `:set ` is shown in
inputbox and does also match settings that begins with already typed setting
prefix.
.TP
-.B history
-The history of URIs is shown for the `:open ` and `:tabopen ` commands.
-This completion looks up every given word in the history URI and titles.
-Only those history items are shown, where the title or URI contains all tags.
.RS
.IP ":open foo bar<Tab>"
will complete only URIs that contain the words foo and bar.
.RE
.TP
.B bookmarks
-The bookmark completion is similar to the history completion, but does match
-only the tags of the bookmarks.
The bookmark completion is started by `:open \fB!\fP`, `:tabopen \fB!\fP` or
`:bmr ` and does a prefix search for all given words in the bookmark tags.
.RS
@@ -1190,7 +1181,7 @@ font.
Default Full-Content zoom level in percent. Default is 100.
.TP
.B dns-prefetching (bool)
-Indicates if Vimb prefetches domain names.
+Indicates if neovimb prefetches domain names.
.TP
.B download-command (string)
A command with placeholder '%s' that will be invoked to download a URI in
@@ -1200,17 +1191,17 @@ case 'download-use-external' is enabled.
The following additional environment variable are available:
.PD 0
.TP
-.B $VIMB_URI
+.B $neovimb_URI
The URI of the current opened page, normally the page where the download was
started from, also known as referer.
.TP
-.B $VIMB_DOWNLOAD_PATH
+.B $neovimb_DOWNLOAD_PATH
Setting value of 'download-path' which would be used normally for downloads.
.PD
.P
.PD 0
-.IP ":set download-command=/bin/sh -c ""cd '$VIMB_DOWNLOAD_PATH' \
-&& curl -sLJOC - -e '$VIMB_URI' %s"""
+.IP ":set download-command=/bin/sh -c ""cd '$neovimb_DOWNLOAD_PATH' \
+&& curl -sLJOC - -e '$neovimb_URI' %s"""
.PD
.RE
.TP
@@ -1224,7 +1215,7 @@ started '~/', '~user', '$VAR' and '${VAR}'.
.B download-use-external (bool)
Indicates if the external download tool set as 'download-command' should be
used to handle downloads.
-If this is disabled Vimb will handle the download.
+If this is disabled neovimb will handle the download.
.TP
.B editor-command (string)
Command with placeholder '%s' called if form field is opened with $EDITOR to
@@ -1291,7 +1282,7 @@ Header completely from request.
.RE
.TP
.B hint-follow-last (bool)
-If on, vimb automatically follows the last remaining hint on the page.
+If on, neovimb automatically follows the last remaining hint on the page.
If off hints are fired only if enter is pressed.
.TP
.B hint-keys-same-length (bool)
@@ -1315,13 +1306,13 @@ the rules of numeric labeling. So that the ifrst char of the label will never
start with the '0'.
.IP
Note that the hint matching by label built of hint-keys is case sensitive.
-In this vimb differs from some other browsers that show hint labels in upper
+In this neovimb differs from some other browsers that show hint labels in upper
case, but match them lowercase.
.IP
To have upper case hint labels, it's possible to add following css to the
-`style.css' file in vimb's configuration directory.
+`style.css' file in neovimb's configuration directory.
.IP
-"span[vimbhint="label"] {text-transform: uppercase !important;}"
+"span[neovimbhint="label"] {text-transform: uppercase !important;}"
.TP
.B hint-match-element (bool)
If this is set to 'true' typed chars that are not part of the set 'hint-keys'
@@ -1329,13 +1320,8 @@ are used to filter hinted DOM elements by their text value.
If 'hint-keys' are set to chars instead of numbers it might be useful to
disable matching of the elements by 'hint-match-element=false'.
.TP
-.B history-max-items (int)
-Maximum number of unique items stored in search-, command or URI history.
-If history-max-items is set to 0, the history file will not be changed.
-This setting has no effect if option \-\-incognito is set.
-.TP
.B home-page (string)
-Homepage that vimb opens if started without a URI.
+Homepage that neovimb opens if started without a URI.
.TP
.B html5-database (bool)
Whether to enable HTML5 client-side SQL database support.
@@ -1431,7 +1417,7 @@ The font family used as the default for content using sans-serif font.
Determines whether or not JavaScript executes within a page.
.TP
.B scroll-step (int)
-Number of pixel vimb scrolls if 'j' or 'k' is used.
+Number of pixel neovimb scrolls if 'j' or 'k' is used.
.TP
.B scroll-multiplier (int)
Multiplier to increase the scroll distance if window is scrolled by mouse
@@ -1485,7 +1471,7 @@ CSS style applied to the status bar on https pages with trusted certificate.
CSS style applied to the status bar on https pages with untrusted certificate.
.TP
.B strict-ssl (bool)
-If 'on', vimb will not load a untrusted https site.
+If 'on', neovimb will not load a untrusted https site.
.TP
.B stylesheet (bool)
If 'on' the user defined styles-sheet is used.
@@ -1522,8 +1508,8 @@ enabled.
.TP
.B x-hint-command (string)
Command used if hint mode ;x is fired.
-The command can be any vimb command string.
-Note that the command is run through the mapping mechanism of vimb so
+The command can be any neovimb command string.
+Note that the command is run through the mapping mechanism of neovimb so
it might change the behaviour by adding or changing mappings.
.RS
.P
@@ -1548,7 +1534,7 @@ Disabling can help with some older systems (ppc, ppc64, etc.) that don't have co
.
.SH FILES
.TP
-.IR $XDG_CONFIG_HOME/vimb[/PROFILE]
+.IR $XDG_CONFIG_HOME/neovimb[/PROFILE]
Directory for configuration data.
If executed with \fB-p \fIPROFILE\fR parameter, configuration is read from
this subdirectory.
@@ -1569,7 +1555,7 @@ These file is used if the config variable `stylesheet' is enabled.
.RE
.
.TP
-.IR $XDG_DATA_HOME/vimb[/PROFILE]
+.IR $XDG_DATA_HOME/neovimb[/PROFILE]
Directory for runtime data.
If executed with \fB-p \fIPROFILE\fR parameter, data files are written from
this subdirectory.
@@ -1584,15 +1570,11 @@ This file will not be touched if option \-\-incognito is set.
Holds the URIs of last closed browser windows.
This file will not be touched if option \-\-incognito is set.
.TP
-.I history
-This file holds the history of unique opened URIs.
-This file will not be touched if option \-\-incognito is set.
.TP
.I bookmark
This file holds the list of bookmarked URIs with tags.
.TP
.I command
-This file holds the history of commands and search queries performed via input
box.
This file will not be touched if option \-\-incognito is set.
.TP
@@ -1600,7 +1582,6 @@ This file will not be touched if option \-\-incognito is set.
Holds the read it later queue filled by `qpush'.
.TP
.I search
-This file holds the history of search queries.
This file will not be touched if option \-\-incognito is set.
.PD
.RE
@@ -1614,9 +1595,9 @@ HTTP_PROXY=localhost:8118.
.
.
.SH "REPORTING BUGS"
-Report bugs to the main project page on https://github.com/fanglingsu/vimb/issues
+Report bugs to the main project page on https://github.com/fanglingsu/neovimb/issues
.br
-or on the mailing list https://lists.sourceforge.net/lists/listinfo/vimb-users.
+or on the mailing list https://lists.sourceforge.net/lists/listinfo/neovimb-users.
.
.
.SH AUTHOR
diff --git a/vimb.desktop b/neovimb.desktop
index 37fa6e9..16b1201 100644
--- a/vimb.desktop
+++ b/neovimb.desktop
@@ -1,9 +1,9 @@
# Based on Arch Linux' chromium.desktop
[Desktop Entry]
-Name=vimb
+Name=neovimb
GenericName=Web Browser
Comment=Access the Internet
-Exec=vimb %U
+Exec=neovimb %U
Terminal=false
Icon=
Type=Application
diff --git a/src/.gitignore b/src/.gitignore
index ca46d8a..909803c 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -1,2 +1,2 @@
config.h
-vimb
+neovimb
diff --git a/src/Makefile b/src/Makefile
index 3674315..382a38a 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -4,17 +4,17 @@ OBJ = $(patsubst %.c, %.o, $(wildcard *.c))
JSFILES = $(wildcard scripts/*.js)
CSSFILES = $(wildcard scripts/*.css)
-all: vimb webextension.subdir-all
+all: neovimb webextension.subdir-all
clean: webextension.subdir-clean
- $(RM) vimb vimb.so $(OBJ)
+ $(RM) neovimb neovimb.so $(OBJ)
$(RM) scripts/scripts.h
-vimb: $(OBJ)
+neovimb: $(OBJ)
@echo "${CC} $@"
$(Q)$(CC) $(OBJ) $(LDFLAGS) -o $@
-vimb.so: $(OBJ)
+neovimb.so: $(OBJ)
$(Q)$(CC) -shared $(OBJ) $(LDFLAGS) -o $@
$(OBJ): config.h ../config.mk
diff --git a/src/bookmark.c b/src/bookmark.c
index 2a0a3cf..ec8d1de 100644
--- a/src/bookmark.c
+++ b/src/bookmark.c
@@ -31,7 +31,7 @@ typedef struct {
char *tags;
} Bookmark;
-extern struct Vimb vb;
+extern struct neovimb vb;
static GList *load(const char *file);
static gboolean bookmark_contains_all_tags(Bookmark *bm, char **query,
diff --git a/src/completion.c b/src/completion.c
index 3b27b6c..f521da9 100644
--- a/src/completion.c
+++ b/src/completion.c
@@ -30,7 +30,7 @@ typedef struct {
static gboolean tree_selection_func(GtkTreeSelection *selection,
GtkTreeModel *model, GtkTreePath *path, gboolean selected, gpointer data);
-extern struct Vimb vb;
+extern struct neovimb vb;
/**
diff --git a/src/config.def.h b/src/config.def.h
index dbfc01c..e4d27af 100644
--- a/src/config.def.h
+++ b/src/config.def.h
@@ -56,7 +56,7 @@
/* cookie-accept allowed values always, origin, never */
#define SETTING_COOKIE_ACCEPT "always"
#define SETTING_HINT_KEYS "0123456789"
-#define SETTING_DOWNLOAD_COMMAND "/bin/sh -c \"curl -sLJOC - -e '$VIMB_URI' %s\""
+#define SETTING_DOWNLOAD_COMMAND "/bin/sh -c \"curl -sLJOC - -e '$neovimb_URI' %s\""
#define SETTING_COMPLETION_CSS "color:#fff;background-color:#656565;font:" SETTING_GUI_FONT_NORMAL
#define SETTING_COMPLETION_HOVER_CSS "background-color:#777;"
#define SETTING_COMPLETION_SELECTED_CSS "color:#f6f3e8;background-color:#888;"
@@ -71,7 +71,7 @@
#define WIN_WIDTH 800
#define WIN_HEIGHT 600
-/* if set to 1 vimb will check if the webextension could be found. */
+/* if set to 1 neovimb will check if the webextension could be found. */
#define CHECK_WEBEXTENSION_ON_STARTUP 1
/* Auto Hide Input Bar */
diff --git a/src/ex.c b/src/ex.c
index 1ce7be8..191c90b 100644
--- a/src/ex.c
+++ b/src/ex.c
@@ -215,10 +215,10 @@ static struct {
char *token; /* initial filter content */
} excomp;
-extern struct Vimb vb;
+extern struct neovimb vb;
/**
- * Function called when vimb enters the command mode.
+ * Function called when neovimb enters the command mode.
*/
void ex_enter(Client *c)
{
@@ -1084,13 +1084,13 @@ static VbCmdResult ex_shellcmd(Client *c, const ExArg *arg)
return CMD_ERROR;
}
- /* Get current selection and write it as VIMB_SELECTION into env. */
+ /* Get current selection and write it as neovimb_SELECTION into env. */
selection = ext_proxy_get_current_selection(c);
if (selection) {
- g_setenv("VIMB_SELECTION", selection, TRUE);
+ g_setenv("neovimb_SELECTION", selection, TRUE);
g_free(selection);
} else {
- g_setenv("VIMB_SELECTION", "", TRUE);
+ g_setenv("neovimb_SELECTION", "", TRUE);
}
if (arg->bang) {
diff --git a/src/ext-proxy.c b/src/ext-proxy.c
index 84ab325..612f6e8 100644
--- a/src/ext-proxy.c
+++ b/src/ext-proxy.c
@@ -46,9 +46,9 @@ static void on_web_extension_page_created(GDBusConnection *connection,
GVariant *parameters, gpointer data);
/* TODO we need potentially multiple proxies. Because a single instance of
- * vimb may hold multiple clients which may use more than one webprocess and
+ * neovimb may hold multiple clients which may use more than one webprocess and
* therefore multiple webextension instances. */
-extern struct Vimb vb;
+extern struct neovimb vb;
static GDBusServer *dbusserver;
diff --git a/src/handler.c b/src/handler.c
index c41e869..a5e79e0 100644
--- a/src/handler.c
+++ b/src/handler.c
@@ -23,7 +23,7 @@
#include "handler.h"
#include "util.h"
-extern struct Vimb vb;
+extern struct neovimb vb;
struct handler {
GHashTable *table; /* holds the protocol handlers */
diff --git a/src/hints.c b/src/hints.c
index 0cb6a5b..fa12ff1 100644
--- a/src/hints.c
+++ b/src/hints.c
@@ -43,7 +43,7 @@ static struct {
guint timeout_id;
} hints;
-extern struct Vimb vb;
+extern struct neovimb vb;
static gboolean call_hints_function(Client *c, const char *func, const char* args,
gboolean sync);
@@ -334,7 +334,7 @@ static gboolean hint_function_check_result(Client *c, GVariant *return_value)
/* Change to normal mode only if we are currently in command mode and
* we are not in g-mode hinting. This is required to not switch to
* normal mode when the hinting triggered a click that set focus on
- * editable element that lead vimb to switch to input mode. */
+ * editable element that lead neovimb to switch to input mode. */
if (!hints.gmode && c->mode->id == 'c') {
vb_enter(c, 'n');
}
diff --git a/src/input.c b/src/input.c
index 56e2676..62badbd 100644
--- a/src/input.c
+++ b/src/input.c
@@ -39,7 +39,7 @@ typedef struct {
static void input_editor_formfiller(const char *text, Client *c, gpointer data);
/**
- * Function called when vimb enters the input mode.
+ * Function called when neovimb enters the input mode.
*/
void input_enter(Client *c)
{
@@ -47,7 +47,7 @@ void input_enter(Client *c)
* disturbing the user */
gtk_widget_grab_focus(GTK_WIDGET(c->webview));
vb_modelabel_update(c, "-- INPUT --");
- ext_proxy_eval_script(c, "var vimb_input_mode_element = document.activeElement;", NULL);
+ ext_proxy_eval_script(c, "var neovimb_input_mode_element = document.activeElement;", NULL);
}
/**
@@ -55,7 +55,7 @@ void input_enter(Client *c)
*/
void input_leave(Client *c)
{
- ext_proxy_eval_script(c, "vimb_input_mode_element.blur();", NULL);
+ ext_proxy_eval_script(c, "neovimb_input_mode_element.blur();", NULL);
vb_modelabel_update(c, "");
}
@@ -120,14 +120,14 @@ VbResult input_open_editor(Client *c)
g_assert(c);
/* get the selected input element */
- jsreturn = ext_proxy_eval_script_sync(c, "vimb_input_mode_element.value");
+ jsreturn = ext_proxy_eval_script_sync(c, "neovimb_input_mode_element.value");
g_variant_get(jsreturn, "(bs)", &success, &text);
if (!success || !text) {
return RESULT_ERROR;
}
- idreturn = ext_proxy_eval_script_sync(c, "vimb_input_mode_element.id");
+ idreturn = ext_proxy_eval_script_sync(c, "neovimb_input_mode_element.id");
g_variant_get(idreturn, "(bs)", &success, &id);
/* Special case: the input element does not have an id assigned to it */
@@ -169,7 +169,7 @@ static void input_editor_formfiller(const char *text, Client *c, gpointer data)
if (eed->element_id && strlen(eed->element_id) > 0) {
jscode = g_strdup_printf("document.getElementById(\"%s\").value=\"%s\"", eed->element_id, escaped);
} else {
- jscode = g_strdup_printf("vimb_editor_map.get(\"%lu\").value=\"%s\"", eed->element_map_key, escaped);
+ jscode = g_strdup_printf("neovimb_editor_map.get(\"%lu\").value=\"%s\"", eed->element_map_key, escaped);
}
ext_proxy_eval_script(c, jscode, NULL);
diff --git a/src/main.c b/src/main.c
index 1074b88..fdbe969 100644
--- a/src/main.c
+++ b/src/main.c
@@ -108,9 +108,9 @@ static void set_statusbar_style(Client *c, StatusType type);
static void set_title(Client *c, const char *title);
static void spawn_new_instance(const char *uri);
#ifdef FREE_ON_QUIT
-static void vimb_cleanup(void);
+static void neovimb_cleanup(void);
#endif
-static void vimb_setup(void);
+static void neovimb_setup(void);
static WebKitWebView *webview_new(Client *c, WebKitWebView *webview);
static void on_counted_matches(WebKitFindController *finder, guint count, Client *c);
static gboolean on_permission_request(WebKitWebView *webview,
@@ -123,7 +123,7 @@ static gboolean profileOptionArgFunc(const gchar *option_name,
static gboolean autocmdOptionArgFunc(const gchar *option_name,
const gchar *value, gpointer data, GError **error);
-struct Vimb vb;
+struct neovimb vb;
/**
* Set the destination for a download according to suggested file name and
@@ -373,8 +373,8 @@ void vb_input_update_style(Client *c)
*
* If arg.i = TARGET_CURRENT, the url is opened into the current webview.
* TARGET_RELATED causes the generation of a new window within the current
- * instance of vimb with a own, but related webview. And TARGET_NEW spawns a
- * new instance of vimb with the given uri.
+ * instance of neovimb with a own, but related webview. And TARGET_NEW spawns a
+ * new instance of neovimb with the given uri.
*/
gboolean vb_load_uri(Client *c, const Arg *arg)
{
@@ -813,16 +813,16 @@ static void client_show(WebKitWebView *webview, Client *c)
char *wid;
wid = g_strdup_printf("%d", (int)GDK_WINDOW_XID(gtk_widget_get_window(c->window)));
- g_setenv("VIMB_WIN_ID", wid, TRUE);
+ g_setenv("neovimb_WIN_ID", wid, TRUE);
#ifndef FEATURE_NO_XEMBED
/* set the x window id to env */
if (vb.embed) {
char *xid;
xid = g_strdup_printf("%d", (int)vb.embed);
- g_setenv("VIMB_XID", xid, TRUE);
+ g_setenv("neovimb_XID", xid, TRUE);
g_free(xid);
} else {
- g_setenv("VIMB_XID", wid, TRUE);
+ g_setenv("neovimb_XID", wid, TRUE);
}
#endif
g_free(wid);
@@ -1015,7 +1015,7 @@ static void set_title(Client *c, const char *title)
{
OVERWRITE_STRING(c->state.title, title);
update_title(c);
- g_setenv("VIMB_TITLE", title ? title : "", TRUE);
+ g_setenv("neovimb_TITLE", title ? title : "", TRUE);
}
/**
@@ -1170,7 +1170,7 @@ static void spawn_download_command(Client *c, WebKitURIResponse *response)
}
envp = g_get_environ();
- envp = g_environ_setenv(envp, "VIMB_DOWNLOAD_PATH",
+ envp = g_environ_setenv(envp, "neovimb_DOWNLOAD_PATH",
GET_CHAR(c, "download-path"), TRUE);
if (g_spawn_async(NULL, argv, envp, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error)) {
@@ -1328,7 +1328,7 @@ static WebKitWebView *on_webview_create(WebKitWebView *webview,
/**
* Callback for the webview decide-policy signal.
* Checks the reasons for some navigation actions and decides if the action is
- * allowed, or should go into a new instance of vimb.
+ * allowed, or should go into a new instance of neovimb.
*/
static gboolean on_webview_decide_policy(WebKitWebView *webview,
WebKitPolicyDecision *dec, WebKitPolicyDecisionType type, Client *c)
@@ -1481,7 +1481,7 @@ static void on_webview_load_changed(WebKitWebView *webview,
set_title(c, uri);
}
/* Make sure hinting is cleared before the new page is loaded.
- * Without that vimb would still be in hinting mode after hinting
+ * Without that neovimb would still be in hinting mode after hinting
* was started and some links was clicked my mouse. Even if there
* could not hints be shown. */
if (c->mode->flags & FLAG_HINTING) {
@@ -1603,7 +1603,7 @@ static void on_webview_notify_uri(WebKitWebView *webview, GParamSpec *pspec, Cli
c->state.uri = util_sanitize_uri(webkit_web_view_get_uri(c->webview));
update_urlbar(c);
- g_setenv("VIMB_URI", c->state.uri, TRUE);
+ g_setenv("neovimb_URI", c->state.uri, TRUE);
}
/**
@@ -1785,7 +1785,7 @@ static void update_urlbar(Client *c)
/**
* Free memory of the whole application.
*/
-static void vimb_cleanup(void)
+static void neovimb_cleanup(void)
{
int i;
@@ -1814,7 +1814,7 @@ static void vimb_cleanup(void)
/**
* Setup resources used on application scope.
*/
-static void vimb_setup(void)
+static void neovimb_setup(void)
{
char *path, *dataPath;
@@ -1900,7 +1900,7 @@ void vb_gui_style_update(Client *c, const char *setting_name_new, const char *se
GString *style_sheet = g_string_new(GUI_STYLE_CSS_BASE);
size_t i;
- /* Mapping from vimb config setting name to css style sheet string */
+ /* Mapping from neovimb config setting name to css style sheet string */
static const char *setting_style_map[][2] = {
{"completion-css", " #completion{%s}"},
{"completion-hover-css", " #completion:hover{%s}"},
@@ -1961,7 +1961,7 @@ void vb_gui_style_update(Client *c, const char *setting_name_new, const char *se
* invalidated automatically."
* https://developer.gnome.org/gtk3/stable/GtkStyleContext.html#gtk-style-context-invalidate
*
- * Required settings in vimb config file:
+ * Required settings in neovimb config file:
* set input-autohide=true
* set input-font-normal=20pt monospace
*
@@ -2219,10 +2219,10 @@ int main(int argc, char* argv[])
/* set the current pid in env */
pidstr = g_strdup_printf("%d", (int)getpid());
- g_setenv("VIMB_PID", pidstr, TRUE);
+ g_setenv("neovimb_PID", pidstr, TRUE);
g_free(pidstr);
- vimb_setup();
+ neovimb_setup();
#ifndef FEATURE_NO_XEMBED
if (winid) {
@@ -2248,7 +2248,7 @@ int main(int argc, char* argv[])
gtk_main();
#ifdef FREE_ON_QUIT
- vimb_cleanup();
+ neovimb_cleanup();
#endif
return EXIT_SUCCESS;
diff --git a/src/main.h b/src/main.h
index 0749daa..37305b9 100644
--- a/src/main.h
+++ b/src/main.h
@@ -267,7 +267,7 @@ struct Client {
} autocmd;
};
-struct Vimb {
+struct neovimb {
char *argv0;
Client *clients;
#ifndef FEATURE_NO_XEMBED
diff --git a/src/map.c b/src/map.c
index 72d364e..ed85cc0 100644
--- a/src/map.c
+++ b/src/map.c
@@ -41,7 +41,7 @@ static void process_events(void);
static void free_events(void);
static void process_event(GdkEventKey* event);
-extern struct Vimb vb;
+extern struct neovimb vb;
static struct {
guint state;
diff --git a/src/normal.c b/src/normal.c
index 37074f5..b0becfc 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -212,10 +212,10 @@ static struct {
/* DEL 0x7f */ {NULL},
};
-extern struct Vimb vb;
+extern struct neovimb vb;
/**
- * Function called when vimb enters the normal mode.
+ * Function called when neovimb enters the normal mode.
*/
void normal_enter(Client *c)
{
@@ -313,7 +313,7 @@ VbResult normal_keypress(Client *c, int key)
}
/**
- * Function called when vimb enters the passthrough mode.
+ * Function called when neovimb enters the passthrough mode.
*/
void pass_enter(Client *c)
{
@@ -449,7 +449,7 @@ static VbResult normal_focus_last_active(Client *c, const NormalCmdInfo *info)
GVariant *variant;
gboolean focused;
- variant = ext_proxy_eval_script_sync(c, "vimb_input_mode_element.focus();");
+ variant = ext_proxy_eval_script_sync(c, "neovimb_input_mode_element.focus();");
g_variant_get(variant, "(bs)", &focused, NULL);
if (!focused) {
ext_proxy_focus_input(c);
diff --git a/src/scripts/focus_editor_map_element.js b/src/scripts/focus_editor_map_element.js
index b3137c5..387b41d 100644
--- a/src/scripts/focus_editor_map_element.js
+++ b/src/scripts/focus_editor_map_element.js
@@ -1,2 +1,2 @@
-vimb_editor_map.get("%lu").disabled=false;
-vimb_editor_map.get("%lu").focus();
+neovimb_editor_map.get("%lu").disabled=false;
+neovimb_editor_map.get("%lu").focus();
diff --git a/src/scripts/hints.css b/src/scripts/hints.css
index 078b37e..f23c4e1 100644
--- a/src/scripts/hints.css
+++ b/src/scripts/hints.css
@@ -1,4 +1,4 @@
-span[vimbhint^='label']{
+span[neovimbhint^='label']{
background-color:#fff;
border:1px solid #444;
color:#000;
@@ -9,17 +9,17 @@ span[vimbhint^='label']{
position:fixed !important;
z-index:225000
}
-*[vimbhint^='hint']{
+*[neovimbhint^='hint']{
background-color:#ff0 !important;
color:#000 !important;
transition-delay:all 0 !important;
transition:all 0 !important;
opacity:1 !important
}
-*[vimbhint='hint focus']{
+*[neovimbhint='hint focus']{
background-color:#8f0 !important
}
-span[vimbhint='label focus']{
+span[neovimbhint='label focus']{
opacity:1;
}
body::-webkit-scrollbar {
diff --git a/src/scripts/hints.js b/src/scripts/hints.js
index 6ee86ad..6a21586 100644
--- a/src/scripts/hints.js
+++ b/src/scripts/hints.js
@@ -7,7 +7,7 @@ var hints = Object.freeze((function(){
activeHint, /* holds the active hint object */
filterText = "", /* holds the typed text filter */
filterKeys = "", /* holds the typed hint-keys filter */
- attr = "vimbhint",
+ attr = "neovimbhint",
config;
/* the hint class used to maintain hinted element and labels */
function Hint() {
@@ -89,8 +89,8 @@ var hints = Object.freeze((function(){
}
for (i = 0; i < docs.length; i++) {
doc = docs[i];
- /* find all hinted elements vimbhint 'hint' */
- var res = xpath(doc.doc, "//*[@vimbhint]");
+ /* find all hinted elements neovimbhint 'hint' */
+ var res = xpath(doc.doc, "//*[@neovimbhint]");
for (j = 0; j < res.snapshotLength; j++) {
e = res.snapshotItem(j);
e.removeAttribute(attr);
diff --git a/src/scripts/set_editor_map_element.js b/src/scripts/set_editor_map_element.js
index 875b410..8166b09 100644
--- a/src/scripts/set_editor_map_element.js
+++ b/src/scripts/set_editor_map_element.js
@@ -1,4 +1,4 @@
-if (typeof(vimb_editor_map) !== 'object') {
- var vimb_editor_map = new Map;
+if (typeof(neovimb_editor_map) !== 'object') {
+ var neovimb_editor_map = new Map;
}
-vimb_editor_map.set("%lu", vimb_input_mode_element);
+neovimb_editor_map.set("%lu", neovimb_input_mode_element);
diff --git a/src/setting.c b/src/setting.c
index f73798e..8ed5d0b 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -70,7 +70,7 @@ static int webkit_spell_checking(Client *c, const char *name, DataType type, voi
static int webkit_spell_checking_language(Client *c, const char *name, DataType type, void *value, void *data);
static int window_decorate(Client *c, const char *name, DataType type, void *value, void *data);
-extern struct Vimb vb;
+extern struct neovimb vb;
void setting_init(Client *c)
@@ -169,7 +169,7 @@ void setting_init(Client *c)
setting_add(c, "spell-checking", TYPE_BOOLEAN, &off, webkit_spell_checking, 0, NULL);
setting_add(c, "spell-checking-languages", TYPE_CHAR, &"en_US", webkit_spell_checking_language, FLAG_LIST|FLAG_NODUP, NULL);
- /* gui style settings vimb */
+ /* gui style settings neovimb */
setting_add(c, "completion-css", TYPE_CHAR, &SETTING_COMPLETION_CSS, gui_style, 0, NULL);
setting_add(c, "completion-hover-css", TYPE_CHAR, &SETTING_COMPLETION_HOVER_CSS, gui_style, 0, NULL);
setting_add(c, "completion-selected-css", TYPE_CHAR, &SETTING_COMPLETION_SELECTED_CSS, gui_style, 0, NULL);
diff --git a/src/shortcut.c b/src/shortcut.c
index 692b727..0a74977 100644
--- a/src/shortcut.c
+++ b/src/shortcut.c
@@ -30,7 +30,7 @@ struct shortcut {
char *fallback; /* default shortcut to use if none given in request */
};
-extern struct Vimb vb;
+extern struct neovimb vb;
static int get_max_placeholder(const char *str);
static const char *shortcut_lookup(Shortcut *sc, const char *string, const char **query);
diff --git a/src/util.c b/src/util.c
index c1a3b10..e5d7195 100644
--- a/src/util.c
+++ b/src/util.c
@@ -37,7 +37,7 @@ static struct {
char *config_dir;
} util;
-extern struct Vimb vb;
+extern struct neovimb vb;
static void create_dir_if_not_exists(const char *dirpath);
static gboolean match(const char *pattern, int patlen, const char *subject);
diff --git a/src/webextension/ext-main.h b/src/webextension/ext-main.h
index 0f5a744..1976585 100644
--- a/src/webextension/ext-main.h
+++ b/src/webextension/ext-main.h
@@ -20,8 +20,8 @@
#ifndef _EXT_MAIN_H
#define _EXT_MAIN_H
-#define VB_WEBEXTENSION_SERVICE_NAME "org.vimb.browser.WebExtension"
-#define VB_WEBEXTENSION_OBJECT_PATH "/org/vimb/browser/WebExtension"
-#define VB_WEBEXTENSION_INTERFACE "org.vimb.browser.WebExtension"
+#define VB_WEBEXTENSION_SERVICE_NAME "org.neovimb.browser.WebExtension"
+#define VB_WEBEXTENSION_OBJECT_PATH "/org/neovimb/browser/WebExtension"
+#define VB_WEBEXTENSION_INTERFACE "org.neovimb.browser.WebExtension"
#endif /* end of include guard: _EXT_MAIN_H */
diff --git a/tests/.gitignore b/tests/.gitignore
deleted file mode 100644
index 362dcd3..0000000
--- a/tests/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/test-*
-!/test-*.c
diff --git a/tests/Makefile b/tests/Makefile
deleted file mode 100644
index c3ce1ca..0000000
--- a/tests/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-CPPFLAGS = -I ../
-
-include ../config.mk
-
-TEST_PROGS = test-util \
- test-shortcut \
- test-handler \
- test-file-storage
-
-all: $(TEST_PROGS)
- $(Q)LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):." gtester --verbose $(TEST_PROGS)
-
-${TEST_PROGS}: ../$(SRCDIR)/vimb.so
-
-test-%: test-%.c
- @echo "${CC} $@"
- $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< ../$(SRCDIR)/vimb.so $(LDFLAGS)
-
-clean:
- $(RM) $(TEST_PROGS)
diff --git a/tests/manual/dummy.html b/tests/manual/dummy.html
deleted file mode 100644
index 60a86c1..0000000
--- a/tests/manual/dummy.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html>
-<head>
-<title>Dummy Page</title>
-</head>
-<body>
-Dummy Page
-</body>
-</html>
-
-
diff --git a/tests/manual/editable-focus-in-iframe.html b/tests/manual/editable-focus-in-iframe.html
deleted file mode 100644
index 46fffe0..0000000
--- a/tests/manual/editable-focus-in-iframe.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<html>
-<head>
-<title>Track Focu/Blur also within iFrames</title>
-</head>
-<body>
-<iframe style="border: 1px solid #000; width: 500px; height: 500px;" src="./editable-focus.html"></iframe>
-</body>
-</html>
-
diff --git a/tests/manual/editable-focus.html b/tests/manual/editable-focus.html
deleted file mode 100644
index 5c0d123..0000000
--- a/tests/manual/editable-focus.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<html>
-<head>
-<title>Input mode Switching</title>
-<script type="text/javascript">
-//<![CDATA[
-function setFocus() {
- document.getElementById("text").focus();
-}
-//]]>
-</script>
-</head>
-<body onload="setFocus();">
- <p>
- Run with <code>scripts=on</code> and <code>strict-focus=off</code>
- <ol>
- <li>If page is loade, vimb should be in input mode.</li>
- <li>Set <code>strict-focus=on</code> and reload page. Vimb should keep
- in normal mode</li>
- <li>Independent from the <code>strict-focus</code> should vimb switch
- to input mode if the button is clicked</li>
- </ol>
- </p>
- <form action="#">
- <div>
- <textarea name="text" id="text" rows="11" cols="50"></textarea><br/>
- <input type="text" name="field1"/><br/>
- <input type="button" value="Focus Textarea" onclick="setFocus();"/><br/>
- <input type="text" name="field2"/>
- </div>
- </form>
- <p>
- Also the following element using <code>contenteditable="true"</code>
- should switch vimb into input mode on click.
- </p>
- <div contenteditable="true" style="width:50%;height:3em;border:1px solid #000">
- Clicking this element using contenteditable="true" should
- switch vimb into input mode too.
- </div>
-</body>
-</html>
-
diff --git a/tests/manual/hints/hints.html b/tests/manual/hints/hints.html
deleted file mode 100644
index 6df4255..0000000
--- a/tests/manual/hints/hints.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<html>
-<head>
-<title>hints</title>
-</head>
-<body>
- <ul>
- <li><a href="https://github.com">a href site 0</a></li>
- <li><a href="https://github.com">a href site 1</a></li>
- <li><a href="https://github.com">a href site 2</a></li>
- <li><a href="https://github.com">a href site 3</a></li>
- <li><a href="https://github.com">a href site 4</a></li>
- <li><a href="https://github.com">a href site 5</a></li>
- <li><a href="https://github.com">a href site 6</a></li>
- <li><a href="https://github.com">a href site 7</a></li>
- <li><a href="https://github.com">a href site 8</a></li>
- <li><a href="https://github.com">a href site 9</a></li>
- <li><a href="#0">a href anchor 0</a></li>
- <li><a href="#1">a href anchor 1</a></li>
- <li><a href="#2">a href anchor 2</a></li>
- <li><a href="#3">a href anchor 3</a></li>
- <li><a href="#4">a href anchor 4</a></li>
- <li><a href="#5">a href anchor 5</a></li>
- <li><a href="#6">a href anchor 6</a></li>
- <li><a href="#7">a href anchor 7</a></li>
- <li><a href="#8">a href anchor 8</a></li>
- <li><a href="#9">a href anchor 9</a></li>
- </ul>
-</body>
-</html>
-
diff --git a/tests/manual/hints/label-positioning.html b/tests/manual/hints/label-positioning.html
deleted file mode 100644
index 6c54a29..0000000
--- a/tests/manual/hints/label-positioning.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <style type="text/css">
- body {
- position: absolute;
- left: 50%;
- width: 500px;
- margin-left: -250px;
- }
- </style>
- <title>Hint Label positioning with negative margins</title>
-</head>
-<body>
- <p>
- When using hints (f) on this page, the hint should be placed on
- the upper left corner of the links.<br/>
- <a href="#one">one</a><br/>
- <a href="#two">two</a>
- </p>
- <p>
- To test the hints within iFrame
- <code>allow-universal-access-from-file-urls</code> must be enabled.
- And the page reloaded.
- <iframe src="./wrapped.html" style="margin: 5px 50px; width: 400px; heigth: 200px;"></iframe>
- </p>
-</body>
-</html>
diff --git a/tests/manual/hints/wrapped.html b/tests/manual/hints/wrapped.html
deleted file mode 100644
index d6176f0..0000000
--- a/tests/manual/hints/wrapped.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Simple Links</title>
-</head>
-<body>
- <a href="#one">one</a>
- <br/>
- <!-- link should not be visible without scrolling -->
- <a href="#two" style="position: absolute; top: 200px;">two</a>
-</body>
-</html>
-
diff --git a/tests/manual/js-window-close.html b/tests/manual/js-window-close.html
deleted file mode 100644
index 160d615..0000000
--- a/tests/manual/js-window-close.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<html>
-<head>
-<title>JS Window Close</title>
-</head>
-<body>
-Click on following link should close the window without crashing.<br>
-<a href="#" onclick="window.close()">Close this window</a>
-</body>
-</html>
diff --git a/tests/manual/window-open.html b/tests/manual/window-open.html
deleted file mode 100644
index 6a8e81b..0000000
--- a/tests/manual/window-open.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<html>
-<head>
-<title>Window open</title>
-</head>
-<body>
- <p>
- Enable <code>set prevent-newwindow=on</code><br/>
- Following link should be opened into current window.<br/><br/>
- <a href="./dummy.html" target="_new">target="_new"</a><br/>
- <a href="./dummy.html" target="_blank">target="_blank"</a><br/>
- <a href="javascript:window.open('./dummy.html', 'winname')">javascript:window-open</a><br/>
- <a href="#" onclick="window.open('./dummy.html', 'winname')">onclick window-open</a><br/>
- </p>
- <p>
- This <a href="./dummy.html" target="foo">target iframe link</a> should
- load into the iframe.<br/>
- <iframe src="" name="foo"></iframe>
- </p>
-</body>
-</html>
-
diff --git a/tests/test-file-storage.c b/tests/test-file-storage.c
deleted file mode 100644
index 387905b..0000000
--- a/tests/test-file-storage.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/**
- * vimb - a webkit based vim like browser.
- *
- * Copyright (C) 2012-2019 Daniel Carl
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see http://www.gnu.org/licenses/.
- */
-
-#include <src/file-storage.h>
-#include <gio/gio.h>
-#include <stdio.h>
-
-static char *pwd;
-static char *none_existing_file = "_absent.txt";
-static char *created_file = "_created.txt";
-static char *existing_file = "_existent.txt";
-
-static void test_ephemeral_no_file(void)
-{
- FileStorage *s;
- char **lines;
- char *file_path;
-
- file_path = g_build_filename(pwd, none_existing_file, NULL);
-
- /* make sure the file does not exist */
- remove(file_path);
- s = file_storage_new(pwd, none_existing_file, TRUE);
- g_assert_nonnull(s);
- g_assert_cmpstr(file_path, ==, file_storage_get_path(s));
- g_assert_true(file_storage_is_readonly(s));
-
- /* empty file storage */
- lines = file_storage_get_lines(s);
- g_assert_cmpint(g_strv_length(lines), ==, 0);
- g_strfreev(lines);
-
- file_storage_append(s, "-%s\n", "foo");
- file_storage_append(s, "-%s\n", "bar");
-
- /* File must not be created on appending data to storage */
- g_assert_false(g_file_test(file_path, G_FILE_TEST_IS_REGULAR));
-
- lines = file_storage_get_lines(s);
- g_assert_cmpint(g_strv_length(lines), ==, 3);
- g_assert_cmpstr(lines[0], ==, "-foo");
- g_assert_cmpstr(lines[1], ==, "-bar");
- g_strfreev(lines);
- file_storage_free(s);
- g_free(file_path);
-}
-
-static void test_file_created(void)
-{
- FileStorage *s;
- char *file_path;
-
- file_path = g_build_filename(pwd, created_file, NULL);
- remove(file_path);
-
- g_assert_false(g_file_test(file_path, G_FILE_TEST_IS_REGULAR));
- s = file_storage_new(pwd, created_file, FALSE);
- g_assert_false(file_storage_is_readonly(s));
- g_assert_cmpstr(file_path, ==, file_storage_get_path(s));
-
- /* check that file is created only on first write */
- g_assert_false(g_file_test(file_path, G_FILE_TEST_IS_REGULAR));
- file_storage_append(s, "");
- g_assert_true(g_file_test(file_path, G_FILE_TEST_IS_REGULAR));
-
- file_storage_free(s);
- g_free(file_path);
-}
-
-static void test_ephemeral_with_file(void)
-{
- FileStorage *s;
- char *file_path;
- char **lines;
- char *content = NULL;
- gboolean result;
-
- file_path = g_build_filename(pwd, existing_file, NULL);
-
- s = file_storage_new(pwd, existing_file, TRUE);
- g_assert_nonnull(s);
- g_assert_true(file_storage_is_readonly(s));
- g_assert_cmpstr(file_path, ==, file_storage_get_path(s));
-
- /* file does not exists yet */
- lines = file_storage_get_lines(s);
- g_assert_cmpint(g_strv_length(lines), ==, 0);
- g_strfreev(lines);
-
- /* empty file storage but file with two lines */
- result = g_file_set_contents(file_path, "one\n", -1, NULL);
- g_assert_true(result);
- lines = file_storage_get_lines(s);
- g_assert_cmpint(g_strv_length(lines), ==, 2);
- g_strfreev(lines);
-
- file_storage_append(s, "%s\n", "two ephemeral");
-
- lines = file_storage_get_lines(s);
- g_assert_cmpint(g_strv_length(lines), ==, 3);
- g_assert_cmpstr(lines[0], ==, "one");
- g_assert_cmpstr(lines[1], ==, "two ephemeral");
- g_strfreev(lines);
-
- /* now make sure the file was not changed */
- g_file_get_contents(file_path, &content, NULL, NULL);
- g_assert_cmpstr(content, ==, "one\n");
-
- file_storage_free(s);
- g_free(file_path);
-}
-
-int main(int argc, char *argv[])
-{
- int result;
- g_test_init(&argc, &argv, NULL);
-
- pwd = g_get_current_dir();
-
- g_test_add_func("/test-file-storage/ephemeral-no-file", test_ephemeral_no_file);
- g_test_add_func("/test-file-storage/file-created", test_file_created);
- g_test_add_func("/test-file-storage/ephemeral-with-file", test_ephemeral_with_file);
-
- result = g_test_run();
-
- remove(existing_file);
- remove(created_file);
- g_free(pwd);
-
- return result;
-}
diff --git a/tests/test-handler.c b/tests/test-handler.c
deleted file mode 100644
index a1d93d0..0000000
--- a/tests/test-handler.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * vimb - a webkit based vim like browser.
- *
- * Copyright (C) 2012-2018 Daniel Carl
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see http://www.gnu.org/licenses/.
- */
-
-#include <gtk/gtk.h>
-#include <src/handler.h>
-#include <src/completion.h>
-
-static Handler *handler = NULL;
-
-#define TEST_URI "http://fanglingsu.github.io/vimb/"
-
-static void test_handler_add(void)
-{
- g_assert_true(handler_add(handler, "https", "e"));
-}
-
-static void test_handler_remove(void)
-{
- g_assert_true(handler_add(handler, "https", "e"));
-
- g_assert_true(handler_remove(handler, "https"));
- g_assert_false(handler_remove(handler, "https"));
-}
-
-static void test_handler_run_success(void)
-{
- if (g_test_subprocess()) {
- handler_add(handler, "http", "echo -n 'handled uri %s'");
- handler_handle_uri(handler, TEST_URI);
- return;
- }
- g_test_trap_subprocess(NULL, 0, 0);
- g_test_trap_assert_passed();
- g_test_trap_assert_stdout("handled uri " TEST_URI);
-}
-
-static void test_handler_run_failed(void)
-{
- if (g_test_subprocess()) {
- handler_add(handler, "http", "unknown-program %s");
- handler_handle_uri(handler, TEST_URI);
- return;
- }
- g_test_trap_subprocess(NULL, 0, 0);
- g_test_trap_assert_failed();
- g_test_trap_assert_stderr("*Can't run *unknown-program*");
-}
-
-static void test_handler_fill_completion(void)
-{
- GtkListStore *store;
- g_assert_true(handler_add(handler, "http", "echo"));
- g_assert_true(handler_add(handler, "https", "echo"));
- g_assert_true(handler_add(handler, "about", "echo"));
- g_assert_true(handler_add(handler, "ftp", "echo"));
-
- store = gtk_list_store_new(COMPLETION_STORE_NUM, G_TYPE_STRING, G_TYPE_STRING);
- /* check case where multiple matches are found */
- g_assert_true(handler_fill_completion(handler, store, "http"));
- g_assert_cmpint(gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL), ==, 2);
- gtk_list_store_clear(store);
-
- /* check case where only one matches are found */
- g_assert_true(handler_fill_completion(handler, store, "f"));
- g_assert_cmpint(gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL), ==, 1);
- gtk_list_store_clear(store);
-
- /* check case where no match is found */
- g_assert_false(handler_fill_completion(handler, store, "unknown"));
- g_assert_cmpint(gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL), ==, 0);
- gtk_list_store_clear(store);
-
- /* check case without apllied filters */
- g_assert_true(handler_fill_completion(handler, store, ""));
- g_assert_cmpint(gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL), ==, 4);
- gtk_list_store_clear(store);
-}
-
-int main(int argc, char *argv[])
-{
- int result;
- handler = handler_new();
-
- g_test_init(&argc, &argv, NULL);
-
- g_test_add_func("/test-handlers/add", test_handler_add);
- g_test_add_func("/test-handlers/remove", test_handler_remove);
- g_test_add_func("/test-handlers/handle_uri/success", test_handler_run_success);
- g_test_add_func("/test-handlers/handle_uri/failed", test_handler_run_failed);
- g_test_add_func("/test-handlers/fill-completion", test_handler_fill_completion);
- result = g_test_run();
-
- handler_free(handler);
-
- return result;
-}
diff --git a/tests/test-shortcut.c b/tests/test-shortcut.c
deleted file mode 100644
index 0b92183..0000000
--- a/tests/test-shortcut.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * vimb - a webkit based vim like browser.
- *
- * Copyright (C) 2012-2018 Daniel Carl
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see http://www.gnu.org/licenses/.
- */
-
-#include <gtk/gtk.h>
-#include <src/shortcut.h>
-#include <src/main.h>
-
-Shortcut *sc = NULL;
-
-static void test_shortcut(void)
-{
- char *uri;
- unsigned int i;
- struct {
- char *in;
- char *out;
- } data[] = {
- /* call with shortcut identifier */
- {"_vimb1_ zero one", "only-zero:zero%20one"},
- /* don't fail on unmatches quotes if there are only $0 placeholders */
- {"_vimb1_ 'unmatches quote", "only-zero:'unmatches%20quote"},
- /* check if all placeholders $0 are replaces */
- {"_vimb5_ one two", "double-zero:one%20two-one%20two"},
- /* check the defautl shortcut is used */
- {"zero one two three", "default:zero-two%20three"},
- /* don't remove non matched placeholders */
- {"zero", "default:zero-$2"},
- {"_vimb3_ zero one two three four five six seven eight nine", "fullrange:zero-one-nine"}
- };
-
- for (i = 0; i < LENGTH(data); i++) {
- uri = shortcut_get_uri(sc, data->in);
- g_assert_cmpstr(uri, ==, data->out);
- g_free(uri);
- }
-}
-
-static void test_shortcut_shell_param(void)
-{
- char *uri;
-
- /* double quotes */
- uri = shortcut_get_uri(sc, "_vimb6_ \"rail station\" city hall");
- g_assert_cmpstr(uri, ==, "shell:rail%20station-city%20hall");
- g_free(uri);
-
- /* single quotes */
- uri = shortcut_get_uri(sc, "_vimb6_ 'rail station' 'city hall'");
- g_assert_cmpstr(uri, ==, "shell:rail%20station-city%20hall");
- g_free(uri);
-
- /* ignore none matching quote errors */
- uri = shortcut_get_uri(sc, "_vimb6_ \"rail station\" \"city hall");
- g_assert_cmpstr(uri, ==, "shell:rail%20station-city%20hall");
- g_free(uri);
-
- /* don't fill up quoted param with unquoted stuff */
- uri = shortcut_get_uri(sc, "_vimb6_ \"param 1\" \"param 2\" ignored params");
- g_assert_cmpstr(uri, ==, "shell:param%201-param%202");
- g_free(uri);
-
- /* allo quotes within tha last parameter */
- uri = shortcut_get_uri(sc, "_vimb6_ param1 param2 \"containing quotes\"");
- g_assert_cmpstr(uri, ==, "shell:param1-param2%20%22containing%20quotes%22");
- g_free(uri);
-}
-
-static void test_shortcut_remove(void)
-{
- char *uri;
-
- g_assert_true(shortcut_remove(sc, "_vimb4_"));
-
- /* check if the shortcut is really no used */
- uri = shortcut_get_uri(sc, "_vimb4_ test");
- g_assert_cmpstr(uri, ==, "default:_vimb4_-$2");
- g_free(uri);
-
- g_assert_false(shortcut_remove(sc, "_vimb4_"));
-}
-
-int main(int argc, char *argv[])
-{
- int result;
- sc = shortcut_new();
-
- g_assert_true(shortcut_add(sc, "_vimb1_", "only-zero:$0"));
- g_assert_true(shortcut_add(sc, "_vimb2_", "default:$0-$2"));
- g_assert_true(shortcut_add(sc, "_vimb3_", "fullrange:$0-$1-$9"));
- g_assert_true(shortcut_add(sc, "_vimb4_", "for-remove:$0"));
- g_assert_true(shortcut_add(sc, "_vimb5_", "double-zero:$0-$0"));
- g_assert_true(shortcut_add(sc, "_vimb6_", "shell:$0-$1"));
- g_assert_true(shortcut_set_default(sc, "_vimb2_"));
-
- g_test_init(&argc, &argv, NULL);
-
- g_test_add_func("/test-shortcut/get_uri/single", test_shortcut);
- g_test_add_func("/test-shortcut/get_uri/shell-param", test_shortcut_shell_param);
- g_test_add_func("/test-shortcut/remove", test_shortcut_remove);
-
- result = g_test_run();
-
- shortcut_free(sc);
-
- return result;
-}
diff --git a/tests/test-util.c b/tests/test-util.c
deleted file mode 100644
index 78728af..0000000
--- a/tests/test-util.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/**
- * vimb - a webkit based vim like browser.
- *
- * Copyright (C) 2012-2018 Daniel Carl
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see http://www.gnu.org/licenses/.
- */
-
-#include <pwd.h>
-#include <gtk/gtk.h>
-#include <src/util.h>
-
-static void check_expand(const char *str, const char *expected)
-{
- char *result = util_expand(str, UTIL_EXP_DOLLAR|UTIL_EXP_TILDE);
- g_assert_cmpstr(result, ==, expected);
- g_free(result);
-}
-
-static void test_expand_evn(void)
-{
- /* set environment var for testing expansion */
- g_setenv("VIMB_VAR", "value", true);
-
- check_expand("$VIMB_VAR", "value");
- check_expand("$VIMB_VAR", "value");
- check_expand("$VIMB_VAR$VIMB_VAR", "valuevalue");
- check_expand("${VIMB_VAR}", "value");
- check_expand("my$VIMB_VAR", "myvalue");
- check_expand("'$VIMB_VAR'", "'value'");
- check_expand("${VIMB_VAR}s ", "values ");
-
- g_unsetenv("UNKNOWN");
-
- check_expand("$UNKNOWN", "");
- check_expand("${UNKNOWN}", "");
- check_expand("'$UNKNOWN'", "''");
-}
-
-static void test_expand_escaped(void)
-{
- g_setenv("VIMB_VAR", "value", true);
-
- check_expand("\\$VIMB_VAR", "$VIMB_VAR");
- check_expand("\\${VIMB_VAR}", "${VIMB_VAR}");
- check_expand("\\~/", "~/");
- check_expand("\\~/vimb", "~/vimb");
- check_expand("\\~root", "~root");
- check_expand("\\\\$VIMB_VAR", "\\value"); /* \\$VAR becomes \ExpandedVar */
- check_expand("\\\\\\$VIMB_VAR", "\\$VIMB_VAR"); /* \\\$VAR becomes \$VAR */
-}
-
-static void test_expand_tilde_home(void)
-{
- char *dir;
- const char *home = g_get_home_dir();
-
- check_expand("~", "~");
- check_expand("~/", home);
- check_expand("foo~/bar", "foo~/bar");
- check_expand("~/foo", (dir = g_strdup_printf("%s/foo", home)));
- g_free(dir);
-
- check_expand("foo ~/bar", (dir = g_strdup_printf("foo %s/bar", home)));
- g_free(dir);
-
- check_expand("~/~", (dir = g_strdup_printf("%s/~", home)));
- g_free(dir);
-
- check_expand("~/~/", (dir = g_strdup_printf("%s/~/", home)));
- g_free(dir);
-}
-
-static void test_expand_tilde_user(void)
-{
- const char *user = g_get_user_name();
- const char *home;
- char *in, *out;
- struct passwd *pwd;
-
- /* initialize home */
- pwd = getpwnam(user);
- g_assert_nonnull(pwd);
- home = pwd->pw_dir;
-
- /* don't expand within words */
- in = g_strdup_printf("foo~%s/bar", user);
- check_expand(in, in);
- g_free(in);
-
- check_expand((in = g_strdup_printf("foo ~%s", user)), (out = g_strdup_printf("foo %s", home)));
- g_free(in);
- g_free(out);
-
- check_expand((in = g_strdup_printf("~%s", user)), home);
- g_free(in);
-
- check_expand((in = g_strdup_printf("~%s/bar", user)), (out = g_strdup_printf("%s/bar", home)));
- g_free(in);
- g_free(out);
-}
-
-static void test_strcasestr(void)
-{
- g_assert_nonnull(util_strcasestr("Vim like Browser", "browser"));
- g_assert_nonnull(util_strcasestr("Vim like Browser", "vim LIKE"));
-}
-
-static void test_str_replace(void)
-{
- char *value;
-
- value = util_str_replace("a", "uu", "foo bar baz");
- g_assert_cmpstr(value, ==, "foo buur buuz");
- g_free(value);
-
- value = util_str_replace("$1", "placeholder", "string with $1");
- g_assert_cmpstr(value, ==, "string with placeholder");
- g_free(value);
-}
-
-static void test_wildmatch_simple(void)
-{
- g_assert_true(util_wildmatch("", ""));
- g_assert_true(util_wildmatch("w", "w"));
- g_assert_true(util_wildmatch(".", "."));
- g_assert_true(util_wildmatch("~", "~"));
- g_assert_true(util_wildmatch("wildmatch", "WildMatch"));
- g_assert_true(util_wildmatch("wild\\match", "wild\\match"));
-
- /* no special meaning of . and ~ in pattern */
- g_assert_false(util_wildmatch(".", "w"));
- g_assert_false(util_wildmatch("~", "w"));
- g_assert_false(util_wildmatch("wild", "wild "));
- g_assert_false(util_wildmatch("wild", " wild"));
- g_assert_false(util_wildmatch("wild", "\\ wild"));
- g_assert_false(util_wildmatch("wild", "\\wild"));
- g_assert_false(util_wildmatch("wild", "wild\\"));
- g_assert_false(util_wildmatch("wild\\1", "wild\\2"));
-}
-
-static void test_wildmatch_questionmark(void)
-{
- g_assert_true(util_wildmatch("wild?atch", "wildmatch"));
- g_assert_true(util_wildmatch("wild?atch", "wildBatch"));
- g_assert_true(util_wildmatch("wild?atch", "wild?atch"));
- g_assert_true(util_wildmatch("?ild?atch", "MildBatch"));
- g_assert_true(util_wildmatch("foo\\?bar", "foo?bar"));
- g_assert_true(util_wildmatch("???", "foo"));
- g_assert_true(util_wildmatch("???", "bar"));
-
- g_assert_false(util_wildmatch("foo\\?bar", "foorbar"));
- g_assert_false(util_wildmatch("?", ""));
- g_assert_false(util_wildmatch("b??r", "bar"));
- /* ? does not match / in contrast to * which does */
- g_assert_false(util_wildmatch("user?share", "user/share"));
-}
-
-static void test_wildmatch_wildcard(void)
-{
- g_assert_true(util_wildmatch("*", ""));
- g_assert_true(util_wildmatch("*", "Match as much as possible"));
- g_assert_true(util_wildmatch("*match", "prefix match"));
- g_assert_true(util_wildmatch("match*", "match suffix"));
- g_assert_true(util_wildmatch("match*", "match*"));
- g_assert_true(util_wildmatch("match\\*", "match*"));
- g_assert_true(util_wildmatch("match\\\\*", "match\\*"));
- g_assert_true(util_wildmatch("do * match", "do a infix match"));
- /* '*' matches also / in contrast to other implementations */
- g_assert_true(util_wildmatch("start*end", "start/something/end"));
- g_assert_true(util_wildmatch("*://*.io/*", "http://fanglingsu.github.io/vimb/"));
- /* multiple * should act like a single one */
- g_assert_true(util_wildmatch("**", ""));
- g_assert_true(util_wildmatch("match **", "Match as much as possible"));
- g_assert_true(util_wildmatch("f***u", "fu"));
-
- g_assert_false(util_wildmatch("match\\*", "match fail"));
- g_assert_false(util_wildmatch("f***u", "full"));
-}
-
-static void test_wildmatch_curlybraces(void)
-{
- g_assert_true(util_wildmatch("{foo}", "foo"));
- g_assert_true(util_wildmatch("{foo,bar}", "foo"));
- g_assert_true(util_wildmatch("{foo,bar}", "bar"));
- g_assert_true(util_wildmatch("foo{lish,t}bar", "foolishbar"));
- g_assert_true(util_wildmatch("foo{lish,t}bar", "footbar"));
- /* esacped special chars */
- g_assert_true(util_wildmatch("foo\\{l\\}bar", "foo{l}bar"));
- g_assert_true(util_wildmatch("ba{r,z\\{\\}}", "bar"));
- g_assert_true(util_wildmatch("ba{r,z\\{\\}}", "baz{}"));
- g_assert_true(util_wildmatch("test{one\\,two,three}", "testone,two"));
- g_assert_true(util_wildmatch("test{one\\,two,three}", "testthree"));
- /* backslash before none special char is a normal char */
- g_assert_true(util_wildmatch("back{\\slash,}", "back\\slash"));
- g_assert_true(util_wildmatch("one\\two", "one\\two"));
- g_assert_true(util_wildmatch("\\}match", "}match"));
- g_assert_true(util_wildmatch("\\{", "{"));
- /* empty list parts */
- g_assert_true(util_wildmatch("{}", ""));
- g_assert_true(util_wildmatch("{,}", ""));
- g_assert_true(util_wildmatch("{,foo}", ""));
- g_assert_true(util_wildmatch("{,foo}", "foo"));
- g_assert_true(util_wildmatch("{bar,}", ""));
- g_assert_true(util_wildmatch("{bar,}", "bar"));
- /* no special meaning of ? and * in curly braces */
- g_assert_true(util_wildmatch("ab{*,cd}ef", "ab*ef"));
- g_assert_true(util_wildmatch("ab{d,?}ef", "ab?ef"));
-
- g_assert_false(util_wildmatch("{foo,bar}", "foo,bar"));
- g_assert_false(util_wildmatch("}match{ it", "}match{ anything"));
- /* don't match single parts that are seperated by escaped ',' */
- g_assert_false(util_wildmatch("{a,b\\,c,d}", "b"));
- g_assert_false(util_wildmatch("{a,b\\,c,d}", "c"));
- /* lonesome braces - this is a syntax error and will always be false */
- g_assert_false(util_wildmatch("}", "}"));
- g_assert_false(util_wildmatch("}", ""));
- g_assert_false(util_wildmatch("}suffix", "}suffux"));
- g_assert_false(util_wildmatch("}suffix", "suffux"));
- g_assert_false(util_wildmatch("{", "{"));
- g_assert_false(util_wildmatch("{", ""));
- g_assert_false(util_wildmatch("{foo", "{foo"));
- g_assert_false(util_wildmatch("{foo", "foo"));
- g_assert_false(util_wildmatch("foo{bar", "foo{bar"));
-}
-
-static void test_wildmatch_complete(void)
-{
- g_assert_true(util_wildmatch("http{s,}://{fanglingsu.,}github.{io,com}/*vimb/", "http://fanglingsu.github.io/vimb/"));
- g_assert_true(util_wildmatch("http{s,}://{fanglingsu.,}github.{io,com}/*vimb/", "https://github.com/fanglingsu/vimb/"));
-}
-
-static void test_wildmatch_multi(void)
-{
- g_assert_true(util_wildmatch("foo,?", "foo"));
- g_assert_true(util_wildmatch("foo,?", "f"));
- g_assert_true(util_wildmatch("foo,b{a,o,}r,ba?", "foo"));
- g_assert_true(util_wildmatch("foo,b{a,o,}r,ba?", "bar"));
- g_assert_true(util_wildmatch("foo,b{a,o,}r,ba?", "bor"));
- g_assert_true(util_wildmatch("foo,b{a,o,}r,ba?", "br"));
- g_assert_true(util_wildmatch("foo,b{a,o,}r,ba?", "baz"));
- g_assert_true(util_wildmatch("foo,b{a,o,}r,ba?", "bat"));
-
- g_assert_false(util_wildmatch("foo,b{a,o,}r,ba?", "foo,"));
- g_assert_false(util_wildmatch("foo,?", "fo"));
-}
-
-static void test_strescape(void)
-{
- unsigned int i;
- char *value;
- struct {
- char *in;
- char *expected;
- char *excludes;
- } data[] = {
- {"", "", NULL},
- {"foo", "foo", NULL},
- {"a\nb\nc", "a\\nb\\nc", NULL},
- {"foo\"bar", "foo\\bar", NULL},
- {"s\\t", "s\\\\t", NULL},
- {"u\bv", "u\\bv", NULL},
- {"w\fx", "w\\fx", NULL},
- {"y\rz", "y\\rz", NULL},
- {"tab\tdi\t", "tab\\tdi\\t", NULL},
- {"❧äüö\n@foo\t\"bar\"", "❧äüö\\n@foo\\t\\\"bar\\\"", NULL},
- {"❧äüö\n@foo\t\"bar\"", "❧äüö\\n@foo\\t\"bar\"", "\""},
- {"❧äüö\n@foo\t\"bar\"", "❧äüö\n@foo\t\\\"bar\\\"", "\n\t"},
- };
- for (i = 0; i < LENGTH(data); i++) {
- value = util_strescape(data->in, data->excludes);
- g_assert_cmpstr(value, ==, data->expected);
- g_free(value);
- }
-}
-
-static void test_string_to_timespan(void)
-{
- g_assert_cmpuint(util_string_to_timespan("d"), ==, G_TIME_SPAN_DAY);
- g_assert_cmpuint(util_string_to_timespan("h"), ==, G_TIME_SPAN_HOUR);
- g_assert_cmpuint(util_string_to_timespan("m"), ==, G_TIME_SPAN_MINUTE);
- g_assert_cmpuint(util_string_to_timespan("s"), ==, G_TIME_SPAN_SECOND);
-
- g_assert_cmpuint(util_string_to_timespan("y"), ==, G_TIME_SPAN_DAY * 365);
- g_assert_cmpuint(util_string_to_timespan("w"), ==, G_TIME_SPAN_DAY * 7);
-
- /* use counters */
- g_assert_cmpuint(util_string_to_timespan("1s"), ==, G_TIME_SPAN_SECOND);
- g_assert_cmpuint(util_string_to_timespan("2s"), ==, 2 * G_TIME_SPAN_SECOND);
- g_assert_cmpuint(util_string_to_timespan("34s"), ==, 34 * G_TIME_SPAN_SECOND);
- g_assert_cmpuint(util_string_to_timespan("0s"), ==, 0);
-
- /* combine counters and different units */
- g_assert_cmpuint(util_string_to_timespan("ds"), ==, G_TIME_SPAN_DAY + G_TIME_SPAN_SECOND);
- g_assert_cmpuint(util_string_to_timespan("2dh0s"), ==, (2 * G_TIME_SPAN_DAY) + G_TIME_SPAN_HOUR);
-
- /* unparsabel values */
- g_assert_cmpuint(util_string_to_timespan(""), ==, 0);
- g_assert_cmpuint(util_string_to_timespan("-"), ==, 0);
- g_assert_cmpuint(util_string_to_timespan("5-"), ==, 0);
-}
-
-int main(int argc, char *argv[])
-{
- g_test_init(&argc, &argv, NULL);
-
- g_test_add_func("/test-util/expand-env", test_expand_evn);
- g_test_add_func("/test-util/expand-escaped", test_expand_escaped);
- g_test_add_func("/test-util/expand-tilde-home", test_expand_tilde_home);
- g_test_add_func("/test-util/expand-tilde-user", test_expand_tilde_user);
- g_test_add_func("/test-util/strcasestr", test_strcasestr);
- g_test_add_func("/test-util/str_replace", test_str_replace);
- g_test_add_func("/test-util/wildmatch-simple", test_wildmatch_simple);
- g_test_add_func("/test-util/wildmatch-questionmark", test_wildmatch_questionmark);
- g_test_add_func("/test-util/wildmatch-wildcard", test_wildmatch_wildcard);
- g_test_add_func("/test-util/wildmatch-curlybraces", test_wildmatch_curlybraces);
- g_test_add_func("/test-util/wildmatch-complete", test_wildmatch_complete);
- g_test_add_func("/test-util/wildmatch-multi", test_wildmatch_multi);
- g_test_add_func("/test-util/strescape", test_strescape);
- g_test_add_func("/test-util/string_to_timespan", test_string_to_timespan);
-
- return g_test_run();
-}