Initial set of files from osc repo.
This commit is contained in:
commit
3841698f0b
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.osc
|
||||
build.specials.obscpio
|
63
558-gf_reimplementation.patch
Normal file
63
558-gf_reimplementation.patch
Normal file
@ -0,0 +1,63 @@
|
||||
From 57574a037b4faff9a3f36df12519d2ee4b479824 Mon Sep 17 00:00:00 2001
|
||||
From: Silvan Jegen <s.jegen@gmail.com>
|
||||
Date: Sun, 26 Feb 2017 16:47:12 +0100
|
||||
Subject: [PATCH 1/6] vis: reimplement `gf` and `<C-w>gf` functionality in lua
|
||||
|
||||
The functionality is not exactly identical since both bindings open the
|
||||
file name under the cursor in a new window. The older implementation
|
||||
opened the file in the same window with `gf` and in a new one with
|
||||
`<C-w>gf`.
|
||||
---
|
||||
lua/plugins/open-file-under-cursor.lua | 38 +++++++++++++++++++++++++++++++++
|
||||
lua/vis-std.lua | 2 +
|
||||
2 files changed, 40 insertions(+)
|
||||
|
||||
--- /dev/null
|
||||
+++ b/lua/plugins/open-file-under-cursor.lua
|
||||
@@ -0,0 +1,38 @@
|
||||
+-- open file at primary cursor location
|
||||
+
|
||||
+local lpeg = vis.lpeg
|
||||
+local l = vis.lexers
|
||||
+local dq_str = l.delimited_range('"', true)
|
||||
+local sq_str = l.delimited_range("'", true)
|
||||
+local include = l.delimited_range("<>", true, true, true)
|
||||
+local filename = dq_str + sq_str + include + (1 - lpeg.S('"\'\t\v\f\r()[]{} \n'))^1
|
||||
+
|
||||
+vis:map(vis.modes.NORMAL, "gf", function(keys)
|
||||
+ local mstart, mend = vis.win.file:match_at(filename, vis.win.selection.pos, 200)
|
||||
+ if not mstart or not mend then
|
||||
+ vis:info("No filename found under the cursor.")
|
||||
+ return #keys
|
||||
+ end
|
||||
+ local fnoffstr = vis.win.file:content(mstart, mend-mstart)
|
||||
+ local offsetcmd
|
||||
+ local fn = fnoffstr
|
||||
+ local offset = fnoffstr:find(":")
|
||||
+ if not offset then
|
||||
+ local offset = fnoffstr:find("/")
|
||||
+ end
|
||||
+ if offset then
|
||||
+ offsetcmd = fnoffstr:sub(offset)
|
||||
+ fn = fnoffstr:sub(1, offset-1)
|
||||
+ end
|
||||
+ local ok = vis:command(string.format("open %s", fn))
|
||||
+ if not ok then
|
||||
+ vis:info("Could not open file " .. fn)
|
||||
+ return #keys
|
||||
+ end
|
||||
+ if offsetcmd then
|
||||
+ vis:command(offsetcmd)
|
||||
+ end
|
||||
+ return #keys
|
||||
+end, "Open file under cursor in a new window")
|
||||
+
|
||||
+vis:map(vis.modes.NORMAL, "<C-w>gf", "gf")
|
||||
--- a/lua/vis-std.lua
|
||||
+++ b/lua/vis-std.lua
|
||||
@@ -144,3 +144,5 @@ require('plugins/digraph')
|
||||
require('plugins/number-inc-dec')
|
||||
require('plugins/complete-word')
|
||||
require('plugins/complete-filename')
|
||||
+require('plugins/open-file-under-cursor')
|
||||
+
|
160
617-vis-highlight.patch
Normal file
160
617-vis-highlight.patch
Normal file
@ -0,0 +1,160 @@
|
||||
From 207fc803e1ceffb384ef9d0c6b2f2614bc8fdb67 Mon Sep 17 00:00:00 2001
|
||||
From: "David B. Lamkins" <david@lamkins.net>
|
||||
Date: Sun, 1 Oct 2017 10:43:56 -0700
|
||||
Subject: [PATCH] Add vis-highlight command.
|
||||
|
||||
---
|
||||
README.md | 2 +
|
||||
man/vis-highlight.1 | 41 +++++++++++++++++++++++
|
||||
vis-highlight | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 132 insertions(+)
|
||||
create mode 100644 man/vis-highlight.1
|
||||
create mode 100755 vis-highlight
|
||||
|
||||
--- a/README.md
|
||||
+++ b/README.md
|
||||
@@ -53,6 +53,8 @@ compatible environment as well as:
|
||||
* [Lua](http://www.lua.org/) >= 5.2 (optional)
|
||||
* [LPeg](http://www.inf.puc-rio.br/~roberto/lpeg/) >= 0.12
|
||||
(optional runtime dependency required for syntax highlighting)
|
||||
+ * [lua-term](https://github.com/hoelzro/lua-term) >= 0.07
|
||||
+ (optional runtime dependency required for CLI highlighting using vis-highlight)
|
||||
* [TRE](http://laurikari.net/tre/) (optional for more memory efficient regex search)
|
||||
|
||||
Assuming these dependencies are met, execute:
|
||||
--- /dev/null
|
||||
+++ b/man/vis-highlight.1
|
||||
@@ -0,0 +1,41 @@
|
||||
+.Dd October 1, 2017
|
||||
+.Dt VIS-HIGHLIGHT 1
|
||||
+.Os Vis VERSION
|
||||
+.
|
||||
+.Sh NAME
|
||||
+.Nm vis-highlight
|
||||
+.Nd Highlight files using vis' lexers
|
||||
+.
|
||||
+.Sh SYNOPSIS
|
||||
+.Nm vis-highlight
|
||||
+.Ar lexer
|
||||
+.Ar files
|
||||
+.
|
||||
+.Sh DESCRIPTION
|
||||
+.Nm vis-highlight
|
||||
+applies a vis lexer to highlight one or more files to standard output.
|
||||
+.
|
||||
+.Sh ENVIRONMENT
|
||||
+.
|
||||
+The following environment variables affect the operation of
|
||||
+.Nm vis-highlight :
|
||||
+.
|
||||
+.Bl -tag -width Ev
|
||||
+.It Ev VIS_PATH
|
||||
+The default path to use to load Lua support files.
|
||||
+.El
|
||||
+.
|
||||
+.Sh EXIT STATUS
|
||||
+.Ex -std vis-highlight
|
||||
+.
|
||||
+.Sh EXAMPLES
|
||||
+Highlight the visrc.lua file:
|
||||
+.Bd -literal -offset indent
|
||||
+vis-highlight lua ~/.config/vis/visrc.lua
|
||||
+.Ed
|
||||
+.
|
||||
+.Sh BUGS
|
||||
+An ANSI-compatible terminal is assumed.
|
||||
+.
|
||||
+.Sh SEE ALSO
|
||||
+.Xr vis 1
|
||||
--- /dev/null
|
||||
+++ b/vis-highlight
|
||||
@@ -0,0 +1,89 @@
|
||||
+#! /usr/bin/env lua
|
||||
+
|
||||
+-- Standalone syntax highlighter uses the lexers provided by `vis`.
|
||||
+
|
||||
+if #arg < 2 then
|
||||
+ print('usage: ' .. arg[0] .. ' LEXER-NAME FILE...')
|
||||
+ return 1
|
||||
+end
|
||||
+
|
||||
+vis_path = os.getenv('VIS_PATH')
|
||||
+if vis_path ~= nil then
|
||||
+ package.path = package.path .. ';' .. vis_path .. '/?.lua'
|
||||
+end
|
||||
+package.path = package.path .. ';/usr/local/share/vis/?.lua'
|
||||
+package.path = package.path .. ';/usr/share/vis/?.lua'
|
||||
+
|
||||
+local syntax = arg[1]
|
||||
+local lexers = require('lexer')
|
||||
+local lexer = lexers.load(syntax)
|
||||
+
|
||||
+if not lexer then
|
||||
+ print(string.format('Failed to load lexer: `%s`', syntax))
|
||||
+ return 1
|
||||
+end
|
||||
+
|
||||
+local term = require('term')
|
||||
+local colors = term.colors
|
||||
+
|
||||
+local token_styles = {
|
||||
+ -- bold => bright
|
||||
+ -- italics => underscore
|
||||
+ ['default'] = colors.default .. colors.onblack .. colors.white,
|
||||
+ ['nothing'] = colors.default .. colors.onblack,
|
||||
+ ['class'] = colors.default .. colors.yellow .. colors.bright,
|
||||
+ ['comment'] = colors.default .. colors.blue .. colors.bright,
|
||||
+ ['constant'] = colors.default .. colors.cyan .. colors.bright,
|
||||
+ ['definition'] = colors.default .. colors.blue .. colors.bright,
|
||||
+ ['error'] = colors.default .. colors.red .. colors.underscore,
|
||||
+ ['function'] = colors.default .. colors.blue .. colors.bright,
|
||||
+ ['keyword'] = colors.default .. colors.yellow .. colors.bright,
|
||||
+ ['label'] = colors.default .. colors.green .. colors.bright,
|
||||
+ ['number'] = colors.default .. colors.red .. colors.bright,
|
||||
+ ['operator'] = colors.default .. colors.cyan .. colors.bright,
|
||||
+ ['regex'] = colors.default .. colors.green .. colors.bright,
|
||||
+ ['string'] = colors.default .. colors.red .. colors.bright,
|
||||
+ ['preprocessor'] = colors.default .. colors.magenta .. colors.bright,
|
||||
+ ['tag'] = colors.default .. colors.red .. colors.bright,
|
||||
+ ['type'] = colors.default .. colors.green .. colors.bright,
|
||||
+ ['variable'] = colors.default .. colors.blue .. colors.bright,
|
||||
+ ['whitespace'] = '',
|
||||
+ ['embedded'] = colors.default .. colors.onblue .. colors.bright,
|
||||
+ ['identifier'] = colors.default .. colors.white,
|
||||
+}
|
||||
+
|
||||
+for i = 2, #arg do
|
||||
+ local filename = arg[i]
|
||||
+ local file = assert(io.open(filename, 'r'))
|
||||
+ local text = file:read('*all')
|
||||
+ file:close()
|
||||
+ local tokens = lexer:lex(text, 1)
|
||||
+ local token_start = 1
|
||||
+ local last = ''
|
||||
+
|
||||
+ for i = 1, #tokens, 2 do
|
||||
+ local token_end = tokens[i+1] - 1
|
||||
+ local name = tokens[i]
|
||||
+ local style = token_styles[name]
|
||||
+ if style ~= nil then
|
||||
+ -- Whereas the lexer reports all other syntaxes over
|
||||
+ -- the entire span of a token, it reports 'default'
|
||||
+ -- byte-by-byte. We emit only the first 'default' of
|
||||
+ -- a series in order to properly display multibyte
|
||||
+ -- UTF-8 characters.
|
||||
+ if not (last == 'default' and name == 'default') then
|
||||
+ io.write(tostring(style))
|
||||
+ end
|
||||
+ last = name
|
||||
+ end
|
||||
+ local token = text:sub(token_start, token_end)
|
||||
+ if style ~= nil then
|
||||
+ -- Replicate the style after every newline within
|
||||
+ -- the token, because less -R forgets attributes
|
||||
+ -- with each newline.
|
||||
+ token = token:gsub("\n", "\n" .. tostring(style))
|
||||
+ end
|
||||
+ io.write(token)
|
||||
+ token_start = token_end + 1
|
||||
+ end
|
||||
+end
|
418
675-non-block_subproc.patch
Normal file
418
675-non-block_subproc.patch
Normal file
@ -0,0 +1,418 @@
|
||||
---
|
||||
Makefile | 1
|
||||
lua/vis.lua | 2
|
||||
vis-lua.c | 82 +++++++++++++++++++++++++
|
||||
vis-lua.h | 4 -
|
||||
vis-subprocess.c | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
vis-subprocess.h | 23 +++++++
|
||||
vis.c | 5 +
|
||||
7 files changed, 291 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -26,6 +26,7 @@ SRC = array.c \
|
||||
vis-prompt.c \
|
||||
vis-registers.c \
|
||||
vis-text-objects.c \
|
||||
+ vis-subprocess.c \
|
||||
$(REGEX_SRC)
|
||||
|
||||
ELF = vis vis-menu vis-digraph
|
||||
--- a/lua/vis.lua
|
||||
+++ b/lua/vis.lua
|
||||
@@ -152,6 +152,7 @@ local events = {
|
||||
WIN_OPEN = "Event::WIN_OPEN", -- see @{win_open}
|
||||
WIN_STATUS = "Event::WIN_STATUS", -- see @{win_status}
|
||||
TERM_CSI = "Event::TERM_CSI", -- see @{term_csi}
|
||||
+ PROCESS_RESPONSE = "Event::PROCESS_RESPONSE", -- see @{process_response}
|
||||
}
|
||||
|
||||
events.file_close = function(...) events.emit(events.FILE_CLOSE, ...) end
|
||||
@@ -167,6 +168,7 @@ events.win_highlight = function(...) eve
|
||||
events.win_open = function(...) events.emit(events.WIN_OPEN, ...) end
|
||||
events.win_status = function(...) events.emit(events.WIN_STATUS, ...) end
|
||||
events.term_csi = function(...) events.emit(events.TERM_CSI, ...) end
|
||||
+events.process_response = function(...) events.emit(events.PROCESS_RESPONSE, ...) end
|
||||
|
||||
local handlers = {}
|
||||
|
||||
--- a/vis-lua.c
|
||||
+++ b/vis-lua.c
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "vis-lua.h"
|
||||
#include "vis-core.h"
|
||||
+#include "vis-subprocess.h"
|
||||
#include "text-motions.h"
|
||||
#include "util.h"
|
||||
|
||||
@@ -52,6 +53,13 @@
|
||||
#define debug(...) do { } while (0)
|
||||
#endif
|
||||
|
||||
+typedef struct {
|
||||
+ /* Lua stream structure for the process input stream */
|
||||
+ FILE *f;
|
||||
+ lua_CFunction closef;
|
||||
+ Process *handler;
|
||||
+} ProcessStream;
|
||||
+
|
||||
static void window_status_update(Vis *vis, Win *win) {
|
||||
char left_parts[4][255] = { "", "", "", "" };
|
||||
char right_parts[4][32] = { "", "", "", "" };
|
||||
@@ -162,6 +170,9 @@ void vis_lua_win_close(Vis *vis, Win *wi
|
||||
void vis_lua_win_highlight(Vis *vis, Win *win) { }
|
||||
void vis_lua_win_status(Vis *vis, Win *win) { window_status_update(vis, win); }
|
||||
void vis_lua_term_csi(Vis *vis, const long *csi) { }
|
||||
+void vis_lua_process_response(Vis *vis, const char *name,
|
||||
+ char *buffer, size_t len, ResponseType rtype) { }
|
||||
+
|
||||
|
||||
#else
|
||||
|
||||
@@ -1368,6 +1379,47 @@ static int redraw(lua_State *L) {
|
||||
return 0;
|
||||
}
|
||||
/***
|
||||
+ * Closes a stream returned by @{Vis.communicate}.
|
||||
+ *
|
||||
+ * @function close
|
||||
+ * @tparam io.file inputfd the stream to be closed
|
||||
+ * @treturn bool the same with @{io.close}
|
||||
+ */
|
||||
+static int close_subprocess(lua_State *L) {
|
||||
+ luaL_Stream *file = luaL_checkudata(L, -1, "FILE*");
|
||||
+ int result = fclose(file->f);
|
||||
+ if (result == 0) {
|
||||
+ file->f = NULL;
|
||||
+ file->closef = NULL;
|
||||
+ }
|
||||
+ return luaL_fileresult(L, result == 0, NULL);
|
||||
+}
|
||||
+/***
|
||||
+ * Open new process and return its input handler.
|
||||
+ * When the process will quit or will output anything to stdout or stderr,
|
||||
+ * the @{process_response} event will be fired.
|
||||
+ *
|
||||
+ * The editor core won't be blocked while the external process is running.
|
||||
+ *
|
||||
+ * @function communicate
|
||||
+ * @tparam string name the name of subprocess (to distinguish processes in the @{process_response} event)
|
||||
+ * @tparam string command the command to execute
|
||||
+ * @return the file handle to write data to the process, in case of error the return values are equivalent to @{io.open} error values.
|
||||
+ */
|
||||
+static int communicate_func(lua_State *L) {
|
||||
+ Vis *vis = obj_ref_check(L, 1, "vis");
|
||||
+ const char *name = luaL_checkstring(L, 2);
|
||||
+ const char *cmd = luaL_checkstring(L, 3);
|
||||
+ ProcessStream *inputfd = (ProcessStream *)lua_newuserdata(L, sizeof(ProcessStream));
|
||||
+ luaL_setmetatable(L, LUA_FILEHANDLE);
|
||||
+ inputfd->handler = vis_process_communicate(vis, name, cmd, (void **)(&(inputfd->closef)));
|
||||
+ if (inputfd->handler) {
|
||||
+ inputfd->f = fdopen(inputfd->handler->inpfd, "w");
|
||||
+ inputfd->closef = &close_subprocess;
|
||||
+ }
|
||||
+ return inputfd->f ? 1 : luaL_fileresult(L, inputfd->f != NULL, name);
|
||||
+}
|
||||
+/***
|
||||
* Currently active window.
|
||||
* @tfield Window win
|
||||
* @see windows
|
||||
@@ -1524,6 +1576,7 @@ static const struct luaL_Reg vis_lua[] =
|
||||
{ "exit", exit_func },
|
||||
{ "pipe", pipe_func },
|
||||
{ "redraw", redraw },
|
||||
+ { "communicate", communicate_func },
|
||||
{ "__index", vis_index },
|
||||
{ "__newindex", vis_newindex },
|
||||
{ NULL, NULL },
|
||||
@@ -3135,5 +3188,34 @@ void vis_lua_term_csi(Vis *vis, const lo
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
+/***
|
||||
+ * The response received from the process started via @{Vis:communicate}.
|
||||
+ * @function process_response
|
||||
+ * @tparam string name the name of process given to @{Vis:communicate}
|
||||
+ * @tparam string response_type can be "STDOUT" or "STDERR" if new output was received in corresponding channel, "SIGNAL" if the process was terminated by a signal or "EXIT" when the process terminated normally
|
||||
+ * @tparam string|int buffer the available content sent by process; it becomes the exit code number if response\_type is "EXIT", or the signal number if response\_type is "SIGNAL"
|
||||
+ */
|
||||
+void vis_lua_process_response(Vis *vis, const char *name,
|
||||
+ char *buffer, size_t len, ResponseType rtype) {
|
||||
+ lua_State *L = vis->lua;
|
||||
+ if (!L)
|
||||
+ return;
|
||||
+ vis_lua_event_get(L, "process_response");
|
||||
+ if (lua_isfunction(L, -1)) {
|
||||
+ lua_pushstring(L, name);
|
||||
+ if (rtype == EXIT || rtype == SIGNAL)
|
||||
+ lua_pushinteger(L, len);
|
||||
+ else
|
||||
+ lua_pushlstring(L, buffer, len);
|
||||
+ switch (rtype){
|
||||
+ case STDOUT: lua_pushstring(L, "STDOUT"); break;
|
||||
+ case STDERR: lua_pushstring(L, "STDERR"); break;
|
||||
+ case SIGNAL: lua_pushstring(L, "SIGNAL"); break;
|
||||
+ case EXIT: lua_pushstring(L, "EXIT"); break;
|
||||
+ }
|
||||
+ pcall(vis, L, 3, 0);
|
||||
+ }
|
||||
+ lua_pop(L, 1);
|
||||
+}
|
||||
|
||||
#endif
|
||||
--- a/vis-lua.h
|
||||
+++ b/vis-lua.h
|
||||
@@ -7,10 +7,11 @@
|
||||
#include <lauxlib.h>
|
||||
#else
|
||||
typedef struct lua_State lua_State;
|
||||
+typedef void* lua_CFunction;
|
||||
#endif
|
||||
|
||||
#include "vis.h"
|
||||
-
|
||||
+#include "vis-subprocess.h"
|
||||
/* add a directory to consider when loading lua files */
|
||||
bool vis_lua_path_add(Vis*, const char *path);
|
||||
/* get semicolon separated list of paths to load lua files
|
||||
@@ -38,5 +39,6 @@ void vis_lua_win_close(Vis*, Win*);
|
||||
void vis_lua_win_highlight(Vis*, Win*);
|
||||
void vis_lua_win_status(Vis*, Win*);
|
||||
void vis_lua_term_csi(Vis*, const long *);
|
||||
+void vis_lua_process_response(Vis *, const char *, char *, size_t, ResponseType);
|
||||
|
||||
#endif
|
||||
--- /dev/null
|
||||
+++ b/vis-subprocess.c
|
||||
@@ -0,0 +1,176 @@
|
||||
+#include <fcntl.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdbool.h>
|
||||
+#include <errno.h>
|
||||
+#include <string.h>
|
||||
+#include <sys/wait.h>
|
||||
+#include "vis-lua.h"
|
||||
+#include "vis-subprocess.h"
|
||||
+
|
||||
+/* Maximum amount of data what can be read from IPC pipe per event */
|
||||
+#define MAXBUFFER 1024
|
||||
+
|
||||
+/* Pool of information about currently running subprocesses */
|
||||
+static Process *process_pool;
|
||||
+
|
||||
+Process *new_in_pool() {
|
||||
+ /* Adds new empty process information structure to the process pool and
|
||||
+ * returns it */
|
||||
+ Process *newprocess = (Process *)malloc(sizeof(Process));
|
||||
+ if (!newprocess) return NULL;
|
||||
+ newprocess->next = process_pool;
|
||||
+ process_pool = newprocess;
|
||||
+ return newprocess;
|
||||
+}
|
||||
+
|
||||
+void destroy(Process **pointer) {
|
||||
+ /* Removes the subprocess information from the pool, sets invalidator to NULL
|
||||
+ * and frees resources. */
|
||||
+ Process *target = *pointer;
|
||||
+ if (target->outfd != -1) close(target->outfd);
|
||||
+ if (target->errfd != -1) close(target->errfd);
|
||||
+ if (target->inpfd != -1) close(target->inpfd);
|
||||
+ /* marking stream as closed for lua */
|
||||
+ if (target->invalidator) *(target->invalidator) = NULL;
|
||||
+ if (target->name) free(target->name);
|
||||
+ *pointer = target->next;
|
||||
+ free(target);
|
||||
+}
|
||||
+
|
||||
+Process *vis_process_communicate(Vis *vis, const char *name,
|
||||
+ const char *command, void **invalidator) {
|
||||
+ /* Starts new subprocess by passing the `command` to the shell and
|
||||
+ * returns the subprocess information structure, containing file descriptors
|
||||
+ * of the process.
|
||||
+ * Also stores the subprocess information to the internal pool to track
|
||||
+ * its status and responses.
|
||||
+ * `name` - the string than should contain an unique name of the subprocess.
|
||||
+ * This name will be passed to the PROCESS_RESPONSE event handler
|
||||
+ * to distinguish running subprocesses.
|
||||
+ * `invalidator` - a pointer to the pointer which shows that the subprocess
|
||||
+ * is invalid when set to NULL. When subprocess dies, it is being set to NULL.
|
||||
+ * If the pointer is set to NULL by an external code, the subprocess will be
|
||||
+ * killed on the next main loop iteration. */
|
||||
+ int pin[2], pout[2], perr[2];
|
||||
+ pid_t pid = (pid_t)-1;
|
||||
+ if (pipe(perr) == -1) goto closeerr;
|
||||
+ if (pipe(pout) == -1) goto closeouterr;
|
||||
+ if (pipe(pin) == -1) goto closeall;
|
||||
+ pid = fork();
|
||||
+ if (pid == -1)
|
||||
+ vis_info_show(vis, "fork failed: %s", strerror(errno));
|
||||
+ else if (pid == 0){ /* child process */
|
||||
+ sigset_t sigterm_mask;
|
||||
+ sigemptyset(&sigterm_mask);
|
||||
+ sigaddset(&sigterm_mask, SIGTERM);
|
||||
+ if (sigprocmask(SIG_UNBLOCK, &sigterm_mask, NULL) == -1) {
|
||||
+ fprintf(stderr, "failed to reset signal mask");
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ }
|
||||
+ dup2(pin[0], STDIN_FILENO);
|
||||
+ dup2(pout[1], STDOUT_FILENO);
|
||||
+ dup2(perr[1], STDERR_FILENO);
|
||||
+ }
|
||||
+ else { /* main process */
|
||||
+ Process *new = new_in_pool();
|
||||
+ if (!new) {
|
||||
+ vis_info_show(vis, "Can not create process: %s", strerror(errno));
|
||||
+ goto closeall;
|
||||
+ }
|
||||
+ new->name = strdup(name);
|
||||
+ if (!new->name) {
|
||||
+ vis_info_show(vis, "Can not copy process name: %s", strerror(errno));
|
||||
+ /* pop top element (which is `new`) from the pool */
|
||||
+ destroy(&process_pool);
|
||||
+ goto closeall;
|
||||
+ }
|
||||
+ new->outfd = pout[0];
|
||||
+ new->errfd = perr[0];
|
||||
+ new->inpfd = pin[1];
|
||||
+ new->pid = pid;
|
||||
+ new->invalidator = invalidator;
|
||||
+ close(pin[0]);
|
||||
+ close(pout[1]);
|
||||
+ close(perr[1]);
|
||||
+ return new;
|
||||
+ }
|
||||
+closeall:
|
||||
+ close(pin[0]);
|
||||
+ close(pin[1]);
|
||||
+closeouterr:
|
||||
+ close(pout[0]);
|
||||
+ close(pout[1]);
|
||||
+closeerr:
|
||||
+ close(perr[0]);
|
||||
+ close(perr[1]);
|
||||
+ if (pid == 0) { /* start command in child process */
|
||||
+ execlp(vis->shell, vis->shell, "-c", command, (char*)NULL);
|
||||
+ fprintf(stderr, "exec failed: %s(%d)\n", strerror(errno), errno);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ else
|
||||
+ vis_info_show(vis, "process creation failed: %s", strerror(errno));
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+int vis_process_before_tick(fd_set *readfds) {
|
||||
+ /* Adds file descriptors of currently running subprocesses to the `readfds`
|
||||
+ * to track their readiness and returns maximum file descriptor value
|
||||
+ * to pass it to the `pselect` call */
|
||||
+ Process **pointer = &process_pool;
|
||||
+ int maxfd = 0;
|
||||
+ while (*pointer) {
|
||||
+ Process *current = *pointer;
|
||||
+ if (current->outfd != -1) {
|
||||
+ FD_SET(current->outfd, readfds);
|
||||
+ maxfd = maxfd < current->outfd ? current->outfd : maxfd;
|
||||
+ }
|
||||
+ if (current->errfd != -1) {
|
||||
+ FD_SET(current->errfd, readfds);
|
||||
+ maxfd = maxfd < current->errfd ? current->errfd : maxfd;
|
||||
+ }
|
||||
+ pointer = ¤t->next;
|
||||
+ }
|
||||
+ return maxfd;
|
||||
+}
|
||||
+
|
||||
+void read_and_fire(Vis* vis, int fd, const char *name, ResponseType rtype) {
|
||||
+ /* Reads data from the given subprocess file descriptor `fd` and fires
|
||||
+ * the PROCESS_RESPONSE event in Lua with given subprocess `name`,
|
||||
+ * `rtype` and the read data as arguments. */
|
||||
+ static char buffer[MAXBUFFER];
|
||||
+ size_t obtained = read(fd, &buffer, MAXBUFFER-1);
|
||||
+ if (obtained > 0)
|
||||
+ vis_lua_process_response(vis, name, buffer, obtained, rtype);
|
||||
+}
|
||||
+
|
||||
+void vis_process_tick(Vis *vis, fd_set *readfds) {
|
||||
+ /* Checks if `readfds` contains file discriptors of subprocesses from
|
||||
+ * the pool. If so, reads the data from them and fires corresponding events.
|
||||
+ * Also checks if subprocesses from pool is dead or need to be killed then
|
||||
+ * raises event or kills it if necessary. */
|
||||
+ Process **pointer = &process_pool;
|
||||
+ while (*pointer) {
|
||||
+ Process *current = *pointer;
|
||||
+ if (current->outfd != -1 && FD_ISSET(current->outfd, readfds))
|
||||
+ read_and_fire(vis, current->outfd, current->name, STDOUT);
|
||||
+ if (current->errfd != -1 && FD_ISSET(current->errfd, readfds))
|
||||
+ read_and_fire(vis, current->errfd, current->name, STDERR);
|
||||
+ int status;
|
||||
+ pid_t wpid = waitpid(current->pid, &status, WNOHANG);
|
||||
+ if (wpid == -1) vis_message_show(vis, strerror(errno));
|
||||
+ else if (wpid == current->pid) goto just_destroy;
|
||||
+ else if(!*(current->invalidator)) goto kill_and_destroy;
|
||||
+ pointer = ¤t->next;
|
||||
+ continue;
|
||||
+kill_and_destroy:
|
||||
+ kill(current->pid, SIGTERM);
|
||||
+ waitpid(current->pid, &status, 0);
|
||||
+just_destroy:
|
||||
+ if (WIFSIGNALED(status))
|
||||
+ vis_lua_process_response(vis, current->name, NULL, WTERMSIG(status), SIGNAL);
|
||||
+ else
|
||||
+ vis_lua_process_response(vis, current->name, NULL, WEXITSTATUS(status), EXIT);
|
||||
+ destroy(pointer);
|
||||
+ }
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/vis-subprocess.h
|
||||
@@ -0,0 +1,23 @@
|
||||
+#ifndef VIS_SUBPROCESS_H
|
||||
+#define VIS_SUBPROCESS_H
|
||||
+#include "vis-core.h"
|
||||
+#include <sys/select.h>
|
||||
+
|
||||
+struct Process {
|
||||
+ char *name;
|
||||
+ int outfd;
|
||||
+ int errfd;
|
||||
+ int inpfd;
|
||||
+ pid_t pid;
|
||||
+ void **invalidator;
|
||||
+ struct Process *next;
|
||||
+};
|
||||
+
|
||||
+typedef struct Process Process;
|
||||
+typedef enum { STDOUT, STDERR, SIGNAL, EXIT } ResponseType;
|
||||
+
|
||||
+Process *vis_process_communicate(Vis *, const char *command, const char *name,
|
||||
+ void **invalidator);
|
||||
+int vis_process_before_tick(fd_set *);
|
||||
+void vis_process_tick(Vis *, fd_set *);
|
||||
+#endif
|
||||
--- a/vis.c
|
||||
+++ b/vis.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "vis-core.h"
|
||||
#include "sam.h"
|
||||
#include "ui.h"
|
||||
+#include "vis-subprocess.h"
|
||||
|
||||
|
||||
static void macro_replay(Vis *vis, const Macro *macro);
|
||||
@@ -1412,7 +1413,8 @@ int vis_run(Vis *vis) {
|
||||
|
||||
vis_update(vis);
|
||||
idle.tv_sec = vis->mode->idle_timeout;
|
||||
- int r = pselect(1, &fds, NULL, NULL, timeout, &emptyset);
|
||||
+ int r = pselect(vis_process_before_tick(&fds) + 1, &fds, NULL, NULL,
|
||||
+ timeout, &emptyset);
|
||||
if (r == -1 && errno == EINTR)
|
||||
continue;
|
||||
|
||||
@@ -1420,6 +1422,7 @@ int vis_run(Vis *vis) {
|
||||
/* TODO save all pending changes to a ~suffixed file */
|
||||
vis_die(vis, "Error in mainloop: %s\n", strerror(errno));
|
||||
}
|
||||
+ vis_process_tick(vis, &fds);
|
||||
|
||||
if (!FD_ISSET(STDIN_FILENO, &fds)) {
|
||||
if (vis->mode->idle)
|
61
699-no-crash-reenter-prompt.patch
Normal file
61
699-no-crash-reenter-prompt.patch
Normal file
@ -0,0 +1,61 @@
|
||||
From 3984e4497d0a6466cb82b3749e05600ad6e24603 Mon Sep 17 00:00:00 2001
|
||||
From: TwoFinger <Two-Finger@users.noreply.github.com>
|
||||
Date: Mon, 14 May 2018 15:42:05 +0300
|
||||
Subject: [PATCH] vis: Fix a crash when re-entering prompt window
|
||||
|
||||
vis->mode was incorrectly "restored" to a NULL prompt->parent_mode in
|
||||
prompt_restore() because vis_prompt_show() was assuming that the
|
||||
currently active window is always a regular one.
|
||||
But if the active window is the command window, a new command window(s) would
|
||||
be created with the old command window as its parent.
|
||||
---
|
||||
vis-prompt.c | 38 ++++++++++++++++++++------------------
|
||||
1 file changed, 20 insertions(+), 18 deletions(-)
|
||||
|
||||
--- a/vis-prompt.c
|
||||
+++ b/vis-prompt.c
|
||||
@@ -158,24 +158,26 @@ static const KeyBinding prompt_tab_bindi
|
||||
|
||||
void vis_prompt_show(Vis *vis, const char *title) {
|
||||
Win *active = vis->win;
|
||||
- Win *prompt = window_new_file(vis, title[0] == ':' ? vis->command_file : vis->search_file,
|
||||
- UI_OPTION_ONELINE);
|
||||
- if (!prompt)
|
||||
- return;
|
||||
- Text *txt = prompt->file->text;
|
||||
- text_appendf(txt, "%s\n", title);
|
||||
- Selection *sel = view_selections_primary_get(prompt->view);
|
||||
- view_cursors_scroll_to(sel, text_size(txt)-1);
|
||||
- prompt->parent = active;
|
||||
- prompt->parent_mode = vis->mode;
|
||||
- vis_window_mode_map(prompt, VIS_MODE_NORMAL, true, "<Enter>", &prompt_enter_binding);
|
||||
- vis_window_mode_map(prompt, VIS_MODE_INSERT, true, "<Enter>", &prompt_enter_binding);
|
||||
- vis_window_mode_map(prompt, VIS_MODE_INSERT, true, "<C-j>", &prompt_enter_binding);
|
||||
- vis_window_mode_map(prompt, VIS_MODE_VISUAL, true, "<Enter>", &prompt_enter_binding);
|
||||
- vis_window_mode_map(prompt, VIS_MODE_NORMAL, true, "<Escape>", &prompt_esc_binding);
|
||||
- vis_window_mode_map(prompt, VIS_MODE_INSERT, true, "<Up>", &prompt_up_binding);
|
||||
- if (CONFIG_LUA)
|
||||
- vis_window_mode_map(prompt, VIS_MODE_INSERT, true, "<Tab>", &prompt_tab_binding);
|
||||
+ if (active->file != vis->command_file && active->file != vis->search_file) {
|
||||
+ Win *prompt = window_new_file(vis, title[0] == ':' ? vis->command_file : vis->search_file,
|
||||
+ UI_OPTION_ONELINE);
|
||||
+ if (!prompt)
|
||||
+ return;
|
||||
+ Text *txt = prompt->file->text;
|
||||
+ text_appendf(txt, "%s\n", title);
|
||||
+ Selection *sel = view_selections_primary_get(prompt->view);
|
||||
+ view_cursors_scroll_to(sel, text_size(txt)-1);
|
||||
+ prompt->parent = active;
|
||||
+ prompt->parent_mode = vis->mode;
|
||||
+ vis_window_mode_map(prompt, VIS_MODE_NORMAL, true, "<Enter>", &prompt_enter_binding);
|
||||
+ vis_window_mode_map(prompt, VIS_MODE_INSERT, true, "<Enter>", &prompt_enter_binding);
|
||||
+ vis_window_mode_map(prompt, VIS_MODE_INSERT, true, "<C-j>", &prompt_enter_binding);
|
||||
+ vis_window_mode_map(prompt, VIS_MODE_VISUAL, true, "<Enter>", &prompt_enter_binding);
|
||||
+ vis_window_mode_map(prompt, VIS_MODE_NORMAL, true, "<Escape>", &prompt_esc_binding);
|
||||
+ vis_window_mode_map(prompt, VIS_MODE_INSERT, true, "<Up>", &prompt_up_binding);
|
||||
+ if (CONFIG_LUA)
|
||||
+ vis_window_mode_map(prompt, VIS_MODE_INSERT, true, "<Tab>", &prompt_tab_binding);
|
||||
+ }
|
||||
vis_mode_switch(vis, VIS_MODE_INSERT);
|
||||
}
|
||||
|
21
881-linewise-inner-objects.patch
Normal file
21
881-linewise-inner-objects.patch
Normal file
@ -0,0 +1,21 @@
|
||||
From 115884fd617114be76ccddd2389b815a3a0c6100 Mon Sep 17 00:00:00 2001
|
||||
From: Miles Canfield <miles.a.canfield@gmail.com>
|
||||
Date: Tue, 20 Oct 2020 17:17:30 -0600
|
||||
Subject: [PATCH] Limit to lines within range for inner text objects
|
||||
|
||||
---
|
||||
vis.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/vis.c
|
||||
+++ b/vis.c
|
||||
@@ -963,6 +963,9 @@ void vis_do(Vis *vis) {
|
||||
if (a->textobj->type & TEXTOBJECT_DELIMITED_OUTER) {
|
||||
r.start--;
|
||||
r.end++;
|
||||
+ } else if (linewise && (a->textobj->type & TEXTOBJECT_DELIMITED_INNER)) {
|
||||
+ r.start = text_line_next(txt, r.start);
|
||||
+ r.end = text_line_prev(txt, r.end);
|
||||
}
|
||||
|
||||
if (vis->mode->visual || (i > 0 && !(a->textobj->type & TEXTOBJECT_NON_CONTIGUOUS)))
|
99
946-non-ASCII-completion.patch
Normal file
99
946-non-ASCII-completion.patch
Normal file
@ -0,0 +1,99 @@
|
||||
From d59b98d934815e54320ad000eebfdaaf8fee344d Mon Sep 17 00:00:00 2001
|
||||
From: Silvan Jegen <s.jegen@gmail.com>
|
||||
Date: Sat, 10 Apr 2021 13:40:51 +0200
|
||||
Subject: [PATCH 1/2] vis-menu: try to preserve valid Unicode points
|
||||
|
||||
Before we were not taking non-ascii characters into account properly. With
|
||||
this patch we still mix byte counts and "grapheme cluster" (i.e. complete
|
||||
glyphs that are rendered in a terminal cell) counts but the code should
|
||||
be less broken in the more common case now.
|
||||
---
|
||||
vis-complete | 2 +-
|
||||
vis-menu.c | 47 +++++++++++++++++++++++++++++++++++++++++++----
|
||||
2 files changed, 44 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/vis-complete
|
||||
+++ b/vis-complete
|
||||
@@ -29,7 +29,7 @@ while [ $# -gt 0 ]; do
|
||||
done
|
||||
|
||||
if [ $COMPLETE_WORD = 1 ]; then
|
||||
- tr -cs '[:alnum:]_' '\n' |
|
||||
+ tr -s '[:blank:]_' '\n' |
|
||||
grep "^$(basic_regex_quote "$PATTERN")." |
|
||||
sort -u
|
||||
else
|
||||
--- a/vis-menu.c
|
||||
+++ b/vis-menu.c
|
||||
@@ -84,12 +84,46 @@ appenditem(Item *item, Item **list, Item
|
||||
|
||||
static size_t
|
||||
textwn(const char *s, int l) {
|
||||
- int b, c; /* bytes and UTF-8 characters */
|
||||
+ int c;
|
||||
|
||||
- for(b=c=0; s && s[b] && (l<0 || b<l); b++) if((s[b] & 0xc0) != 0x80) c++;
|
||||
+ for(c=0; s && s[c] && (l<0 || c<l); ) c++;
|
||||
return c+4; /* Accomodate for the leading and trailing spaces */
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * textvalidn returns the highest amount of bytes <= l of string s that
|
||||
+ * only contains valid Unicode points. This is used to make sure we don't
|
||||
+ * cut off any valid UTF-8-encoded unicode point in case there is not
|
||||
+ * enough space to render the whole text string.
|
||||
+*/
|
||||
+static ssize_t
|
||||
+textvalidn(const char *s, int l) {
|
||||
+ int c, utfcharbytes; /* byte count and UTF-8 codepoint length */
|
||||
+
|
||||
+ for (c=0; s && s[c] && (l<0 || c<l); ) {
|
||||
+ utfcharbytes = 0;
|
||||
+ if ((s[c] & 0x80) == 0) {
|
||||
+ utfcharbytes = 1;
|
||||
+ } else if ((s[c] & 0xf0) == 0xf0) {
|
||||
+ utfcharbytes = 4;
|
||||
+ } else if ((s[c] & 0xf0) == 0xe0) {
|
||||
+ utfcharbytes = 3;
|
||||
+ } else if ((s[c] & 0xe0) == 0xc0) {
|
||||
+ utfcharbytes = 2;
|
||||
+ } else {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if ((l>0 && c + utfcharbytes >= l)) {
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ c += utfcharbytes;
|
||||
+ }
|
||||
+
|
||||
+ return c;
|
||||
+}
|
||||
+
|
||||
static size_t
|
||||
textw(const char *s) {
|
||||
return textwn(s, -1);
|
||||
@@ -130,6 +164,7 @@ static void
|
||||
drawtext(const char *t, size_t w, Color col) {
|
||||
const char *prestr, *poststr;
|
||||
size_t i, tw;
|
||||
+ ssize_t valid;
|
||||
char *buf;
|
||||
|
||||
if (w<5) return; /* This is the minimum size needed to write a label: 1 char + 4 padding spaces */
|
||||
@@ -148,8 +183,12 @@ drawtext(const char *t, size_t w, Color
|
||||
memset(buf, ' ', tw);
|
||||
buf[tw] = '\0';
|
||||
memcpy(buf, t, MIN(strlen(t), tw));
|
||||
- if (textw(t) > w) /* Remember textw returns the width WITH padding */
|
||||
- for (i = MAX((tw-4), 0); i < tw; i++) buf[i] = '.';
|
||||
+ if (textw(t) > w) {/* Remember textw returns the width WITH padding */
|
||||
+ valid = textvalidn(t, w-4);
|
||||
+ if (valid < 0)
|
||||
+ die("invalid UTF-8 sequence");
|
||||
+ for (i = MAX(valid, 0); i < tw; i++) buf[i] = '.';
|
||||
+ }
|
||||
|
||||
fprintf(stderr, "%s %s %s", prestr, buf, poststr);
|
||||
free(buf);
|
384
948-soft-word-wrapping.patch
Normal file
384
948-soft-word-wrapping.patch
Normal file
@ -0,0 +1,384 @@
|
||||
From cc3a7e5566f7a33deeed5cbdcb9057e585c91dde Mon Sep 17 00:00:00 2001
|
||||
From: Andrey Proskurin <>
|
||||
Date: Sun, 9 May 2021 00:34:16 +0000
|
||||
Subject: [PATCH 1/5] view: refactor view_addch
|
||||
|
||||
---
|
||||
man/vis.1 | 5 +
|
||||
sam.c | 12 +++
|
||||
view.c | 224 +++++++++++++++++++++++++++++++++++++------------------------
|
||||
view.h | 2
|
||||
vis-cmds.c | 9 ++
|
||||
5 files changed, 164 insertions(+), 88 deletions(-)
|
||||
|
||||
--- a/man/vis.1
|
||||
+++ b/man/vis.1
|
||||
@@ -1423,6 +1423,11 @@ WARNING: modifying a memory mapped file
|
||||
Whether to use vertical or horizontal layout.
|
||||
.It Cm ignorecase , Cm ic Op Cm off
|
||||
Whether to ignore case when searching.
|
||||
+.It Ic wrapcolumn , Ic wc Op Ar 0
|
||||
+Wrap lines at minimum of window width and wrapcolumn.
|
||||
+.
|
||||
+.It Ic breakat , brk Op Dq Pa ""
|
||||
+Characters which might cause a word wrap.
|
||||
.El
|
||||
.
|
||||
.Sh COMMAND and SEARCH PROMPT
|
||||
--- a/sam.c
|
||||
+++ b/sam.c
|
||||
@@ -301,6 +301,8 @@ enum {
|
||||
OPTION_CHANGE_256COLORS,
|
||||
OPTION_LAYOUT,
|
||||
OPTION_IGNORECASE,
|
||||
+ OPTION_BREAKAT,
|
||||
+ OPTION_WRAP_COLUMN,
|
||||
};
|
||||
|
||||
static const OptionDef options[] = {
|
||||
@@ -394,6 +396,16 @@ static const OptionDef options[] = {
|
||||
VIS_OPTION_TYPE_BOOL,
|
||||
VIS_HELP("Ignore case when searching")
|
||||
},
|
||||
+ [OPTION_BREAKAT] = {
|
||||
+ { "breakat", "brk" },
|
||||
+ VIS_OPTION_TYPE_STRING|VIS_OPTION_NEED_WINDOW,
|
||||
+ VIS_HELP("Characters which might cause a word wrap")
|
||||
+ },
|
||||
+ [OPTION_WRAP_COLUMN] = {
|
||||
+ { "wrapcolumn", "wc" },
|
||||
+ VIS_OPTION_TYPE_NUMBER|VIS_OPTION_NEED_WINDOW,
|
||||
+ VIS_HELP("Wrap lines at minimum of window width and wrapcolumn")
|
||||
+ },
|
||||
};
|
||||
|
||||
bool sam_init(Vis *vis) {
|
||||
--- a/view.c
|
||||
+++ b/view.c
|
||||
@@ -80,6 +80,10 @@ struct View {
|
||||
bool need_update; /* whether view has been redrawn */
|
||||
bool large_file; /* optimize for displaying large files */
|
||||
int colorcolumn;
|
||||
+ char *breakat; /* characters which might cause a word wrap */
|
||||
+ int wrapcolumn; /* wrap lines at minimum of window width and wrapcolumn (if != 0) */
|
||||
+ int wrapcol; /* used while drawing view content, column where word wrap might happen */
|
||||
+ bool prevch_breakat; /* used while drawing view content, previous char is part of breakat */
|
||||
};
|
||||
|
||||
static const SyntaxSymbol symbols_none[] = {
|
||||
@@ -109,6 +113,7 @@ static bool view_viewport_up(View *view,
|
||||
static bool view_viewport_down(View *view, int n);
|
||||
|
||||
static void view_clear(View *view);
|
||||
+static bool view_add_cell(View *view, const Cell *cell);
|
||||
static bool view_addch(View *view, Cell *cell);
|
||||
static void selection_free(Selection*);
|
||||
/* set/move current cursor position to a given (line, column) pair */
|
||||
@@ -156,6 +161,8 @@ static void view_clear(View *view) {
|
||||
view->bottomline->next = NULL;
|
||||
view->line = view->topline;
|
||||
view->col = 0;
|
||||
+ view->wrapcol = 0;
|
||||
+ view->prevch_breakat = false;
|
||||
if (view->ui)
|
||||
view->cell_blank.style = view->ui->style_get(view->ui, UI_STYLE_DEFAULT);
|
||||
}
|
||||
@@ -164,98 +171,124 @@ Filerange view_viewport_get(View *view)
|
||||
return (Filerange){ .start = view->start, .end = view->end };
|
||||
}
|
||||
|
||||
-/* try to add another character to the view, return whether there was space left */
|
||||
-static bool view_addch(View *view, Cell *cell) {
|
||||
+static int view_max_text_width(const View *view) {
|
||||
+ if (view->wrapcolumn > 0)
|
||||
+ return MIN(view->wrapcolumn, view->width);
|
||||
+ return view->width;
|
||||
+}
|
||||
+
|
||||
+static void view_wrap_line(View *view) {
|
||||
+ Line *cur_line = view->line;
|
||||
+ int cur_col = view->col;
|
||||
+ int wrapcol = (view->wrapcol > 0) ? view->wrapcol : cur_col;
|
||||
+
|
||||
+ view->line = cur_line->next;
|
||||
+ view->col = 0;
|
||||
+ view->wrapcol = 0;
|
||||
+ if (view->line) {
|
||||
+ /* move extra cells to the next line */
|
||||
+ for (int i = wrapcol; i < cur_col; ++i) {
|
||||
+ const Cell *cell = &cur_line->cells[i];
|
||||
+ view_add_cell(view, cell);
|
||||
+ cur_line->width -= cell->width;
|
||||
+ cur_line->len -= cell->len;
|
||||
+ }
|
||||
+ }
|
||||
+ for (int i = wrapcol; i < view->width; ++i) {
|
||||
+ /* clear remaining of line */
|
||||
+ cur_line->cells[i] = view->cell_blank;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static bool view_add_cell(View *view, const Cell *cell) {
|
||||
+ size_t lineno = view->line->lineno;
|
||||
+
|
||||
+ if (view->col + cell->width > view_max_text_width(view))
|
||||
+ view_wrap_line(view);
|
||||
+
|
||||
if (!view->line)
|
||||
return false;
|
||||
+ view->line->width += cell->width;
|
||||
+ view->line->len += cell->len;
|
||||
+ view->line->lineno = lineno;
|
||||
+ view->line->cells[view->col] = *cell;
|
||||
+ view->col++;
|
||||
+ /* set cells of a character which uses multiple columns */
|
||||
+ for (int i = 1; i < cell->width; i++)
|
||||
+ view->line->cells[view->col++] = cell_unused;
|
||||
+ return true;
|
||||
+}
|
||||
|
||||
- int width;
|
||||
- size_t lineno = view->line->lineno;
|
||||
- unsigned char ch = (unsigned char)cell->data[0];
|
||||
- cell->style = view->cell_blank.style;
|
||||
+static bool view_expand_tab(View *view, Cell *cell) {
|
||||
+ cell->width = 1;
|
||||
|
||||
- switch (ch) {
|
||||
- case '\t':
|
||||
- cell->width = 1;
|
||||
- width = view->tabwidth - (view->col % view->tabwidth);
|
||||
- for (int w = 0; w < width; w++) {
|
||||
- if (view->col + 1 > view->width) {
|
||||
- view->line = view->line->next;
|
||||
- view->col = 0;
|
||||
- if (!view->line)
|
||||
- return false;
|
||||
- view->line->lineno = lineno;
|
||||
- }
|
||||
-
|
||||
- cell->len = w == 0 ? 1 : 0;
|
||||
- int t = w == 0 ? SYNTAX_SYMBOL_TAB : SYNTAX_SYMBOL_TAB_FILL;
|
||||
- strncpy(cell->data, view->symbols[t]->symbol, sizeof(cell->data)-1);
|
||||
- view->line->cells[view->col] = *cell;
|
||||
- view->line->len += cell->len;
|
||||
- view->line->width += cell->width;
|
||||
- view->col++;
|
||||
- }
|
||||
- cell->len = 1;
|
||||
- return true;
|
||||
- case '\n':
|
||||
- cell->width = 1;
|
||||
- if (view->col + cell->width > view->width) {
|
||||
- view->line = view->line->next;
|
||||
- view->col = 0;
|
||||
- if (!view->line)
|
||||
- return false;
|
||||
- view->line->lineno = lineno;
|
||||
- }
|
||||
+ int displayed_width = view->tabwidth - (view->col % view->tabwidth);
|
||||
+ for (int w = 0; w < displayed_width; ++w) {
|
||||
|
||||
- strncpy(cell->data, view->symbols[SYNTAX_SYMBOL_EOL]->symbol, sizeof(cell->data)-1);
|
||||
+ int t = (w == 0) ? SYNTAX_SYMBOL_TAB : SYNTAX_SYMBOL_TAB_FILL;
|
||||
+ const char *symbol = view->symbols[t]->symbol;
|
||||
+ strncpy(cell->data, symbol, sizeof(cell->data) - 1);
|
||||
+ cell->len = (w == 0) ? 1 : 0;
|
||||
|
||||
- view->line->cells[view->col] = *cell;
|
||||
- view->line->len += cell->len;
|
||||
- view->line->width += cell->width;
|
||||
- for (int i = view->col + 1; i < view->width; i++)
|
||||
- view->line->cells[i] = view->cell_blank;
|
||||
-
|
||||
- view->line = view->line->next;
|
||||
- if (view->line)
|
||||
- view->line->lineno = lineno + 1;
|
||||
- view->col = 0;
|
||||
- return true;
|
||||
- default:
|
||||
- if (ch < 128 && !isprint(ch)) {
|
||||
- /* non-printable ascii char, represent it as ^(char + 64) */
|
||||
- *cell = (Cell) {
|
||||
- .data = { '^', ch == 127 ? '?' : ch + 64, '\0' },
|
||||
- .len = 1,
|
||||
- .width = 2,
|
||||
- .style = cell->style,
|
||||
- };
|
||||
- }
|
||||
+ if (!view_add_cell(view, cell))
|
||||
+ return false;
|
||||
+ }
|
||||
|
||||
- if (ch == ' ') {
|
||||
- strncpy(cell->data, view->symbols[SYNTAX_SYMBOL_SPACE]->symbol, sizeof(cell->data)-1);
|
||||
+ cell->len = 1;
|
||||
+ return true;
|
||||
+}
|
||||
|
||||
- }
|
||||
+static bool view_expand_newline(View *view, Cell *cell) {
|
||||
+ size_t lineno = view->line->lineno;
|
||||
+ const char *symbol = view->symbols[SYNTAX_SYMBOL_EOL]->symbol;
|
||||
|
||||
- if (view->col + cell->width > view->width) {
|
||||
- for (int i = view->col; i < view->width; i++)
|
||||
- view->line->cells[i] = view->cell_blank;
|
||||
- view->line = view->line->next;
|
||||
- view->col = 0;
|
||||
- }
|
||||
+ strncpy(cell->data, symbol, sizeof(cell->data) - 1);
|
||||
+ cell->width = 1;
|
||||
+ if (!view_add_cell(view, cell))
|
||||
+ return false;
|
||||
|
||||
- if (view->line) {
|
||||
- view->line->width += cell->width;
|
||||
- view->line->len += cell->len;
|
||||
- view->line->lineno = lineno;
|
||||
- view->line->cells[view->col] = *cell;
|
||||
- view->col++;
|
||||
- /* set cells of a character which uses multiple columns */
|
||||
- for (int i = 1; i < cell->width; i++)
|
||||
- view->line->cells[view->col++] = cell_unused;
|
||||
- return true;
|
||||
- }
|
||||
+ view->wrapcol = 0;
|
||||
+ view_wrap_line(view);
|
||||
+ if (view->line)
|
||||
+ view->line->lineno = lineno + 1;
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+/* try to add another character to the view, return whether there was space left */
|
||||
+static bool view_addch(View *view, Cell *cell) {
|
||||
+ if (!view->line)
|
||||
return false;
|
||||
+
|
||||
+ unsigned char ch = (unsigned char)cell->data[0];
|
||||
+ bool ch_breakat = strstr(view->breakat, cell->data);
|
||||
+ if (view->prevch_breakat && !ch_breakat) {
|
||||
+ /* this is a good place to wrap line if needed */
|
||||
+ view->wrapcol = view->col;
|
||||
}
|
||||
+ view->prevch_breakat = ch_breakat;
|
||||
+ cell->style = view->cell_blank.style;
|
||||
+
|
||||
+ switch (ch) {
|
||||
+ case '\t':
|
||||
+ return view_expand_tab(view, cell);
|
||||
+ case '\n':
|
||||
+ return view_expand_newline(view, cell);
|
||||
+ case ' ': {
|
||||
+ const char *symbol = view->symbols[SYNTAX_SYMBOL_SPACE]->symbol;
|
||||
+ strncpy(cell->data, symbol, sizeof(cell->data) - 1);
|
||||
+ return view_add_cell(view, cell);
|
||||
+ }}
|
||||
+
|
||||
+ if (ch < 128 && !isprint(ch)) {
|
||||
+ /* non-printable ascii char, represent it as ^(char + 64) */
|
||||
+ *cell = (Cell) {
|
||||
+ .data = { '^', ch == 127 ? '?' : ch + 64, '\0' },
|
||||
+ .len = 1,
|
||||
+ .width = 2,
|
||||
+ .style = cell->style,
|
||||
+ };
|
||||
+ }
|
||||
+ return view_add_cell(view, cell);
|
||||
}
|
||||
|
||||
static void cursor_to(Selection *s, size_t pos) {
|
||||
@@ -492,6 +525,7 @@ void view_free(View *view) {
|
||||
selection_free(view->selections);
|
||||
free(view->textbuf);
|
||||
free(view->lines);
|
||||
+ free(view->breakat);
|
||||
free(view);
|
||||
}
|
||||
|
||||
@@ -507,27 +541,27 @@ View *view_new(Text *text) {
|
||||
View *view = calloc(1, sizeof(View));
|
||||
if (!view)
|
||||
return NULL;
|
||||
- view->text = text;
|
||||
- if (!view_selections_new(view, 0)) {
|
||||
- view_free(view);
|
||||
- return NULL;
|
||||
- }
|
||||
|
||||
+ view->text = text;
|
||||
+ view->tabwidth = 8;
|
||||
+ view->breakat = strdup("");
|
||||
+ view->wrapcolumn = 0;
|
||||
view->cell_blank = (Cell) {
|
||||
.width = 0,
|
||||
.len = 0,
|
||||
.data = " ",
|
||||
};
|
||||
- view->tabwidth = 8;
|
||||
view_options_set(view, 0);
|
||||
|
||||
- if (!view_resize(view, 1, 1)) {
|
||||
+ if (!view->breakat ||
|
||||
+ !view_selections_new(view, 0) ||
|
||||
+ !view_resize(view, 1, 1))
|
||||
+ {
|
||||
view_free(view);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
view_cursor_to(view, 0);
|
||||
-
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -862,6 +896,20 @@ int view_colorcolumn_get(View *view) {
|
||||
return view->colorcolumn;
|
||||
}
|
||||
|
||||
+void view_wrapcolumn_set(View *view, int col) {
|
||||
+ if (col >= 0)
|
||||
+ view->wrapcolumn = col;
|
||||
+}
|
||||
+
|
||||
+bool view_breakat_set(View *view, const char *breakat) {
|
||||
+ char *copy = strdup(breakat);
|
||||
+ if (!copy)
|
||||
+ return false;
|
||||
+ free(view->breakat);
|
||||
+ view->breakat = copy;
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
size_t view_screenline_goto(View *view, int n) {
|
||||
size_t pos = view->start;
|
||||
for (Line *line = view->topline; --n > 0 && line != view->lastline; line = line->next)
|
||||
--- a/view.h
|
||||
+++ b/view.h
|
||||
@@ -358,6 +358,8 @@ void view_options_set(View*, enum UiOpti
|
||||
enum UiOption view_options_get(View*);
|
||||
void view_colorcolumn_set(View*, int col);
|
||||
int view_colorcolumn_get(View*);
|
||||
+void view_wrapcolumn_set(View*, int col);
|
||||
+bool view_breakat_set(View*, const char *breakat);
|
||||
|
||||
/** Set how many spaces are used to display a tab `\t` character. */
|
||||
void view_tabwidth_set(View*, int tabwidth);
|
||||
--- a/vis-cmds.c
|
||||
+++ b/vis-cmds.c
|
||||
@@ -364,6 +364,15 @@ static bool cmd_set(Vis *vis, Win *win,
|
||||
case OPTION_IGNORECASE:
|
||||
vis->ignorecase = toggle ? !vis->ignorecase : arg.b;
|
||||
break;
|
||||
+ case OPTION_BREAKAT:
|
||||
+ if (!view_breakat_set(win->view, arg.s)) {
|
||||
+ vis_info_show(vis, "Failed to set breakat");
|
||||
+ return false;
|
||||
+ }
|
||||
+ break;
|
||||
+ case OPTION_WRAP_COLUMN:
|
||||
+ view_wrapcolumn_set(win->view, arg.i);
|
||||
+ break;
|
||||
default:
|
||||
if (!opt->func)
|
||||
return false;
|
152
959-flexible-insert-completion.patch
Normal file
152
959-flexible-insert-completion.patch
Normal file
@ -0,0 +1,152 @@
|
||||
From 37034a6549ca23f6d59deefae3d5f845c74683d1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jo=C3=A3o=20Paulo=20G=2E=20Garcia?=
|
||||
<joaopauloggarcia@gmail.com>
|
||||
Date: Sun, 1 Aug 2021 15:22:01 -0300
|
||||
Subject: [PATCH 1/3] complete-filename: allow shell expansions and escape
|
||||
"spaces".
|
||||
|
||||
Enclose prefix within double quotes so that we can properly use
|
||||
environment variables.
|
||||
|
||||
Force "tilda expansion" by replacind "~"
|
||||
with "$HOME".
|
||||
|
||||
Escape occurrences of spaces in vis-open output.
|
||||
---
|
||||
lua/plugins/complete-filename.lua | 8 ++--
|
||||
vis-complete | 76 ++++++++++++++++++--------------------
|
||||
2 files changed, 41 insertions(+), 43 deletions(-)
|
||||
|
||||
--- a/lua/plugins/complete-filename.lua
|
||||
+++ b/lua/plugins/complete-filename.lua
|
||||
@@ -15,7 +15,8 @@ vis:map(vis.modes.INSERT, "<C-x><C-f>",
|
||||
-- Strip leading delimiters for some languages
|
||||
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 cmd = string.format('vis-complete --file "%s"',
|
||||
+ prefix:gsub("^~", "$HOME"):gsub("'", "'\\''"))
|
||||
local status, out, err = vis:pipe(file, { start = 0, finish = 0 }, cmd)
|
||||
if status ~= 0 or not out then
|
||||
if err then vis:info(err) end
|
||||
@@ -43,13 +44,14 @@ vis:map(vis.modes.INSERT, "<C-x><C-o>",
|
||||
range.start = pos
|
||||
range.finish = pos
|
||||
end
|
||||
- local cmd = string.format("vis-open -- '%s'*", prefix:gsub("'", "'\\''"))
|
||||
+ local cmd = string.format('vis-open -- "%s"*',
|
||||
+ prefix:gsub("^~", "$HOME"):gsub("'", "'\\''"))
|
||||
local status, out, err = vis:pipe(file, { start = 0, finish = 0 }, cmd)
|
||||
if status ~= 0 or not out then
|
||||
if err then vis:info(err) end
|
||||
return
|
||||
end
|
||||
- out = out:gsub("\n$", "")
|
||||
+ out = out:gsub("\n$", ""):gsub(" ", "\\ ")
|
||||
file:delete(range)
|
||||
file:insert(range.start, out)
|
||||
win.selection.pos = range.start + #out
|
||||
--- a/vis-complete
|
||||
+++ b/vis-complete
|
||||
@@ -1,65 +1,61 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
-basic_regex_quote() { printf "%s" "$1" | sed 's|[\\.*^$[]|\\&|g'; }
|
||||
-glob_quote () { printf "%s" "$1" | sed 's|[\\?*[]]|\\&|g'; }
|
||||
+basic_regex_quote() { printf "%s" "$1" | sed 's/[|\\.*^$[]/\\&/g'; }
|
||||
+
|
||||
+print_completion() {
|
||||
+ sort -u \
|
||||
+ | vis-menu -b -i -l $VIS_MENU_LINES \
|
||||
+ | sed "s|^$1||" \
|
||||
+ | tr -d '\n'
|
||||
+}
|
||||
|
||||
PATTERN=""
|
||||
-COMPLETE_WORD=0
|
||||
+COMPLETE_MODE='-' # -) stdin; w) split stdin in words; f) find(1) filenames
|
||||
FIND_FILE_LIMIT=1000
|
||||
+VIS_MENU_LINES=0
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
- echo "usage: $(basename "$0") [-h] [--file|--word] [pattern]"
|
||||
+ echo "usage: $(basename "$0") [-h] [-l lines] [--file|--word] [pattern]"
|
||||
exit 0;
|
||||
;;
|
||||
--file)
|
||||
+ COMPLETE_MODE='f'
|
||||
shift
|
||||
;;
|
||||
--word)
|
||||
- COMPLETE_WORD=1
|
||||
+ COMPLETE_MODE='w'
|
||||
shift
|
||||
;;
|
||||
+ -l)
|
||||
+ VIS_MENU_LINES=$2
|
||||
+ shift 2
|
||||
+ ;;
|
||||
*)
|
||||
PATTERN="$1"
|
||||
+ QPATTERN=$(basic_regex_quote "$PATTERN") # Avoid problems with sed and grep.
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
-if [ $COMPLETE_WORD = 1 ]; then
|
||||
- tr -s '[:blank:]_' '\n' |
|
||||
- grep "^$(basic_regex_quote "$PATTERN")." |
|
||||
- sort -u
|
||||
-else
|
||||
- # Expand to absolute path because of the -path option below.
|
||||
- case $PATTERN in
|
||||
- /*)
|
||||
- XPATTERN=$PATTERN
|
||||
- ;;
|
||||
- '~'|'~/'*)
|
||||
- XPATTERN=$HOME$(echo $PATTERN | tail -c +2)
|
||||
- ;;
|
||||
- *)
|
||||
- XPATTERN=$PWD/$PATTERN
|
||||
- ;;
|
||||
- esac
|
||||
-
|
||||
- # The first path condition rules out paths that start with "." unless
|
||||
- # they start with "..". That way, hidden paths should stay hidden, but
|
||||
- # non-normalised paths should still show up.
|
||||
- find $(dirname "$XPATTERN") \
|
||||
- -name '.*' -prune \
|
||||
- -o \( \
|
||||
- ! -name '.*' \
|
||||
- -a -path "$(glob_quote "$XPATTERN")*" \
|
||||
- -print \
|
||||
- \) 2>/dev/null |
|
||||
- head -n $FIND_FILE_LIMIT |
|
||||
- sort |
|
||||
- sed "s|^$(dirname $XPATTERN)/||"
|
||||
-fi |
|
||||
- vis-menu -b |
|
||||
- sed "s|^$(basename $PATTERN)$(echo $PATTERN | tail -c 2 | fgrep /)||" |
|
||||
- tr -d '\n'
|
||||
+case $COMPLETE_MODE in
|
||||
+ -)
|
||||
+ grep "^$QPATTERN." | print_completion "$QPATTERN"
|
||||
+ ;;
|
||||
+ w)
|
||||
+ tr -cs '[:alnum:]_' '\n' \
|
||||
+ | grep "^$PATTERN." \
|
||||
+ | print_completion "$PATTERN"
|
||||
+ ;;
|
||||
+ f)
|
||||
+ find "$PATTERN"* \
|
||||
+ -name ".*" -prune \
|
||||
+ -o -print 2> /dev/null \
|
||||
+ | head -n $FIND_FILE_LIMIT \
|
||||
+ | sed "s|^$(dirname "$QPATTERN".)/||" \
|
||||
+ | print_completion "${QPATTERN##*/}"
|
||||
+ ;;
|
||||
+esac
|
22
977-makefile-multiple-targets.patch
Normal file
22
977-makefile-multiple-targets.patch
Normal file
@ -0,0 +1,22 @@
|
||||
From 880acf5d42d1844a10fa3397961a4e02700ad4af Mon Sep 17 00:00:00 2001
|
||||
From: Aki <please@ignore.pl>
|
||||
Date: Mon, 16 Aug 2021 22:24:18 +0200
|
||||
Subject: [PATCH 1/2] Makefile lexer now supports multiple targets in single
|
||||
definition
|
||||
|
||||
---
|
||||
lua/lexers/makefile.lua | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/lua/lexers/makefile.lua
|
||||
+++ b/lua/lexers/makefile.lua
|
||||
@@ -72,7 +72,8 @@ local special_target = token(l.CONSTANT,
|
||||
'.SILENT', '.EXPORT_ALL_VARIABLES', '.NOTPARALLEL', '.ONESHELL', '.POSIX'
|
||||
}, '.'))
|
||||
local normal_target = token('target', (l.any - l.space - S(':#='))^1)
|
||||
-local target = l.starts_line((special_target + normal_target) * ws^0 *
|
||||
+local target_list = normal_target * (ws * normal_target)^0
|
||||
+local target = l.starts_line((special_target + target_list) * ws^0 *
|
||||
#(':' * -P('=')))
|
||||
|
||||
-- Identifiers.
|
15
_service
Normal file
15
_service
Normal file
@ -0,0 +1,15 @@
|
||||
<services>
|
||||
<service name="tar_scm" mode="buildtime">
|
||||
<param name="versionprefix">0.7+git</param>
|
||||
<param name="url">https://github.com/martanne/vis.git</param>
|
||||
<param name="scm">git</param>
|
||||
<param name="exclude">.git*</param>
|
||||
<param name="changesgenerate">enable</param>
|
||||
<param name="changesauthor">mcepl@cepl.eu</param>
|
||||
</service>
|
||||
<service name="recompress" mode="buildtime">
|
||||
<param name="file">*.tar</param>
|
||||
<param name="compression">gz</param>
|
||||
</service>
|
||||
<service name="set_version" mode="buildtime" />
|
||||
</services>
|
4
_servicedata
Normal file
4
_servicedata
Normal file
@ -0,0 +1,4 @@
|
||||
<servicedata>
|
||||
<service name="tar_scm">
|
||||
<param name="url">https://github.com/martanne/vis.git</param>
|
||||
<param name="changesrevision">0cc684f26b136029f4f49d808761d69228f42dff</param></service></servicedata>
|
63
no-EOL-to-wl-clipboard.patch
Normal file
63
no-EOL-to-wl-clipboard.patch
Normal file
@ -0,0 +1,63 @@
|
||||
Return-Path: <mcepl@cepl.eu>
|
||||
Delivered-To: <mcepl@cepl.eu>
|
||||
Received: from redcrew.org
|
||||
by redcrew.org (Dovecot) with LMTP id WRniDQJfz2EqMQAAsTppAA
|
||||
for <mcepl@cepl.eu>; Fri, 31 Dec 2021 21:00:20 +0100
|
||||
Received: from stitny.localdomain (unknown [83.208.252.159])
|
||||
(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))
|
||||
(No client certificate requested)
|
||||
by redcrew.org (Postfix) with ESMTPSA id 38AC7C70;
|
||||
Fri, 31 Dec 2021 21:00:18 +0100 (CET)
|
||||
Received: from stitny.localdomain (localhost [127.0.0.1])
|
||||
by stitny.localdomain (Postfix) with ESMTP id 79FC54BDC4DD;
|
||||
Fri, 31 Dec 2021 21:00:17 +0100 (CET)
|
||||
From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mcepl@cepl.eu>
|
||||
To: ~martanne/devel@lists.sr.ht
|
||||
Cc: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mcepl@cepl.eu>
|
||||
Subject: [vis] wl-paste and wl-copy should not add \n to the end of the clipboard.
|
||||
Date: Fri, 31 Dec 2021 20:56:32 +0100
|
||||
Message-Id: <20211231195631.12681-1-mcepl@cepl.eu>
|
||||
X-Mailer: git-send-email 2.34.1
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Hello,
|
||||
|
||||
it is very uncomfortable, that vis-clipboard (at least for me)
|
||||
always adds \n to the pasted text. I am not sure whether it
|
||||
is because of missing -n for wl-copy or the missing one for
|
||||
wl-paste, so I have added the one for both, and I am very much
|
||||
open to the discussion on the possible better solution.
|
||||
|
||||
Best,
|
||||
|
||||
Matěj
|
||||
|
||||
---
|
||||
vis-clipboard | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/vis-clipboard
|
||||
+++ b/vis-clipboard
|
||||
@@ -81,17 +81,17 @@ vc_paste() {
|
||||
|
||||
vc_wlclipboard_copy() {
|
||||
if [ "$sel" = "primary" ]; then
|
||||
- wl-copy --primary -t TEXT
|
||||
+ wl-copy --trim-newline --primary -t TEXT
|
||||
else
|
||||
- wl-copy -t TEXT
|
||||
+ wl-copy --trim-newline -t TEXT
|
||||
fi
|
||||
}
|
||||
|
||||
vc_wlclipboard_paste() {
|
||||
if [ "$sel" = "primary" ]; then
|
||||
- wl-paste --primary -t text
|
||||
+ wl-paste --no-newline --primary -t text
|
||||
else
|
||||
- wl-paste -t text
|
||||
+ wl-paste --no-newline -t text
|
||||
fi
|
||||
}
|
||||
|
2
vis-rpmlintrc
Normal file
2
vis-rpmlintrc
Normal file
@ -0,0 +1,2 @@
|
||||
# gh#martanne/vis#990
|
||||
addFilter("potential-bashisms.*/usr/bin/vis-clipboard")
|
BIN
vis-test-0.5.tar.gz
Normal file
BIN
vis-test-0.5.tar.gz
Normal file
Binary file not shown.
449
vis.changes
Normal file
449
vis.changes
Normal file
@ -0,0 +1,449 @@
|
||||
-------------------------------------------------------------------
|
||||
Sun May 29 18:00:53 UTC 2022 - mcepl@cepl.eu
|
||||
|
||||
- Update to version 0.7+git.1653832963.0cc684f:
|
||||
* filetype: Set diff filetype for COMMIT_EDITMSG files
|
||||
* filetype: Allow ".PKGBUILD" extension for PKGBUILDs
|
||||
* filetype: add .glif to xml
|
||||
* filetype.lua: Add "text/x-script.python" to python
|
||||
* README: fix typo
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu May 05 15:10:36 UTC 2022 - mcepl@cepl.eu
|
||||
|
||||
- Update to version 0.7+git.1651608857.d0808c7:
|
||||
* Re-enabled tre by #including <stddef.h>.
|
||||
* README: x/freenode/c/libera/
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 29 23:27:53 UTC 2022 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Add 1000-reenable-stddef-musl.patch (gh#martanne/vis#1000).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 31 21:07:34 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Add no-EOL-to-wl-clipboard.patch to eliminate unnecessary
|
||||
on paste.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Dec 26 19:58:00 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- So, I'll try 675-non-block_subproc.patch again.
|
||||
- But comment out 558-gf_reimplementation.patch again, because it
|
||||
causes gh#martanne/vis#827.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Dec 20 11:21:47 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Mix patches again
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Dec 19 15:03:24 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Comment out 558-gf_reimplementation.patch, because it seems to
|
||||
ignite gh#martanne/vis#827 again.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Dec 14 11:41:12 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Add 558-gf_reimplementation.patch to add advanced
|
||||
reimplementation of `gf` command.
|
||||
- Add vis-rpmlintrc to avoid complaints about bashisms in
|
||||
vis-clipboard (gh#martanne/vis#990).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Nov 17 18:10:33 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Add 977-makefile-multiple-targets.patch to fix lexers/makefile
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Aug 22 16:47:29 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Add patch 946-non-ASCII-completion.patch fixing gh#martanne/vis#941
|
||||
- Add patch 948-soft-word-wrapping.patch adding wrapping of lines.
|
||||
- Add patch 617-vis-highlight.patch to add vis-highlight command.
|
||||
- Add patch 959-flexible-insert-completion.patch to improve
|
||||
insert completion (and make it possible to use
|
||||
https://github.com/jpaulogg/vis-ins-completion)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat May 15 20:25:45 UTC 2021 - mcepl@cepl.eu
|
||||
|
||||
- Update to version 0.7+git.1618946717.1a958f2:
|
||||
* filetype: Set "groovy" for Jenkinsfile
|
||||
* ci: verify coverity scan script before using it
|
||||
* ci: verify codecov script before using it
|
||||
* vis: Add readline Ctrl+A/E bindings
|
||||
* add lua5.4 in configure script
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 16 18:11:34 UTC 2021 - mcepl@cepl.eu
|
||||
|
||||
- Update to version 0.7+git.1613402937.0cccd6e:
|
||||
* vis: correctly close pipe connected to stdin of external process
|
||||
* sam: simplify trailing match handling for x/y commands
|
||||
* sam: tweak handling of zero length matches in y commands
|
||||
* gitignore: remove vim specific swap files
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 5 23:55:37 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Add 699-no-crash-reenter-prompt.patch to fix
|
||||
gh#martanne/vis#628.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 5 23:00:35 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Add BR libselinux-devel to make vis SELinux aware.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 5 21:53:41 UTC 2021 - mcepl@cepl.eu
|
||||
|
||||
- Update to version 0.7+git.1611579794.29f89df:
|
||||
* test: update
|
||||
* sam: produce empty match at the end of looped range
|
||||
* sam: only skip the last empty match if it follows a newline
|
||||
* build: update alpine in docker build to version 3.13
|
||||
* Adding .sv extension to verilog syntax highlighter
|
||||
* filetype: Detect make shebang for "makefile".
|
||||
* filetype: Set "bash" for APKBUILD and .ebuild.
|
||||
- Add libselinux-devel BR to enable SELinux support.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jan 18 18:48:34 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Switch to Lua 5.4 by force.
|
||||
- Add back non-block_subproc.patch (rebase of gh#martanne/vis#675
|
||||
on the top of master).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jan 14 17:32:17 UTC 2021 - mcepl@cepl.eu
|
||||
|
||||
- Update to version 0.7+git.1609943606.686ba1c:
|
||||
* lexers/git-rebase: also highlight break command
|
||||
* lexers/strace: improve comments, field names and syscall results
|
||||
* Mention pkg-config in README
|
||||
* vis-lua: provide file.permission property
|
||||
* vis: implement multiline to/till motions
|
||||
* vis: rename to/till motion internals
|
||||
* lua: fix luacheck warnings
|
||||
* fix typos in comments
|
||||
* vis: make O implementation independent of <Up> mapping
|
||||
* lexers: fix bug in bash lexer for last here-doc
|
||||
* build: add git based version information back
|
||||
* Set version to 0.7
|
||||
* Add gemini lexer
|
||||
* Zig filetype entry.
|
||||
* Adding Zig lexer.
|
||||
* Heredocs with "-" can have spaces before closing
|
||||
* lexers: add meson build file lexer
|
||||
* ci: avoid usage of ::add-path:: command in GitHub action
|
||||
* test: update
|
||||
* view: make view_selections_dispose_all O(n)
|
||||
* Make SourceHut badge show status of master branch commits
|
||||
* correct a couple of typos and distinguish between immediate and waiting operators
|
||||
* vis: fix <C-c> processing after SIGINT
|
||||
* build: fix curses library/pkg-config name
|
||||
* vis: use localtime_r(3) instead of localtime(3)
|
||||
* sam: simplify boolean expression, start < end implies end > 0
|
||||
* map: remove no longer used map_leaf function
|
||||
* build: use feature test macros for memrchr configure check
|
||||
* build: add -D_NETBSD_SOURCE for NetBSD
|
||||
* lua: fix typo in lilypond file extension
|
||||
* test: update
|
||||
* text: simplify iterator_init
|
||||
* text: fix invalid pointer comparison
|
||||
* text: avoid invalid pointer arithmetic
|
||||
* test: update
|
||||
* text: move higher level utility functions to separate file
|
||||
* text: move generic iterator functionality to separate file
|
||||
* text: move I/O related code to separate file
|
||||
* build: list source files on separate lines
|
||||
* text: provide public text_iterator_init
|
||||
* text: rename internal text_iterator_init
|
||||
* text: mark return value of text_iterator_text as const
|
||||
* text: make text_snapshot return whether it succeeded
|
||||
* array: mark array_peek argument as const
|
||||
* array: mark array_capacity argument as const
|
||||
* array: mark array_init_from argument as const
|
||||
* text: mark text_delete_range range argument as const
|
||||
* text: mark text_save_write_range range argument as const
|
||||
* text: mark text_mmaped argument as const
|
||||
* array: mark array_get_ptr argument as const
|
||||
* array: mark array_get argument as const
|
||||
* array: mark array_length argument as const
|
||||
* text: mark text_write{,_range} argument as const
|
||||
* text: mark text_size argument as const
|
||||
* text: mark text_mark_get argument as const
|
||||
* text: mark text_iterator_byte_get argument as const
|
||||
* text: mark text_bytes_alloc0 argument as const
|
||||
* text: mark text_byte(s)_get argument as const
|
||||
* text: mark text_iterator_get argument as const
|
||||
* text: mark text_state argument as const
|
||||
* text: mark text_modified argument as const
|
||||
* text: mark text_stat argument as const
|
||||
* text: introduce text_iterator_text
|
||||
* text: introduce text_iterator_has_{next,prev}
|
||||
* text: add namespace prefix to block type constants
|
||||
* text: avoid direct access to txt->blocks in I/O related code
|
||||
* text: introduce text_saved
|
||||
* text: use public text_stat interface where possible
|
||||
* text: introduce block_load
|
||||
* text: store blocks in array
|
||||
* text: simplify reading of initial file content
|
||||
* vis: add vis-selection-new-match-all
|
||||
* vis: refactor selections_match_next
|
||||
* text: add text_object_find_next/prev
|
||||
* filetype: and Node.js module extensions
|
||||
* test: update
|
||||
* lexers: add .ts as a javascript (until typescript gets its own)
|
||||
* Add ignorecase option
|
||||
* lexers: add Mikrotik RouterOS script lexer
|
||||
* filetype: do not match text/plain too early
|
||||
* filetype: use scheme lexer for racket files
|
||||
* text: improve text_line_down on the last line of the file
|
||||
* vis-lua: provide vis.mark property
|
||||
* vis-lua: use utility function to translate mark names
|
||||
* vis: provide reverse mapping function for mark names
|
||||
* vis-lua: provide vis.register property
|
||||
* vis-lua: use utility function to translate register names
|
||||
* vis: provide reverse mapping function for register names
|
||||
* vis-lua: fix mark_names Lua doc indentation
|
||||
* Pass up terminal CSI as events to Lua.
|
||||
* text: improve and simplify inner word text object
|
||||
* vis: improve C-n behavior in visual mode
|
||||
* vis: implement C-n in normal mode with a mapping to viw
|
||||
* text: make inner text objects work on single delimiting symbols
|
||||
* text: provide save function taking a directory descriptor
|
||||
* text: provide load function taking a directory descriptor
|
||||
* text: move misplaced text_save documentation snippet
|
||||
* vis-lua: fix redraw method name in API documentation
|
||||
* vis-lua: make file.modified assignable
|
||||
* doc: update doxygen configuration
|
||||
* Update copyright year
|
||||
* doc: update version number in doxygen config
|
||||
* doc: use c as default sphinx role
|
||||
* doc: enable C syntax highlighting by default
|
||||
* doc: fix a couple of API doc warnings
|
||||
* vis: remove ae outer entire text object
|
||||
* vis: remove ie inner entire text object
|
||||
* vis: remove z> rightmost pairwise selection combinator
|
||||
* vis: remove z< leftmost pairwise selection combinator
|
||||
* vis: remove z- shorter pairwise selection combinator
|
||||
* vis: remove z+ longer pairwise selection combinator
|
||||
* vis: remove z& pairwise selection intersection
|
||||
* vis: remove z| pairwise union
|
||||
* vis: remove commented entries from default config
|
||||
* vis: use ~ instead of ! for selection complement
|
||||
* vis: remove ~ as alias for g~
|
||||
* vis: remove window related aliases from default config
|
||||
* vis: remove special key aliases from default config
|
||||
* test: update
|
||||
* test: update
|
||||
* support for primary clipboard
|
||||
* vis-open: add trailing "/" for the folders
|
||||
* build: mark distclean and testclean targets as PHONY
|
||||
* Makefile: add testclean target
|
||||
* Makefile: add distclean target
|
||||
* build: define LUA_COMPAT_5_3
|
||||
* text: simplify remapping of original file content
|
||||
* text: remove dead store
|
||||
* text: code cleanup, use local variable
|
||||
* text: fix typo in comments, no code change
|
||||
* Support wayland clipboard (wl-clipboard)
|
||||
* build: add git based version information back
|
||||
* build: set version to 0.6
|
||||
* ui: fix terminal UI on serial console
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Dec 8 18:42:07 UTC 2020 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Update to the released version 0.7:
|
||||
This is mostly a bug fix release with fixes for a few cases of
|
||||
undefined behavior and preliminary work for experimentation with
|
||||
different core text management data structures and general editor
|
||||
architecture.
|
||||
- fix UB in core text management data structure
|
||||
- text refactoring, splitting out reusable text iterator and I/O
|
||||
components
|
||||
- new *at() variants taking directory descriptor for file load/save
|
||||
API
|
||||
- more efficient initial file read, avoiding spurious syscalls and
|
||||
copy
|
||||
- text API cleanups, const correctness improvements
|
||||
- increased test coverage for core text data structure
|
||||
- support for Lua 5.4
|
||||
- Lua API improvements: vis.mark, vis.register, vis.win.file.modified
|
||||
- and support for terminal CSI events
|
||||
- NetBSD support
|
||||
- new :set ignorecase option to search case independently
|
||||
- new visual mode mapping <C-a> to select all matching selections
|
||||
- fix mappings involving non-leading <C-c>
|
||||
- minor file detection fixes for racket, node.js modules, Typescript
|
||||
and liliypond
|
||||
- new lexers for Zig, meson build system, Mikrotik RouterOS scripts,
|
||||
Gemini
|
||||
- improved inner word text object and its use for <C-n> in normal mode
|
||||
- improved <C-n> behavior in visual mode
|
||||
- removed ie, ae inner/outer entire text object, use :, as shorthand
|
||||
for :0,$
|
||||
- removed pairwise selection combinators z>, z<, z-, z+, z&, z|
|
||||
- remove ~ as alias for g~
|
||||
- use ~ instead of ! for selection complement
|
||||
- remove special key and window related aliases
|
||||
- vis-open(1) adds a trailing slash to indicate folders
|
||||
- add primary clipboard support to vis-clipboard(1)
|
||||
- support wayland clipboard using wl-clipboard(1)
|
||||
- new Makefile targets: distclean, testclean
|
||||
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jun 15 07:25:48 UTC 2020 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Update to the released version 0.6 (all changes since 0.5):
|
||||
- bounded time syntax highlighting using the :set redrawtime
|
||||
option
|
||||
- support optional count for sam's text commands e.g. :i3/-/
|
||||
- make <C-n> in visual mode match next occurence of existing
|
||||
selection
|
||||
- warn when attempting to write to an existing file
|
||||
- improved file change detection based on inode instead of path
|
||||
information
|
||||
- fix file saves with modifications in file pre-save events
|
||||
- fix save on file systems without fsync(2) support on
|
||||
directory descriptors
|
||||
- do not unlink file~ when saving file
|
||||
- introduce distinct vis-menu(1) exit codes
|
||||
- modify Lua package.path to include /init.lua
|
||||
- performance improvements for the HTML, XML and YAML lexers
|
||||
- new Julia and Elm lexers, better defaults for standard text
|
||||
lexer
|
||||
- support optional exit status in :q and :qall commands
|
||||
- better temporary file creation using mkstemp(2)
|
||||
- performance improvements in highlight matching parentheses
|
||||
- improved behavior of ^ and $ in searches and looping commands
|
||||
- improved search wrap around behavior
|
||||
- new :set layout option to specify window orientation
|
||||
- improved filetype detection by matching known filenames
|
||||
exactly
|
||||
- support DragonFly BSD in configure script
|
||||
- better manual page, fixed warnings
|
||||
- removed gp, gP, gq
|
||||
- implement g~, gu and gU using tr(1), they are no longer
|
||||
operators
|
||||
- removed v and V in operator pending mode
|
||||
- avoid crash if $TERM is unset
|
||||
- keep selections after :> command
|
||||
- normalize selections after : command execution
|
||||
- show pending input queue content in status bar
|
||||
- make r<Enter> insert a new line
|
||||
- new :set loadmethod option, valid values are read, mmap or
|
||||
auto
|
||||
- always apply :| command to existing selections
|
||||
- fix terminal UI on serial console
|
||||
- various code cleanups, removal of VLA
|
||||
- resets count, if applicable
|
||||
- fix :X and :Y commands which were interchanged
|
||||
- don't strip executables by default, provide install-strip
|
||||
target
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 05 13:33:07 UTC 2020 - mcepl@cepl.eu
|
||||
|
||||
- Update to version 0.5+git.1590819266.c37f09e:
|
||||
* test: update
|
||||
* vis: fix implicit enum conversion warning
|
||||
* build: update alpine in docker build to version 3.12
|
||||
* doc: update outdated version information
|
||||
* doc: update sphinx configuration to python 3
|
||||
* test: update
|
||||
* text: introduce text_save_method, remove text_save_range
|
||||
* test: update
|
||||
* build: use -O2 by default
|
||||
* vis: cleanup pre-processing of :-commands
|
||||
* Tweak README
|
||||
* vt100: do not crash if termkey is not yet initialized
|
||||
* ui: fix line number drawing
|
||||
* build: fix _XOPEN_SOURCE redefinition warning
|
||||
* vis: make <Escape> reset count in visual modes
|
||||
* vis: make <Escape> reset count in normal mode
|
||||
* lexers: prioritize markdown list rule
|
||||
* lexers: make markdown white space rule less greedy
|
||||
* man: document theme location
|
||||
* Avoid use of VLAs
|
||||
* vt100: use shorter escape sequence to clear screen
|
||||
* Add Julia lexer
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 16 22:18:41 UTC 2020 - mcepl@cepl.eu
|
||||
|
||||
- Update to version 0.5+git.1584517720.08a550d:
|
||||
* color-column: Don't change fg/bg if not set explicitly
|
||||
* Set single cursor style as primary, not secondary
|
||||
* sam: fix X and Y commands which were interchanged
|
||||
* Add Elm lexer
|
||||
* sam: fix spurious "file exists" warnings
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Feb 26 23:07:04 UTC 2020 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Fix the license: it is ISC, not MIT.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Feb 26 09:20:25 UTC 2020 - mcepl@cepl.eu
|
||||
|
||||
- Update to version 0.5+git.1582699959.bdfea7e:
|
||||
* build: provide install-strip make target
|
||||
* ci: fix Alpine build by installing terminfo data
|
||||
* test: update
|
||||
* ci: remove Travis CI integration
|
||||
* ci: remove Appveyor integration
|
||||
* ci: improve OpenBSD Lua installation
|
||||
* ci: make sure en_US.UTF-8 locale is available on Debian
|
||||
* ci: disable codecov commit status updates
|
||||
* vis-lua: implement vis:redraw()
|
||||
* lua: add `redrawtime` option
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Feb 26 08:42:15 UTC 2020 - mcepl@cepl.eu
|
||||
|
||||
- Update to version 0.5+git.1582699959.bdfea7e:
|
||||
* build: provide install-strip make target
|
||||
* ci: fix Alpine build by installing terminfo data
|
||||
* test: update
|
||||
* ci: remove Travis CI integration
|
||||
* ci: remove Appveyor integration
|
||||
* ci: improve OpenBSD Lua installation
|
||||
* ci: make sure en_US.UTF-8 locale is available on Debian
|
||||
* ci: disable codecov commit status updates
|
||||
* vis-lua: implement vis:redraw()
|
||||
* lua: add `redrawtime` option
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Feb 26 08:41:57 UTC 2020 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- The latest upstream commit doesn't strip binaries anymore
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Feb 24 16:11:28 CET 2020 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- make install STRIP=true to avoid stripping. Avoid public nudity!
|
||||
gh#martanne/vis#811
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Dec 26 00:17:14 CET 2019 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Add BR of tre-devel, not just tre.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Sep 22 01:22:08 CEST 2019 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Remove Debian-related files
|
||||
- Add missing BRs.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Dec 12 21:42:43 UTC 2016 - code@baez.nyc
|
||||
|
||||
initial build from git
|
||||
|
114
vis.spec
Normal file
114
vis.spec
Normal file
@ -0,0 +1,114 @@
|
||||
#
|
||||
# spec file for package vis
|
||||
#
|
||||
# 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
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
%define test_version 0.5
|
||||
Name: vis
|
||||
Version: 0.7+git.1653832963.0cc684f
|
||||
Release: 0
|
||||
Summary: An editor combining the strengths of both vi(m) and sam
|
||||
License: ISC
|
||||
Group: Productivity/Text/Editors
|
||||
URL: https://github.com/martanne/vis
|
||||
# Source0: https://github.com/martanne/%%{name}/archive/v%%{version}.tar.gz#/%%{name}-%%{version}.tar.gz
|
||||
Source0: vis-%{version}.tar.gz
|
||||
Source1: https://github.com/martanne/vis-test/releases/download/v%{test_version}/vis-test-%{test_version}.tar.gz
|
||||
Source99: vis-rpmlintrc
|
||||
# PATCH-FEATURE-UPSTREAM 675-non-block_subproc.patch gh#martanne/vis#675 mcepl@suse.com
|
||||
# adds function vis.commuincate which spawns a process and returns handles to its std files.
|
||||
# seems to be the cause of crash in gh#martanne/vis#988
|
||||
Patch0: 675-non-block_subproc.patch
|
||||
# PATCH-FIX-UPSTREAM 699-no-crash-reenter-prompt.patch gh#martanne/vis#628 mcepl@suse.com
|
||||
# don't crash on reenter of the prompt window
|
||||
Patch1: 699-no-crash-reenter-prompt.patch
|
||||
# PATCH-FIX-UPSTREAM 946-non-ASCII-completion.patch gh#martanne/vis#941 mcepl@suse.com
|
||||
# make vis-menu handle non-ASCII characters better
|
||||
Patch2: 946-non-ASCII-completion.patch
|
||||
# # PATCH-FEATURE-UPSTREAM 948-soft-word-wrapping.patch gh#martanne/vis#948 mcepl@suse.com
|
||||
# # adds soft word wrapping (linebreak in vim)
|
||||
# Patch3: 948-soft-word-wrapping.patch
|
||||
# PATCH-FEATURE-UPSTREAM 617-vis-highlight.patch gh#martanne/vis#617 mcepl@suse.com
|
||||
# add vis-highlight command
|
||||
Patch4: 617-vis-highlight.patch
|
||||
# PATCH-FEATURE-UPSTREAM 959-flexible-insert-completion.patch gh#martanne/vis#959
|
||||
# allow changes for https://github.com/jpaulogg/vis-ins-completion/tree/flex-completion
|
||||
Patch5: 959-flexible-insert-completion.patch
|
||||
# PATCH-FEATURE-UPSTREAM 977-makefile-multiple-targets.patch gh#martanne/vis#977
|
||||
# lexers/makefile: Support multiple targets in a single definition
|
||||
Patch6: 977-makefile-multiple-targets.patch
|
||||
# PATCH-FIX-UPSTREAM 558-gf_reimplementation.patch gh#martanne/vis#558 mcepl@suse.com
|
||||
# Implementation of the gf command, v2
|
||||
# This patch seems to ignite gh#martanne/vis#827 again.
|
||||
Patch7: 558-gf_reimplementation.patch
|
||||
# PATCH-FIX-UPSTREAM no-EOL-to-wl-clipboard.patch mcepl@suse.com
|
||||
# don't add \n on paste
|
||||
# from https://lists.sr.ht/~martanne/devel/%3C20211231195631.12681-1-mcepl%40cepl.eu%3E
|
||||
Patch8: no-EOL-to-wl-clipboard.patch
|
||||
# PATCH-FIX-UPSTREAM 881-linewise-inner-objects.patch gh#martanne/vis#881 mcepl@suse.com
|
||||
# make linewise inner objects work differently from outer ones
|
||||
Patch9: 881-linewise-inner-objects.patch
|
||||
BuildRequires: libselinux-devel
|
||||
BuildRequires: libtermkey-devel
|
||||
BuildRequires: ncurses-devel
|
||||
BuildRequires: tar
|
||||
BuildRequires: tre-devel
|
||||
ExclusiveArch: x86_64 %{ix86}
|
||||
%if 0%{?suse_version} > 1500
|
||||
BuildRequires: lua54-devel
|
||||
BuildRequires: lua54-lpeg
|
||||
Requires: lua54
|
||||
%else
|
||||
BuildRequires: lua-devel
|
||||
BuildRequires: lua-lpeg
|
||||
Requires: lua
|
||||
%endif
|
||||
|
||||
%description
|
||||
Vis aims to be a modern, legacy free, simple yet efficient editor combining the strengths of both vi(m) and sam.
|
||||
|
||||
It extends vi's modal editing with built-in support for multiple cursors/selections and combines it with sam's structural regular expression based command language.
|
||||
|
||||
%prep
|
||||
%autosetup -p1
|
||||
|
||||
tar -xC test/ --strip-components 1 -f %{SOURCE1}
|
||||
|
||||
%build
|
||||
export CFLAGS="%{optflags} -fcommon"
|
||||
%configure
|
||||
%make_build debug
|
||||
|
||||
%install
|
||||
%make_install
|
||||
|
||||
%check
|
||||
# According to the debian/rules:
|
||||
# The vim tests harness is not solid, let's skip them for the moment.
|
||||
# Upstream mentioned the possibility of phasing them out entirely.
|
||||
%make_build -C test/core
|
||||
# No busted yet make -C test/lua
|
||||
%make_build -C test/vis
|
||||
|
||||
%files
|
||||
%{_bindir}/vis*
|
||||
%{_datadir}/vis
|
||||
%{_mandir}/man1/*
|
||||
%dir %{_datadir}/doc/vis
|
||||
%{_datadir}/doc/vis/LICENSE
|
||||
%{_datadir}/doc/vis/README.md
|
||||
|
||||
%changelog
|
Loading…
Reference in New Issue
Block a user