Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package vis for openSUSE:Factory checked in at 2022-11-02 12:46:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/vis (Old) and /work/SRC/openSUSE:Factory/.vis.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "vis" Wed Nov 2 12:46:55 2022 rev:7 rq:1032706 version:0.8 Changes: -------- --- /work/SRC/openSUSE:Factory/vis/vis.changes 2021-02-15 23:19:53.795718087 +0100 +++ /work/SRC/openSUSE:Factory/.vis.new.2275/vis.changes 2022-11-02 12:47:41.681736509 +0100 @@ -1,0 +2,34 @@ +Tue Nov 1 15:07:35 UTC 2022 - Matej Cepl <[email protected]> + +- Update to 0.8: + - build: add git based version information back + - lexers: fix bug in bash lexer for last here-doc + - vis: make O implementation independent of <Up> mapping + - fix typos in comments + - lua: fix luacheck warnings + - vis: rename to/till motion internals + - vis: implement multiline to/till motions + - vis-lua: provide file.permission property + - Mention pkg-config in README + - lexers/strace: improve comments, field names and syscall results + - lexers/git-rebase: also highlight break command + - filetype: Set "bash" for APKBUILD and .ebuild. + - filetype: Detect make shebang for "makefile". + - Adding .sv extension to verilog syntax highlighter + - build: update alpine in docker build to version 3.13 + - sam: only skip the last empty match if it follows a newline + - sam: produce empty match at the end of looped range + - test: update + - gitignore: remove vim specific swap files + - sam: tweak handling of zero length matches in y commands + - sam: simplify trailing match handling for x/y commands + - vis: correctly close pipe connected to stdin of external process + - add lua5.4 in configure script + - vis: Add readline Ctrl+A/E bindings + - ci: verify codecov script before using it + - ci: verify coverity scan script before using it + - filetype: Set "groovy" for Jenkinsfile + - README: x/freenode/c/libera/ + - Set version to 0.8 + +------------------------------------------------------------------- Old: ---- vis-0.7.tar.gz New: ---- vis-0.8.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ vis.spec ++++++ --- /var/tmp/diff_new_pack.4ENYQG/_old 2022-11-02 12:47:42.313739717 +0100 +++ /var/tmp/diff_new_pack.4ENYQG/_new 2022-11-02 12:47:42.317739737 +0100 @@ -1,7 +1,7 @@ # # spec file for package vis # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define test_version 0.5 Name: vis -Version: 0.7 +Version: 0.8 Release: 0 Summary: An editor combining the strengths of both vi(m) and sam License: ISC ++++++ vis-0.7.tar.gz -> vis-0.8.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/.github/workflows/coverity-scan.yml new/vis-0.8/.github/workflows/coverity-scan.yml --- old/vis-0.7/.github/workflows/coverity-scan.yml 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/.github/workflows/coverity-scan.yml 2022-11-01 14:50:10.000000000 +0100 @@ -24,9 +24,14 @@ - name: Download Coverity Build Tool run: | - wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=martanne/vis" -O cov-analysis-linux64.tar.gz + wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=martanne/vis" -O coverity_tool.tgz + wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=martanne/vis&md5=1" -O coverity_tool.md5 + if ! (cat coverity_tool.md5; echo " coverity_tool.tgz") | md5sum -c --status; then + echo "Download checksum verification failed" + exit 1 + fi mkdir cov-analysis-linux64 - tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64 + tar xzf coverity_tool.tgz --strip 1 -C cov-analysis-linux64 env: TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/.github/workflows/macos.yml new/vis-0.8/.github/workflows/macos.yml --- old/vis-0.7/.github/workflows/macos.yml 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/.github/workflows/macos.yml 2022-11-01 14:50:10.000000000 +0100 @@ -49,4 +49,10 @@ env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | - bash <(curl -s https://codecov.io/bash) + curl -s https://codecov.io/bash > codecov + curl -s https://raw.githubusercontent.com/codecov/codecov-bash/master/SHA256SUM > codecov.sha256 + if ! sha256sum -c --ignore-missing --status codecov.sha256 ; then + echo "Download checksum verification failed" + exit 1 + fi + bash < codecov diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/.github/workflows/ubuntu.yml new/vis-0.8/.github/workflows/ubuntu.yml --- old/vis-0.7/.github/workflows/ubuntu.yml 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/.github/workflows/ubuntu.yml 2022-11-01 14:50:10.000000000 +0100 @@ -55,4 +55,10 @@ env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | - bash <(curl -s https://codecov.io/bash) + curl -s https://codecov.io/bash > codecov + curl -s https://raw.githubusercontent.com/codecov/codecov-bash/master/SHA256SUM > codecov.sha256 + if ! sha256sum -c --ignore-missing --status codecov.sha256 ; then + echo "Download checksum verification failed" + exit 1 + fi + bash < codecov diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/.github/workflows/windows.yml new/vis-0.8/.github/workflows/windows.yml --- old/vis-0.7/.github/workflows/windows.yml 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/.github/workflows/windows.yml 2022-11-01 14:50:10.000000000 +0100 @@ -54,4 +54,11 @@ shell: bash env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: bash <(curl -s https://codecov.io/bash) + run: | + curl -s https://codecov.io/bash > codecov + curl -s https://raw.githubusercontent.com/codecov/codecov-bash/master/SHA256SUM > codecov.sha256 + if ! sha256sum -c --ignore-missing --status codecov.sha256 ; then + echo "Download checksum verification failed" + exit 1 + fi + bash < codecov diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/.gitignore new/vis-0.8/.gitignore --- old/vis-0.7/.gitignore 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/.gitignore 2022-11-01 14:50:10.000000000 +0100 @@ -12,5 +12,3 @@ *.gcov *.html *.o -*.swo -*.swp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/Dockerfile new/vis-0.8/Dockerfile --- old/vis-0.7/Dockerfile 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/Dockerfile 2022-11-01 14:50:10.000000000 +0100 @@ -1,5 +1,5 @@ # Run 'make docker' to build a statically linked vis executable! -FROM i386/alpine:3.12 +FROM i386/alpine:3.13 RUN apk update && apk add --upgrade --no-cache \ acl-dev \ acl-static \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/Makefile new/vis-0.8/Makefile --- old/vis-0.7/Makefile 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/Makefile 2022-11-01 14:50:10.000000000 +0100 @@ -35,7 +35,7 @@ DOCUMENTATION = LICENSE README.md -VERSION = v0.7 +VERSION = 0.8 CONFIG_HELP ?= 1 CONFIG_CURSES ?= 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/README.md new/vis-0.8/README.md --- old/vis-0.7/README.md 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/README.md 2022-11-01 14:50:10.000000000 +0100 @@ -4,7 +4,7 @@ [](https://scan.coverity.com/projects/3939) [](https://codecov.io/gh/martanne/vis) [](http://vis.readthedocs.io/en/master/?badge=master) -[](irc://irc.freenode.net/vis-editor) +[](ircs://irc.libera.chat:6697/vis-editor) Vis aims to be a modern, legacy-free, simple yet efficient editor, combining the strengths of both vi(m) and sam. @@ -60,8 +60,8 @@ $ ./configure && make && sudo make install By default the `configure` script will try to auto detect support for -Lua. See `configure --help` for a list of supported options. You can -also manually tweak the generated `config.mk` file. +Lua using `pkg-config(1)`. See `configure --help` for a list of supported +options. You can also manually tweak the generated `config.mk` file. Or simply use one of the [distribution provided packages](https://github.com/martanne/vis/wiki/Distribution-Packages). @@ -127,4 +127,4 @@ Checkout the [Developer Overview](https://github.com/martanne/vis/wiki/Developer-Overview) to get started and do not hesitate to ask question in the `#vis-editor` -IRC channel on freenode. +IRC channel on libera ([join via your browser](https://web.libera.chat/#vis-editor)). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/array.h new/vis-0.8/array.h --- old/vis-0.7/array.h 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/array.h 2022-11-01 14:50:10.000000000 +0100 @@ -100,7 +100,7 @@ * Change length. * @rst * .. note:: Has to be less or equal than the capacity. - * Newly accesible elements preserve their previous values. + * Newly accessible elements preserve their previous values. * @endrst */ bool array_resize(Array*, size_t length); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/buffer.h new/vis-0.8/buffer.h --- old/vis-0.7/buffer.h 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/buffer.h 2022-11-01 14:50:10.000000000 +0100 @@ -44,11 +44,11 @@ bool buffer_insert0(Buffer*, size_t pos, const char *data); /** Append further content to the end. */ bool buffer_append(Buffer*, const void *data, size_t len); -/** Append NUl-terminated data. */ +/** Append NUL-terminated data. */ bool buffer_append0(Buffer*, const char *data); -/** Insert ``len`` bytes of ``data`` at the begin. */ +/** Insert ``len`` bytes of ``data`` at the start. */ bool buffer_prepend(Buffer*, const void *data, size_t len); -/** Insert NUL-terminated data at the begin. */ +/** Insert NUL-terminated data at the start. */ bool buffer_prepend0(Buffer*, const char *data); /** Set formatted buffer content, ensures NUL termination on success. */ bool buffer_printf(Buffer*, const char *fmt, ...) __attribute__((format(printf, 2, 3))); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/config.def.h new/vis-0.8/config.def.h --- old/vis-0.7/config.def.h 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/config.def.h 2022-11-01 14:50:10.000000000 +0100 @@ -49,8 +49,8 @@ { "b", ACTION(CURSOR_WORD_START_PREV) }, { "E", ACTION(CURSOR_LONGWORD_END_NEXT) }, { "e", ACTION(CURSOR_WORD_END_NEXT) }, - { "F", ACTION(TO_LEFT) }, - { "f", ACTION(TO_RIGHT) }, + { "F", ACTION(TO_LINE_LEFT) }, + { "f", ACTION(TO_LINE_RIGHT) }, { "go", ACTION(CURSOR_BYTE) }, { "gH", ACTION(CURSOR_BYTE_LEFT) }, { "gL", ACTION(CURSOR_BYTE_RIGHT) }, @@ -75,8 +75,8 @@ { "M", ACTION(CURSOR_WINDOW_LINE_MIDDLE) }, { "n", ACTION(CURSOR_SEARCH_REPEAT_FORWARD) }, { "N", ACTION(CURSOR_SEARCH_REPEAT_BACKWARD) }, - { "T", ACTION(TILL_LEFT) }, - { "t", ACTION(TILL_RIGHT) }, + { "T", ACTION(TILL_LINE_LEFT) }, + { "t", ACTION(TILL_LINE_RIGHT) }, { "W", ACTION(CURSOR_LONGWORD_START_NEXT) }, { "w", ACTION(CURSOR_WORD_START_NEXT) }, { 0 /* empty last element, array terminator */ }, @@ -285,6 +285,8 @@ { "<C-u>", ACTION(DELETE_LINE_BEGIN) }, { "<C-v>", ACTION(INSERT_VERBATIM) }, { "<C-w>", ACTION(DELETE_WORD_PREV) }, + { "<C-e>", ACTION(CURSOR_LINE_END) }, + { "<C-a>", ACTION(CURSOR_LINE_START) }, { "<Delete>", ACTION(DELETE_CHAR_NEXT) }, { "<Escape>", ACTION(MODE_NORMAL) }, { 0 /* empty last element, array terminator */ }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/configure new/vis-0.8/configure --- old/vis-0.7/configure 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/configure 2022-11-01 14:50:10.000000000 +0100 @@ -443,7 +443,7 @@ } EOF - for liblua in lua lua5.3 lua5.2 lua-5.3 lua-5.2 lua53 lua52; do + for liblua in lua lua5.4 lua5.3 lua5.2 lua-5.3 lua-5.2 lua54 lua53 lua52; do printf " checking for %s... " "$liblua" if test "$have_pkgconfig" = "yes" ; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/doc/Doxyfile new/vis-0.8/doc/Doxyfile --- old/vis-0.7/doc/Doxyfile 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/doc/Doxyfile 2022-11-01 14:50:10.000000000 +0100 @@ -38,7 +38,7 @@ # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.7 +PROJECT_NUMBER = 0.8 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/doc/conf.py new/vis-0.8/doc/conf.py --- old/vis-0.7/doc/conf.py 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/doc/conf.py 2022-11-01 14:50:10.000000000 +0100 @@ -67,9 +67,9 @@ # built documents. # # The short X.Y version. -version = '0.7' +version = '0.8' # The full version, including alpha/beta/rc tags. -release = '0.7' +release = '0.8' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/lua/lexers/bash.lua new/vis-0.8/lua/lexers/bash.lua --- old/vis-0.7/lua/lexers/bash.lua 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/lua/lexers/bash.lua 2022-11-01 14:50:10.000000000 +0100 @@ -20,15 +20,15 @@ local heredoc = '<<' * P(function(input, index) local s, e, minus, _, delimiter = input:find('(-?)(["\']?)([%a_][%w_]*)%2[\n\r\f;]+', index) - -- If the starting delimiter of a here-doc begins with "-", then - -- spaces are allowed to come before the closing delimiter. - local close_pattern - if minus == '-' then - close_pattern = '[\n\r\f%s]+'..delimiter..'\n' - else - close_pattern = '[\n\r\f]+'..delimiter..'\n' - end if s == index and delimiter then + -- If the starting delimiter of a here-doc begins with "-", then + -- spaces are allowed to come before the closing delimiter. + local close_pattern + if minus == '-' then + close_pattern = '[\n\r\f%s]+'..delimiter..'\n' + else + close_pattern = '[\n\r\f]+'..delimiter..'\n' + end local _, e = input:find(close_pattern, e) return e and e + 1 or #input + 1 end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/lua/lexers/git-rebase.lua new/vis-0.8/lua/lexers/git-rebase.lua --- old/vis-0.7/lua/lexers/git-rebase.lua 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/lua/lexers/git-rebase.lua 2022-11-01 14:50:10.000000000 +0100 @@ -1,4 +1,4 @@ --- Copyright 2017 Marc Andr?? Tanner +-- Copyright 2017-2021 Marc Andr?? Tanner -- git-rebase(1) LPeg lexer. local l = require('lexer') @@ -22,6 +22,7 @@ 'f', 'fixup', 'x', 'exec', 'd', 'drop', + 'b', 'break', 'l', 'label', 't', 'reset', 'm', 'merge', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/lua/lexers/strace.lua new/vis-0.8/lua/lexers/strace.lua --- old/vis-0.7/lua/lexers/strace.lua 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/lua/lexers/strace.lua 2022-11-01 14:50:10.000000000 +0100 @@ -1,9 +1,9 @@ --- Copyright 2017 Marc Andr?? Tanner. See LICENSE. +-- Copyright 2017-2021 Marc Andr?? Tanner. See LICENSE. -- strace(1) output lexer local l = require('lexer') local token, word_match = l.token, l.word_match -local S = lpeg.S +local S, B = lpeg.S, lpeg.B local M = {_NAME = 'strace'} @@ -13,16 +13,18 @@ local constant = token(l.CONSTANT, (l.upper + '_') * (l.upper + l.digit + '_')^0) local syscall = token(l.KEYWORD, l.starts_line(l.word)) local operator = token(l.OPERATOR, S('+-/*%<>~!=^&|?~:;,.()[]{}')) -local comment = token(l.COMMENT, l.nested_pair('/*', '*/') + ('(' * (l.alpha + ' ')^1 * ')\n')) -local result = token(l.TYPE, '= ' * l.integer) +local comment = token(l.COMMENT, l.nested_pair('/*', '*/') + (l.delimited_range('()') * l.newline)) +local result = token(l.TYPE, B(' = ') * l.integer) +local identifier = token(l.IDENTIFIER, l.word) M._rules = { {'whitespace', ws}, - {'keyword', syscall}, + {'syscall', syscall}, {'constant', constant}, {'string', string}, {'comment', comment}, - {'type', result}, + {'result', result}, + {'identifier', identifier}, {'number', number}, {'operator', operator}, } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/lua/plugins/complete-filename.lua new/vis-0.8/lua/plugins/complete-filename.lua --- old/vis-0.7/lua/plugins/complete-filename.lua 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/lua/plugins/complete-filename.lua 2022-11-01 14:50:10.000000000 +0100 @@ -13,7 +13,7 @@ local prefix = file:content(range) if not prefix then return end -- Strip leading delimiters for some languages - i, j = string.find(prefix, "[[(<'\"]+") + local _, j = string.find(prefix, "[[(<'\"]+") if j then prefix = prefix:sub(j + 1) end local cmd = string.format("vis-complete --file '%s'", prefix:gsub("'", "'\\''")) local status, out, err = vis:pipe(file, { start = 0, finish = 0 }, cmd) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/lua/plugins/filetype.lua new/vis-0.8/lua/plugins/filetype.lua --- old/vis-0.7/lua/plugins/filetype.lua 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/lua/plugins/filetype.lua 2022-11-01 14:50:10.000000000 +0100 @@ -40,7 +40,7 @@ ext = { "%.awk$" }, }, bash = { - ext = { "%.bash$", "%.csh$", "%.sh$", "%.zsh$" }, + ext = { "%.bash$", "%.csh$", "%.sh$", "%.zsh$" ,"^APKBUILD$", "%.ebuild$"}, mime = { "text/x-shellscript", "application/x-shellscript" }, }, batch = { @@ -176,7 +176,7 @@ ext = { "%.go$" }, }, groovy = { - ext = { "%.groovy$", "%.gvy$" }, + ext = { "%.groovy$", "%.gvy$", "^Jenkinsfile$" }, }, gtkrc = { ext = { "%.gtkrc$" }, @@ -250,6 +250,9 @@ makefile = { ext = { "%.iface$", "%.mak$", "%.mk$", "GNUmakefile", "makefile", "Makefile" }, mime = { "text/x-makefile" }, + detect = function(_, data) + return data:match("^#!/usr/bin/make") + end }, man = { ext = { @@ -352,7 +355,7 @@ }, routeros = { ext = { "%.rsc" }, - detect = function(file, data) + detect = function(_, data) return data:match("^#.* by RouterOS") end }, @@ -394,7 +397,7 @@ ext = { "%.ddl$", "%.sql$" }, }, strace = { - detect = function(file, data) + detect = function(_, data) return data:match("^execve%(") end }, @@ -436,7 +439,7 @@ ext = { "%.vcf$", "%.vcard$" }, }, verilog = { - ext = { "%.v$", "%.ver$" }, + ext = { "%.v$", "%.ver$", "%.sv$" }, }, vhdl = { ext = { "%.vh$", "%.vhd$", "%.vhdl$" }, @@ -501,10 +504,11 @@ end -- run file(1) to determine mime type + local mime if name ~= nil then local file = io.popen(string.format("file -bL --mime-type -- '%s'", name:gsub("'", "'\\''"))) if file then - local mime = file:read('*all') + mime = file:read('*all') file:close() if mime then mime = mime:gsub('%s*$', '') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/lua/vis.lua new/vis-0.8/lua/vis.lua --- old/vis-0.7/lua/vis.lua 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/lua/vis.lua 2022-11-01 14:50:10.000000000 +0100 @@ -103,7 +103,7 @@ -- Checks whether a subsequent @{require} call will succeed. -- @tparam string name the module name to check -- @treturn bool whether the module was found -vis.module_exist = function(vis, name) +vis.module_exist = function(_, name) for _, searcher in ipairs(package.searchers or package.loaders) do local loader = searcher(name) if type(loader) == 'function' then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/main.c new/vis-0.8/main.c --- old/vis-0.7/main.c 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/main.c 2022-11-01 14:50:10.000000000 +0100 @@ -94,7 +94,7 @@ /* make the current action use the operator indicated by arg->i */ static const char *operator(Vis*, const char *keys, const Arg *arg); /* blocks to read a key and performs movement indicated by arg->i which - * should be one of VIS_MOVE_{RIGHT,LEFT}_{TO,TILL} */ + * should be one of VIS_MOVE_{TO,TILL}_{,LINE}_{RIGHT,LEFT}*/ static const char *movement_key(Vis*, const char *keys, const Arg *arg); /* perform the movement as indicated by arg->i */ static const char *movement(Vis*, const char *keys, const Arg *arg); @@ -222,8 +222,12 @@ VIS_ACTION_PROMPT_SEARCH_BACKWARD, VIS_ACTION_TILL_LEFT, VIS_ACTION_TILL_RIGHT, + VIS_ACTION_TILL_LINE_LEFT, + VIS_ACTION_TILL_LINE_RIGHT, VIS_ACTION_TO_LEFT, VIS_ACTION_TO_RIGHT, + VIS_ACTION_TO_LINE_LEFT, + VIS_ACTION_TO_LINE_RIGHT, VIS_ACTION_REGISTER, VIS_ACTION_OPERATOR_CHANGE, VIS_ACTION_OPERATOR_DELETE, @@ -721,22 +725,42 @@ [VIS_ACTION_TILL_LEFT] = { "vis-motion-till-left", VIS_HELP("Till after the occurrence of character to the left") - movement_key, { .i = VIS_MOVE_LEFT_TILL } + movement_key, { .i = VIS_MOVE_TILL_LEFT } }, [VIS_ACTION_TILL_RIGHT] = { "vis-motion-till-right", VIS_HELP("Till before the occurrence of character to the right") - movement_key, { .i = VIS_MOVE_RIGHT_TILL } + movement_key, { .i = VIS_MOVE_TILL_RIGHT } + }, + [VIS_ACTION_TILL_LINE_LEFT] = { + "vis-motion-till-line-left", + VIS_HELP("Till after the occurrence of character to the left on the current line") + movement_key, { .i = VIS_MOVE_TILL_LINE_LEFT } + }, + [VIS_ACTION_TILL_LINE_RIGHT] = { + "vis-motion-till-line-right", + VIS_HELP("Till before the occurrence of character to the right on the current line") + movement_key, { .i = VIS_MOVE_TILL_LINE_RIGHT } }, [VIS_ACTION_TO_LEFT] = { "vis-motion-to-left", VIS_HELP("To the first occurrence of character to the left") - movement_key, { .i = VIS_MOVE_LEFT_TO } + movement_key, { .i = VIS_MOVE_TO_LEFT } }, [VIS_ACTION_TO_RIGHT] = { "vis-motion-to-right", VIS_HELP("To the first occurrence of character to the right") - movement_key, { .i = VIS_MOVE_RIGHT_TO } + movement_key, { .i = VIS_MOVE_TO_RIGHT } + }, + [VIS_ACTION_TO_LINE_LEFT] = { + "vis-motion-to-line-left", + VIS_HELP("To the first occurrence of character to the left on the current line") + movement_key, { .i = VIS_MOVE_TO_LINE_LEFT } + }, + [VIS_ACTION_TO_LINE_RIGHT] = { + "vis-motion-to-line-right", + VIS_HELP("To the first occurrence of character to the right on the current line") + movement_key, { .i = VIS_MOVE_TO_LINE_RIGHT } }, [VIS_ACTION_REGISTER] = { "vis-register", @@ -2071,7 +2095,7 @@ vis_motion(vis, VIS_MOVE_LINE_BEGIN); vis_keys_feed(vis, "<vis-motion-line-begin>"); } - vis_keys_feed(vis, "<Enter><Up>"); + vis_keys_feed(vis, "<Enter><vis-motion-line-up>"); } return keys; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/sam.c new/vis-0.8/sam.c --- old/vis-0.7/sam.c 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/sam.c 2022-11-01 14:50:10.000000000 +0100 @@ -145,7 +145,7 @@ static const CommandDef cmds[] = { // name help - // flags, default command, implemenation + // flags, default command, implementation { "a", VIS_HELP("Append text after range") CMD_TEXT, NULL, cmd_append @@ -278,7 +278,7 @@ const char *names[3]; /* name and optional alias */ enum VisOption flags; /* option type, etc. */ VIS_HELP_DECL(const char *help;) /* short, one line help text */ - VisOptionFunction *func; /* option handler, NULL for bulitins */ + VisOptionFunction *func; /* option handler, NULL for builtins */ void *context; /* context passed to option handler function */ } OptionDef; @@ -1393,14 +1393,13 @@ Text *txt = win->file->text; if (cmd->regex) { - bool trailing_match = false; - size_t start = range->start, end = range->end, last_start = EPOS; + size_t start = range->start, end = range->end; + size_t last_start = argv[0][0] == 'x' ? EPOS : start; size_t nsub = 1 + text_regex_nsub(cmd->regex); if (nsub > MAX_REGEX_SUB) nsub = MAX_REGEX_SUB; RegexMatch match[MAX_REGEX_SUB]; - while (start < end || trailing_match) { - trailing_match = false; + while (start <= end) { char c; int flags = start > range->start && text_byte_get(txt, start - 1, &c) && c != '\n' ? @@ -1413,7 +1412,7 @@ if (argv[0][0] == 'x') r = text_range_new(match[0].start, match[0].end); else - r = text_range_new(start, match[0].start); + r = text_range_new(last_start, match[0].start); if (match[0].start == match[0].end) { if (last_start == match[0].start) { start++; @@ -1424,16 +1423,17 @@ * matches the zero-length string immediately after a * newline. Try filtering out the last such match at EOF. */ - if (end == match[0].start && start > range->start) + if (end == match[0].start && start > range->start && + text_byte_get(txt, end-1, &c) && c == '\n') break; + start = match[0].end + 1; + } else { + start = match[0].end; } - start = match[0].end; - if (start == end) - trailing_match = true; } else { if (argv[0][0] == 'y') r = text_range_new(start, end); - start = end; + start = end + 1; } if (text_range_valid(&r)) { @@ -1442,12 +1442,14 @@ Register *reg = &vis->registers[VIS_REG_AMPERSAND+i]; register_put_range(vis, reg, txt, &match[i]); } + last_start = match[0].end; + } else { + last_start = start; } if (simulate) count++; else ret &= sam_execute(vis, win, cmd->cmd, NULL, &r); - last_start = start; } } } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/text-io.c new/vis-0.8/text-io.c --- old/vis-0.7/text-io.c 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/text-io.c 2022-11-01 14:50:10.000000000 +0100 @@ -33,7 +33,7 @@ #define BLOCK_SIZE (1 << 20) #endif /* Files smaller than this value are copied on load, larger ones are mmap(2)-ed - * directely. Hence the former can be truncated, while doing so on the latter + * directly. Hence the former can be truncated, while doing so on the latter * results in havoc. */ #define BLOCK_MMAP_SIZE (1 << 26) @@ -261,7 +261,7 @@ * - file ownership can not be preserved * - file group can not be preserved * - directory permissions do not allow creation of a new file - * - POSXI ACL can not be preserved (if enabled) + * - POSIX ACL can not be preserved (if enabled) * - SELinux security context can not be preserved (if enabled) */ static bool text_save_begin_atomic(TextSave *ctx) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/text-motions.h new/vis-0.8/text-motions.h --- old/vis-0.7/text-motions.h 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/text-motions.h 2022-11-01 14:50:10.000000000 +0100 @@ -1,8 +1,8 @@ #ifndef TEXT_MOTIONS_H #define TEXT_MOTIONS_H -/* these function all take a position in bytes from the start of the file, - * perform a certain movement and return the new postion. if the movement +/* these functions all take a position in bytes from the start of the file, + * perform a certain movement and return the new postion. If the movement * is not possible the original position is returned unchanged. */ #include <stddef.h> @@ -20,7 +20,7 @@ size_t text_codepoint_prev(Text*, size_t pos); /* find the given substring either in forward or backward direction. - * does not wrap around at file start / end. if no match is found return + * does not wrap around at file start / end. If no match is found return * original position */ size_t text_find_next(Text*, size_t pos, const char *s); size_t text_find_prev(Text*, size_t pos, const char *s); @@ -69,7 +69,7 @@ /* * A longword consists of a sequence of non-blank characters, separated with * white space. TODO?: An empty line is also considered to be a word. - * This is equivalant to a WORD in vim terminology. + * This is equivalent to a WORD in vim terminology. */ size_t text_longword_end_next(Text*, size_t pos); size_t text_longword_end_prev(Text*, size_t pos); @@ -79,7 +79,7 @@ * A word consists of a sequence of letters, digits and underscores, or a * sequence of other non-blank characters, separated with white space. * TODO?: An empty line is also considered to be a word. - * This is equivalant to a word (lowercase) in vim terminology. + * This is equivalent to a word (lowercase) in vim terminology. */ size_t text_word_end_next(Text*, size_t pos); size_t text_word_end_prev(Text*, size_t pos); @@ -116,13 +116,13 @@ size_t text_block_end(Text*, size_t pos); size_t text_parenthesis_start(Text*, size_t pos); size_t text_parenthesis_end(Text*, size_t pos); -/* search coresponding '(', ')', '{', '}', '[', ']', '>', '<', '"', ''' */ +/* search corresponding '(', ')', '{', '}', '[', ']', '>', '<', '"', ''' */ size_t text_bracket_match(Text*, size_t pos, const Filerange *limits); /* same as above but explicitly specify symbols to match */ size_t text_bracket_match_symbol(Text*, size_t pos, const char *symbols, const Filerange *limits); /* search the given regex pattern in either forward or backward direction, - * starting from pos. does wrap around if no match was found. */ + * starting from pos. Does wrap around if no match was found. */ size_t text_search_forward(Text *txt, size_t pos, Regex *regex); size_t text_search_backward(Text *txt, size_t pos, Regex *regex); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/text-objects.h new/vis-0.8/text-objects.h --- old/vis-0.7/text-objects.h 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/text-objects.h 2022-11-01 14:50:10.000000000 +0100 @@ -1,8 +1,8 @@ #ifndef TEXT_OBJECTS_H #define TEXT_OBJECTS_H -/* these functions all take a file position. if this position is part of the - * respective text-object, a corresponding range is returned. if there is no +/* these functions all take a file position. If this position is part of the + * respective text-object, a corresponding range is returned. If there is no * such text-object at the given location, an empty range is returned. */ @@ -13,13 +13,13 @@ Filerange text_object_entire(Text*, size_t pos); /* word which happens to be at pos without any neighbouring white spaces */ Filerange text_object_word(Text*, size_t pos); -/* includes trailing white spaces. if at pos happens to be a white space +/* includes trailing white spaces. If at pos happens to be a white space * include all neighbouring leading white spaces and the following word. */ Filerange text_object_word_outer(Text*, size_t pos); -/* find next occurance of `word' (as word not substring) in forward/backward direction */ +/* find next occurence of `word' (as word not substring) in forward/backward direction */ Filerange text_object_word_find_next(Text*, size_t pos, const char *word); Filerange text_object_word_find_prev(Text*, size_t pos, const char *word); -/* find next occurance of a literal string (not regex) in forward/backward direction */ +/* find next occurence of a literal string (not regex) in forward/backward direction */ Filerange text_object_find_next(Text *txt, size_t pos, const char *search); Filerange text_object_find_prev(Text *txt, size_t pos, const char *search); /* same semantics as above but for a longword (i.e. delimited by white spaces) */ @@ -44,7 +44,7 @@ /* match a search term in either forward or backward direction */ Filerange text_object_search_forward(Text*, size_t pos, Regex*); Filerange text_object_search_backward(Text*, size_t pos, Regex*); -/* match all lines with same indendation level than the current one */ +/* match all lines with same indentation level as the current one */ Filerange text_object_indentation(Text*, size_t pos); /* extend a range to cover whole lines */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/text.c new/vis-0.8/text.c --- old/vis-0.7/text.c 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/text.c 2022-11-01 14:50:10.000000000 +0100 @@ -24,7 +24,7 @@ * All active pieces chained together form the whole content of the document. * At the beginning there exists only one piece, spanning the whole document. * Upon insertion/deletion new pieces will be created to represent the changes. - * Generally pieces are never destroyed, but kept around to peform undo/redo + * Generally pieces are never destroyed, but kept around to perform undo/redo * operations. */ struct Piece { @@ -123,7 +123,7 @@ static size_t lines_skip_forward(Text *txt, size_t pos, size_t lines, size_t *lines_skiped); static size_t lines_count(Text *txt, size_t pos, size_t len); -/* stores the given data in a block, allocates a new one if necessary. returns +/* stores the given data in a block, allocates a new one if necessary. Returns * a pointer to the storage location or NULL if allocation failed. */ static const char *block_store(Text *txt, const char *data, size_t len) { Block *blk = array_get_ptr(&txt->blocks, array_length(&txt->blocks)-1); @@ -167,8 +167,8 @@ return found && p->data + p->len == blk->data + blk->len; } -/* try to insert a chunk of data at a given piece offset. the insertion is only - * performed if the piece is the most recenetly changed one. the legnth of the +/* try to insert a chunk of data at a given piece offset. The insertion is only + * performed if the piece is the most recently changed one. The length of the * piece, the span containing it and the whole text is adjusted accordingly */ static bool cache_insert(Text *txt, Piece *p, size_t off, const char *data, size_t len) { if (!cache_contains(txt, p)) @@ -183,9 +183,9 @@ return true; } -/* try to delete a chunk of data at a given piece offset. the deletion is only - * performed if the piece is the most recenetly changed one and the whole - * affected range lies within it. the legnth of the piece, the span containing it +/* try to delete a chunk of data at a given piece offset. The deletion is only + * performed if the piece is the most recently changed one and the whole + * affected range lies within it. The length of the piece, the span containing it * and the whole text is adjusted accordingly */ static bool cache_delete(Text *txt, Piece *p, size_t off, size_t len) { if (!cache_contains(txt, p)) @@ -316,9 +316,9 @@ p->len = len; } -/* returns the piece holding the text at byte offset pos. if pos happens to - * be at a piece boundry i.e. the first byte of a piece then the previous piece - * to the left is returned with an offset of piece->len. this is convenient for +/* returns the piece holding the text at byte offset pos. If pos happens to + * be at a piece boundary i.e. the first byte of a piece then the previous piece + * to the left is returned with an offset of piece->len. This is convenient for * modifications to the piece chain where both pieces (the returned one and the * one following it) are needed, but unsuitable as a public interface. * @@ -335,8 +335,8 @@ return (Location){ 0 }; } -/* similiar to piece_get_intern but usable as a public API. returns the piece - * holding the text at byte offset pos. never returns a sentinel piece. +/* similiar to piece_get_intern but usable as a public API. Returns the piece + * holding the text at byte offset pos. Never returns a sentinel piece. * it pos is the end of file (== text_size()) and the file is not empty then * the last piece holding data is returned. */ @@ -447,8 +447,8 @@ span_init(&c->new, new, new); span_init(&c->old, NULL, NULL); } else { - /* insert into middle of an existing piece, therfore split the old - * piece. that is we have 3 new pieces one containing the content + /* insert into middle of an existing piece, therefore split the old + * piece. That is we have 3 new pieces one containing the content * before the insertion point then one holding the newly inserted * text and one holding the content after the insertion point. */ @@ -644,7 +644,7 @@ } /* A delete operation can either start/stop midway through a piece or at - * a boundry. In the former case a new piece is created to represent the + * a boundary. In the former case a new piece is created to represent the * remaining text before/after the modification point. * * /-+ --> +---------+ --> +-----+ --> +-----+ --> +-\ @@ -683,7 +683,7 @@ size_t cur; /* how much has already been deleted */ if (off == p->len) { - /* deletion starts at a piece boundry */ + /* deletion starts at a piece boundary */ cur = 0; before = p; start = p->next; @@ -704,7 +704,7 @@ } if (cur == len) { - /* deletion stops at a piece boundry */ + /* deletion stops at a piece boundary */ end = p; after = p->next; } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/text.h new/vis-0.8/text.h --- old/vis-0.7/text.h 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/text.h 2022-11-01 14:50:10.000000000 +0100 @@ -75,13 +75,13 @@ */ TEXT_LOAD_READ, /** - * Memory map the the file from disk. Use file system / virtual memory + * Memory map the file from disk. Use file system / virtual memory * subsystem as a caching layer. * @rst * .. note:: Load time is (almost) independent of the file size. * .. warning:: Inplace modifications of the underlying file * will be reflected in the current text content. - * In particular, truncatenation will raise ``SIGBUS`` + * In particular, truncation will raise ``SIGBUS`` * and result in data loss. * @endrst */ @@ -111,7 +111,7 @@ */ Text *text_load_method(const char *filename, enum TextLoadMethod); Text *text_loadat_method(int dirfd, const char *filename, enum TextLoadMethod); -/** Release all ressources associated with this text instance. */ +/** Release all resources associated with this text instance. */ void text_free(Text*); /** * @} @@ -164,7 +164,7 @@ * @{ */ /** - * Create a text snapshot, that is a vertice in the history graph. + * Create a text snapshot, that is a vertex in the history graph. */ bool text_snapshot(Text*); /** @@ -237,7 +237,7 @@ * Fetch text range into newly allocate memory region. * @param pos The absolute starting position. * @param len The length in bytes. - * @return A contigious NUL terminated buffer holding the requested range, or + * @return A contiguous NUL terminated buffer holding the requested range, or * ``NULL`` in error case. * @rst * .. warning:: The returned pointer must be freed by the caller. @@ -329,7 +329,7 @@ * - File ownership can not be preserved. * - File group can not be preserved. * - Directory permissions do not allow creation of a new file. - * - POSXI ACL can not be preserved (if enabled). + * - POSIX ACL can not be preserved (if enabled). * - SELinux security context can not be preserved (if enabled). * @endrst */ @@ -362,7 +362,7 @@ * Setup a sequence of write operations. * * The returned ``TextSave`` pointer can be used to write multiple, possibly - * non-contigious, file ranges. + * non-contiguous, file ranges. * @rst * .. warning:: For every call to ``text_save_begin`` there must be exactly * one matching call to either ``text_save_commit`` or diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/ui.h new/vis-0.8/ui.h --- old/vis-0.7/ui.h 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/ui.h 2022-11-01 14:50:10.000000000 +0100 @@ -7,7 +7,7 @@ /* enable large file optimization for files larger than: */ #define UI_LARGE_FILE_SIZE (1 << 25) -/* enable large file optimization fo files containing lines longer than: */ +/* enable large file optimization for files containing lines longer than: */ #define UI_LARGE_FILE_LINE_SIZE (1 << 16) typedef struct Ui Ui; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/view.c new/vis-0.8/view.c --- old/vis-0.7/view.c 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/view.c 2022-11-01 14:50:10.000000000 +0100 @@ -358,7 +358,7 @@ cell = (Cell){ .data = "\xEF\xBF\xBD", .len = len, .width = 1 }; } else if (len == (size_t)-2) { /* not enough bytes available to convert to a - * wide character. advance file position and read + * wide character. Advance file position and read * another junk into buffer. */ rem = text_bytes_get(view->text, pos+prev_cell.len, size, text); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/view.h new/vis-0.8/view.h --- old/vis-0.7/view.h 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/view.h 2022-11-01 14:50:10.000000000 +0100 @@ -58,11 +58,11 @@ * @param pos The position to query. * @param line Will be updated with screen line on which ``pos`` resides. * @param row Will be updaded with zero based window row on which ``pos`` resides. - * @param col Will be updated with zero based window column which ``pos`` resides. + * @param col Will be updated with zero based window column on which ``pos`` resides. * @return Whether ``pos`` is visible. If not, the pointer arguments are left unmodified. */ bool view_coord_get(View*, size_t pos, Line **line, int *row, int *col); -/** Get position at the start ot the ``n``-th window line, counting from 1. */ +/** Get position at the start of the ``n``-th window line, counting from 1. */ size_t view_screenline_goto(View*, int n); /** Get first screen line. */ Line *view_lines_first(View*); @@ -122,7 +122,7 @@ /** * Dispose an existing selection. * @rst - * .. warning:: Not applicaple for the last existing selection. + * .. warning:: Not applicable for the last existing selection. * @endrst */ bool view_selections_dispose(Selection*); @@ -138,7 +138,7 @@ * Query state of primary selection. * * If the primary selection was marked for destruction, return it and - * clear descruction flag. + * clear destruction flag. */ Selection *view_selection_disposed(View*); /** Dispose all but the primary selection. */ @@ -324,7 +324,7 @@ */ /** * Move primary selection cursor to the given position. - * Makes sure that position is visisble. + * Makes sure that position is visible. * @rst * .. note:: If position was not visible before, we attempt to show * surrounding context. The viewport will be adjusted such diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/vis-core.h new/vis-0.8/vis-core.h --- old/vis-0.7/vis-core.h 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/vis-core.h 2022-11-01 14:50:10.000000000 +0100 @@ -14,7 +14,7 @@ /* a mode contains a set of key bindings which are currently valid. * - * each mode can specify one parent mode which is consultated if a given key + * each mode can specify one parent mode which is consulted if a given key * is not found in the current mode. hence the modes form a tree which is * searched from the current mode up towards the root mode until a valid binding * is found. @@ -63,13 +63,13 @@ }; typedef struct { - /* operator logic, returns new cursor position, if EPOS is + /* operator logic, returns new cursor position, if EPOS * the cursor is disposed (except if it is the primary one) */ VisOperatorFunction *func; void *context; } Operator; -typedef struct { /* Motion implementation, takes a cursor postion and returns a new one */ +typedef struct { /* Motion implementation, takes a cursor position and returns a new one */ /* TODO: merge types / use union to save space */ size_t (*cur)(Selection*); size_t (*txt)(Text*, size_t pos); @@ -154,7 +154,7 @@ }; struct Win { - Vis *vis; /* editor instance to which this window belongs to */ + Vis *vis; /* editor instance to which this window belongs */ UiWin *ui; /* ui object handling visual appearance of this window */ File *file; /* file being displayed in this window */ View *view; /* currently displayed part of underlying text */ @@ -167,7 +167,7 @@ }; struct Vis { - Ui *ui; /* user interface repsonsible for visual appearance */ + Ui *ui; /* user interface responsible for visual appearance */ File *files; /* all files currently managed by this editor instance */ File *command_file; /* special internal file used to store :-command prompt */ File *search_file; /* special internal file used to store /,? search prompt */ @@ -201,20 +201,20 @@ Action action; /* current action which is in progress */ Action action_prev; /* last operator action used by the repeat (dot) command */ Mode *mode; /* currently active mode, used to search for keybindings */ - Mode *mode_prev; /* previsouly active user mode */ + Mode *mode_prev; /* previously active user mode */ bool initialized; /* whether UI and Lua integration has been initialized */ int nesting_level; /* parsing state to hold keep track of { } nesting level */ volatile bool running; /* exit main loop once this becomes false */ int exit_status; /* exit status when terminating main loop */ volatile sig_atomic_t interrupted; /* abort command (SIGINT occured) */ - volatile sig_atomic_t sigbus; /* one of the memory mapped region became unavailable (SIGBUS) */ + volatile sig_atomic_t sigbus; /* one of the memory mapped regions became unavailable (SIGBUS) */ volatile sig_atomic_t need_resize; /* need to resize UI (SIGWINCH occured) */ volatile sig_atomic_t resume; /* need to resume UI (SIGCONT occured) */ volatile sig_atomic_t terminate; /* need to terminate we were being killed by SIGTERM */ sigjmp_buf sigbus_jmpbuf; /* used to jump back to a known good state in the mainloop after (SIGBUS) */ Map *actions; /* registered editor actions / special keys commands */ Array actions_user; /* dynamically allocated editor actions */ - lua_State *lua; /* lua context used for syntax highligthing */ + lua_State *lua; /* lua context used for syntax highlighting */ enum TextLoadMethod load_method; /* how existing files should be loaded */ VisEvent *event; Array operators; @@ -248,7 +248,7 @@ typedef MarkDef RegisterDef; -/** stuff used by multiple of the vis-* files */ +/** stuff used by several of the vis-* files */ extern Mode vis_modes[VIS_MODE_INVALID]; extern const Movement vis_motions[VIS_MOVE_INVALID]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/vis-lua.c new/vis-0.8/vis-lua.c --- old/vis-0.7/vis-lua.c 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/vis-lua.c 2022-11-01 14:50:10.000000000 +0100 @@ -331,7 +331,7 @@ lua_getfield(L, LUA_REGISTRYINDEX, "vis.types"); lua_getmetatable(L, -2); lua_gettable(L, -2); - // XXX: in theory string might become invalid when poped from stack + // XXX: in theory string might become invalid when popped from stack const char *type = lua_tostring(L, -1); lua_pop(L, 2); return type; @@ -758,7 +758,7 @@ * Display a short message. * * The single line message will be displayed at the bottom of - * the scren and automatically hidden once a key is pressed. + * the screen and automatically hidden once a key is pressed. * * @function info * @tparam string message the message to display @@ -1309,7 +1309,7 @@ * eventually hands over control to the editor core. The exit status * of the most recent call is used. * - * All unsaved chanes will be lost! + * All unsaved changes will be lost! * * @function exit * @tparam int code the exit status returned to the operating system @@ -2097,6 +2097,10 @@ * File state. * @tfield bool modified whether the file contains unsaved changes */ +/*** + * File permission. + * @tfield int permission the file permission bits as of the most recent load/save + */ static int file_index(lua_State *L) { File *file = obj_ref_check(L, 1, VIS_LUA_TYPE_FILE); @@ -2126,6 +2130,12 @@ lua_pushboolean(L, text_modified(file->text)); return 1; } + + if (strcmp(key, "permission") == 0) { + struct stat stat = text_stat(file->text); + lua_pushunsigned(L, stat.st_mode & 0777); + return 1; + } } return index_common(L); @@ -2912,7 +2922,7 @@ * Input key event in either input or replace mode. * @function input * @tparam string key - * @treturn bool whether the key was cosumed or not + * @treturn bool whether the key was consumed or not */ static bool vis_lua_input(Vis *vis, const char *key, size_t len) { lua_State *L = vis->lua; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/vis-motions.c new/vis-0.8/vis-motions.c --- old/vis-0.7/vis-motions.c 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/vis-motions.c 2022-11-01 14:50:10.000000000 +0100 @@ -112,7 +112,33 @@ VIS_MOVE_LONGWORD_END_NEXT, isspace); } -static size_t to(Vis *vis, Text *txt, size_t pos) { +static size_t to_right(Vis *vis, Text *txt, size_t pos) { + char c; + size_t hit = text_find_next(txt, pos+1, vis->search_char); + if (!text_byte_get(txt, hit, &c) || c != vis->search_char[0]) + return pos; + return hit; +} + +static size_t till_right(Vis *vis, Text *txt, size_t pos) { + size_t hit = to_right(vis, txt, pos+1); + if (hit != pos) + return text_char_prev(txt, hit); + return pos; +} + +static size_t to_left(Vis *vis, Text *txt, size_t pos) { + return text_find_prev(txt, pos, vis->search_char); +} + +static size_t till_left(Vis *vis, Text *txt, size_t pos) { + size_t hit = to_left(vis, txt, pos-1); + if (hit != pos-1) + return text_char_next(txt, hit); + return pos; +} + +static size_t to_line_right(Vis *vis, Text *txt, size_t pos) { char c; if (pos == text_line_end(txt, pos)) return pos; @@ -122,8 +148,8 @@ return hit; } -static size_t till(Vis *vis, Text *txt, size_t pos) { - size_t hit = to(vis, txt, pos+1); +static size_t till_line_right(Vis *vis, Text *txt, size_t pos) { + size_t hit = to_line_right(vis, txt, pos+1); if (pos == text_line_end(txt, pos)) return pos; if (hit != pos) @@ -131,14 +157,14 @@ return pos; } -static size_t to_left(Vis *vis, Text *txt, size_t pos) { +static size_t to_line_left(Vis *vis, Text *txt, size_t pos) { return text_line_find_prev(txt, pos, vis->search_char); } -static size_t till_left(Vis *vis, Text *txt, size_t pos) { +static size_t till_line_left(Vis *vis, Text *txt, size_t pos) { if (pos == text_line_begin(txt, pos)) return pos; - size_t hit = to_left(vis, txt, pos-1); + size_t hit = to_line_left(vis, txt, pos-1); if (hit != pos-1) return text_char_next(txt, hit); return pos; @@ -294,10 +320,14 @@ } break; } - case VIS_MOVE_RIGHT_TO: - case VIS_MOVE_LEFT_TO: - case VIS_MOVE_RIGHT_TILL: - case VIS_MOVE_LEFT_TILL: + case VIS_MOVE_TO_RIGHT: + case VIS_MOVE_TO_LEFT: + case VIS_MOVE_TO_LINE_RIGHT: + case VIS_MOVE_TO_LINE_LEFT: + case VIS_MOVE_TILL_RIGHT: + case VIS_MOVE_TILL_LEFT: + case VIS_MOVE_TILL_LINE_RIGHT: + case VIS_MOVE_TILL_LINE_LEFT: { const char *key = va_arg(ap, char*); if (!key) @@ -314,17 +344,29 @@ break; case VIS_MOVE_TOTILL_REVERSE: switch (vis->last_totill) { - case VIS_MOVE_RIGHT_TO: - motion = VIS_MOVE_LEFT_TO; + case VIS_MOVE_TO_RIGHT: + motion = VIS_MOVE_TO_LEFT; + break; + case VIS_MOVE_TO_LEFT: + motion = VIS_MOVE_TO_RIGHT; + break; + case VIS_MOVE_TO_LINE_RIGHT: + motion = VIS_MOVE_TO_LINE_LEFT; + break; + case VIS_MOVE_TO_LINE_LEFT: + motion = VIS_MOVE_TO_LINE_RIGHT; break; - case VIS_MOVE_LEFT_TO: - motion = VIS_MOVE_RIGHT_TO; + case VIS_MOVE_TILL_RIGHT: + motion = VIS_MOVE_TILL_LEFT; break; - case VIS_MOVE_RIGHT_TILL: - motion = VIS_MOVE_LEFT_TILL; + case VIS_MOVE_TILL_LEFT: + motion = VIS_MOVE_TILL_RIGHT; break; - case VIS_MOVE_LEFT_TILL: - motion = VIS_MOVE_RIGHT_TILL; + case VIS_MOVE_TILL_LINE_RIGHT: + motion = VIS_MOVE_TILL_LINE_LEFT; + break; + case VIS_MOVE_TILL_LINE_LEFT: + motion = VIS_MOVE_TILL_LINE_RIGHT; break; default: goto err; @@ -515,20 +557,36 @@ .txt = lastline, .type = LINEWISE|LINEWISE_INCLUSIVE|JUMP|IDEMPOTENT, }, - [VIS_MOVE_LEFT_TO] = { + [VIS_MOVE_TO_LEFT] = { .vis = to_left, .type = COUNT_EXACT, }, - [VIS_MOVE_RIGHT_TO] = { - .vis = to, + [VIS_MOVE_TO_RIGHT] = { + .vis = to_right, + .type = INCLUSIVE|COUNT_EXACT, + }, + [VIS_MOVE_TO_LINE_LEFT] = { + .vis = to_line_left, + .type = COUNT_EXACT, + }, + [VIS_MOVE_TO_LINE_RIGHT] = { + .vis = to_line_right, .type = INCLUSIVE|COUNT_EXACT, }, - [VIS_MOVE_LEFT_TILL] = { + [VIS_MOVE_TILL_LEFT] = { .vis = till_left, .type = COUNT_EXACT, }, - [VIS_MOVE_RIGHT_TILL] = { - .vis = till, + [VIS_MOVE_TILL_RIGHT] = { + .vis = till_right, + .type = INCLUSIVE|COUNT_EXACT, + }, + [VIS_MOVE_TILL_LINE_LEFT] = { + .vis = till_line_left, + .type = COUNT_EXACT, + }, + [VIS_MOVE_TILL_LINE_RIGHT] = { + .vis = till_line_right, .type = INCLUSIVE|COUNT_EXACT, }, [VIS_MOVE_SEARCH_WORD_FORWARD] = { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/vis.c new/vis-0.8/vis.c --- old/vis-0.7/vis.c 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/vis.c 2022-11-01 14:50:10.000000000 +0100 @@ -1018,7 +1018,7 @@ register_resize(reg, last_reg_slot+1); } - /* we do not support visual repeat, still do something resonable */ + /* we do not support visual repeat, still do something reasonable */ if (vis->mode->visual && !a->movement && !a->textobj) a->movement = &vis_motions[VIS_MOVE_NOP]; @@ -1686,7 +1686,7 @@ size_t newpos = vis_text_insert_nl(vis, txt, pos); /* This is a bit of a hack to fix cursor positioning when * inserting a new line at the start of the view port. - * It has the effect of reseting the mark used by the view + * It has the effect of resetting the mark used by the view * code to keep track of the start of the visible region. */ view_cursors_to(s, pos); @@ -1860,8 +1860,8 @@ if (len > 0) { rout.start += len; if (text_range_size(&rout) == 0) { - close(pout[1]); - pout[1] = -1; + close(pin[1]); + pin[1] = -1; } } else { close(pin[1]); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vis-0.7/vis.h new/vis-0.8/vis.h --- old/vis-0.7/vis.h 2020-12-08 10:41:52.000000000 +0100 +++ new/vis-0.8/vis.h 2022-11-01 14:50:10.000000000 +0100 @@ -77,7 +77,7 @@ * @rst * .. note:: An empty string ``""`` indicates that no further input is available. * @endrst - * @return Pointer to first non-cosumed key. + * @return Pointer to first non-consumed key. * @rst * .. warning:: Must be in range ``[keys, keys+strlen(keys)]`` or ``NULL`` to * indicate that not enough input was available. In the latter case @@ -131,7 +131,7 @@ void vis_die(Vis*, const char *msg, ...) __attribute__((noreturn,format(printf, 2, 3))); /** - * Temporarily supsend the editor process. + * Temporarily suspend the editor process. * @rst * .. note:: This function will generate a ``SIGTSTP`` signal. * @endrst @@ -222,9 +222,9 @@ void vis_window_focus(Win*); /** Swap location of two windows. */ void vis_window_swap(Win*, Win*); -/** Query window dimension. */ +/** Query window width. */ int vis_window_width_get(const Win*); -/** Query window dimension. */ +/** Query window height. */ int vis_window_height_get(const Win*); /** * @} @@ -264,7 +264,7 @@ /** Perform insertion at all cursor positions. */ void vis_insert_key(Vis*, const char *data, size_t len); /** - * Perform character subsitution at all cursor positions. + * Perform character substitution at all cursor positions. * @rst * .. note:: Does not replace new line characters. * @endrst @@ -433,7 +433,7 @@ * * - `VIS_OP_JOIN` a char pointer referring to the text to insert between lines. * - `VIS_OP_MODESWITCH` an ``enum VisMode`` indicating the mode to switch to. - * - `VIS_OP_REPLACE` a char pointer reffering to the replacement character. + * - `VIS_OP_REPLACE` a char pointer referring to the replacement character. */ bool vis_operator(Vis*, enum VisOperator, ...); @@ -491,10 +491,14 @@ VIS_MOVE_PARENTHESIS_START, VIS_MOVE_PARENTHESIS_END, VIS_MOVE_BRACKET_MATCH, - VIS_MOVE_LEFT_TO, - VIS_MOVE_RIGHT_TO, - VIS_MOVE_LEFT_TILL, - VIS_MOVE_RIGHT_TILL, + VIS_MOVE_TO_LEFT, + VIS_MOVE_TO_RIGHT, + VIS_MOVE_TO_LINE_LEFT, + VIS_MOVE_TO_LINE_RIGHT, + VIS_MOVE_TILL_LEFT, + VIS_MOVE_TILL_RIGHT, + VIS_MOVE_TILL_LINE_LEFT, + VIS_MOVE_TILL_LINE_RIGHT, VIS_MOVE_FILE_BEGIN, VIS_MOVE_FILE_END, VIS_MOVE_SEARCH_WORD_FORWARD, @@ -774,7 +778,7 @@ * Get register content. * @return An array of ``TextString`` structs. * @rst - * .. warning:: The caller must eventually free the array ressources using + * .. warning:: The caller must eventually free the array resources using * ``array_release``. * @endrst */ @@ -853,7 +857,7 @@ * Option handler function. * @param win The window to which option should apply, might be ``NULL``. * @param context User provided context pointer as given to `vis_option_register`. - * @param force Whether the option was specfied with a bang ``!``. + * @param force Whether the option was specified with a bang ``!``. * @param name Name of option which was set. * @param arg The new option value. */ @@ -964,7 +968,7 @@ Regex *vis_regex(Vis*, const char *pattern); /** - * Take an undo snaphost to which we can later revert to. + * Take an undo snapshot to which we can later revert. * @rst * .. note:: Does nothing when invoked while replaying a macro. * @endrst
