mirror of
https://github.com/neovim/neovim.git
synced 2024-12-25 05:35:10 -07:00
Fix/add more files with to clint-files.txt
This commit is contained in:
parent
0805911434
commit
1fc7d6a0c5
@ -1,2 +1,19 @@
|
|||||||
|
src/indent.c
|
||||||
|
src/indent.h
|
||||||
|
src/os/env.c
|
||||||
|
src/os/event.c
|
||||||
|
src/os/event_defs.h
|
||||||
|
src/os/event.h
|
||||||
|
src/os/input.c
|
||||||
|
src/os/input.h
|
||||||
src/os/job.c
|
src/os/job.c
|
||||||
|
src/os/job_defs.h
|
||||||
src/os/job.h
|
src/os/job.h
|
||||||
|
src/os/mem.c
|
||||||
|
src/os/os.h
|
||||||
|
src/os/shell.c
|
||||||
|
src/os/shell.h
|
||||||
|
src/os/signal.c
|
||||||
|
src/os/signal.h
|
||||||
|
src/os/time.c
|
||||||
|
src/os/time.h
|
||||||
|
@ -741,7 +741,7 @@ EXTERN int swap_exists_action INIT(= SEA_NONE);
|
|||||||
EXTERN int swap_exists_did_quit INIT(= FALSE);
|
EXTERN int swap_exists_did_quit INIT(= FALSE);
|
||||||
/* Selected "quit" at the dialog. */
|
/* Selected "quit" at the dialog. */
|
||||||
|
|
||||||
EXTERN char_u *IObuff; /* sprintf's are done in this buffer,
|
EXTERN char_u IObuff[IOSIZE]; /* sprintf's are done in this buffer,
|
||||||
size is IOSIZE */
|
size is IOSIZE */
|
||||||
EXTERN char_u *NameBuff; /* file names are expanded in this
|
EXTERN char_u *NameBuff; /* file names are expanded in this
|
||||||
* buffer, size is MAXPATHL */
|
* buffer, size is MAXPATHL */
|
||||||
|
46
src/indent.c
46
src/indent.c
@ -31,7 +31,7 @@ int get_indent_lnum(linenr_T lnum)
|
|||||||
// "buf".
|
// "buf".
|
||||||
int get_indent_buf(buf_T *buf, linenr_T lnum)
|
int get_indent_buf(buf_T *buf, linenr_T lnum)
|
||||||
{
|
{
|
||||||
return get_indent_str(ml_get_buf(buf, lnum, FALSE), (int)buf->b_p_ts);
|
return get_indent_str(ml_get_buf(buf, lnum, false), (int)buf->b_p_ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ int get_indent_str(char_u *ptr, int ts)
|
|||||||
// SIN_INSERT: insert the indent in front of the line.
|
// SIN_INSERT: insert the indent in front of the line.
|
||||||
// SIN_UNDO: save line for undo before changing it.
|
// SIN_UNDO: save line for undo before changing it.
|
||||||
// @param size measured in spaces
|
// @param size measured in spaces
|
||||||
// Returns TRUE if the line was changed.
|
// Returns true if the line was changed.
|
||||||
int set_indent(int size, int flags)
|
int set_indent(int size, int flags)
|
||||||
{
|
{
|
||||||
char_u *p;
|
char_u *p;
|
||||||
@ -74,10 +74,10 @@ int set_indent(int size, int flags)
|
|||||||
int todo;
|
int todo;
|
||||||
int ind_len; // Measured in characters.
|
int ind_len; // Measured in characters.
|
||||||
int line_len;
|
int line_len;
|
||||||
int doit = FALSE;
|
int doit = false;
|
||||||
int ind_done = 0; // Measured in spaces.
|
int ind_done = 0; // Measured in spaces.
|
||||||
int tab_pad;
|
int tab_pad;
|
||||||
int retval = FALSE;
|
int retval = false;
|
||||||
|
|
||||||
// Number of initial whitespace chars when 'et' and 'pi' are both set.
|
// Number of initial whitespace chars when 'et' and 'pi' are both set.
|
||||||
int orig_char_len = -1;
|
int orig_char_len = -1;
|
||||||
@ -129,7 +129,7 @@ int set_indent(int size, int flags)
|
|||||||
tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts);
|
tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts);
|
||||||
|
|
||||||
if ((todo >= tab_pad) && (orig_char_len == -1)) {
|
if ((todo >= tab_pad) && (orig_char_len == -1)) {
|
||||||
doit = TRUE;
|
doit = true;
|
||||||
todo -= tab_pad;
|
todo -= tab_pad;
|
||||||
ind_len++;
|
ind_len++;
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ int set_indent(int size, int flags)
|
|||||||
// Count tabs required for indent.
|
// Count tabs required for indent.
|
||||||
while (todo >= (int)curbuf->b_p_ts) {
|
while (todo >= (int)curbuf->b_p_ts) {
|
||||||
if (*p != TAB) {
|
if (*p != TAB) {
|
||||||
doit = TRUE;
|
doit = true;
|
||||||
} else {
|
} else {
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ int set_indent(int size, int flags)
|
|||||||
// Count spaces required for indent.
|
// Count spaces required for indent.
|
||||||
while (todo > 0) {
|
while (todo > 0) {
|
||||||
if (*p != ' ') {
|
if (*p != ' ') {
|
||||||
doit = TRUE;
|
doit = true;
|
||||||
} else {
|
} else {
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ int set_indent(int size, int flags)
|
|||||||
|
|
||||||
// Return if the indent is OK already.
|
// Return if the indent is OK already.
|
||||||
if (!doit && !vim_iswhite(*p) && !(flags & SIN_INSERT)) {
|
if (!doit && !vim_iswhite(*p) && !(flags & SIN_INSERT)) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate memory for the new line.
|
// Allocate memory for the new line.
|
||||||
@ -256,7 +256,7 @@ int set_indent(int size, int flags)
|
|||||||
|
|
||||||
// Replace the line (unless undo fails).
|
// Replace the line (unless undo fails).
|
||||||
if (!(flags & SIN_UNDO) || (u_savesub(curwin->w_cursor.lnum) == OK)) {
|
if (!(flags & SIN_UNDO) || (u_savesub(curwin->w_cursor.lnum) == OK)) {
|
||||||
ml_replace(curwin->w_cursor.lnum, newline, FALSE);
|
ml_replace(curwin->w_cursor.lnum, newline, false);
|
||||||
|
|
||||||
if (flags & SIN_CHANGED) {
|
if (flags & SIN_CHANGED) {
|
||||||
changed_bytes(curwin->w_cursor.lnum, 0);
|
changed_bytes(curwin->w_cursor.lnum, 0);
|
||||||
@ -275,7 +275,7 @@ int set_indent(int size, int flags)
|
|||||||
saved_cursor.col = (colnr_T)(s - newline);
|
saved_cursor.col = (colnr_T)(s - newline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
retval = TRUE;
|
retval = true;
|
||||||
} else {
|
} else {
|
||||||
vim_free(newline);
|
vim_free(newline);
|
||||||
}
|
}
|
||||||
@ -286,7 +286,7 @@ int set_indent(int size, int flags)
|
|||||||
|
|
||||||
// Copy the indent from ptr to the current line (and fill to size).
|
// Copy the indent from ptr to the current line (and fill to size).
|
||||||
// Leaves the cursor on the first non-blank in the line.
|
// Leaves the cursor on the first non-blank in the line.
|
||||||
// @return TRUE if the line was changed.
|
// @return true if the line was changed.
|
||||||
int copy_indent(int size, char_u *src)
|
int copy_indent(int size, char_u *src)
|
||||||
{
|
{
|
||||||
char_u *p = NULL;
|
char_u *p = NULL;
|
||||||
@ -376,11 +376,11 @@ int copy_indent(int size, char_u *src)
|
|||||||
memmove(p, ml_get_curline(), (size_t)line_len);
|
memmove(p, ml_get_curline(), (size_t)line_len);
|
||||||
|
|
||||||
// Replace the line
|
// Replace the line
|
||||||
ml_replace(curwin->w_cursor.lnum, line, FALSE);
|
ml_replace(curwin->w_cursor.lnum, line, false);
|
||||||
|
|
||||||
// Put the cursor after the indent.
|
// Put the cursor after the indent.
|
||||||
curwin->w_cursor.col = ind_len;
|
curwin->w_cursor.col = ind_len;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -401,12 +401,12 @@ int get_number_indent(linenr_T lnum)
|
|||||||
|
|
||||||
// In format_lines() (i.e. not insert mode), fo+=q is needed too...
|
// In format_lines() (i.e. not insert mode), fo+=q is needed too...
|
||||||
if ((State & INSERT) || has_format_option(FO_Q_COMS)) {
|
if ((State & INSERT) || has_format_option(FO_Q_COMS)) {
|
||||||
lead_len = get_leader_len(ml_get(lnum), NULL, FALSE, TRUE);
|
lead_len = get_leader_len(ml_get(lnum), NULL, false, true);
|
||||||
}
|
}
|
||||||
regmatch.regprog = vim_regcomp(curbuf->b_p_flp, RE_MAGIC);
|
regmatch.regprog = vim_regcomp(curbuf->b_p_flp, RE_MAGIC);
|
||||||
|
|
||||||
if (regmatch.regprog != NULL) {
|
if (regmatch.regprog != NULL) {
|
||||||
regmatch.rm_ic = FALSE;
|
regmatch.rm_ic = false;
|
||||||
|
|
||||||
// vim_regexec() expects a pointer to a line. This lets us
|
// vim_regexec() expects a pointer to a line. This lets us
|
||||||
// start matching for the flp beyond any comment leader...
|
// start matching for the flp beyond any comment leader...
|
||||||
@ -426,9 +426,9 @@ int get_number_indent(linenr_T lnum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// When extra == 0: Return TRUE if the cursor is before or on the first
|
// When extra == 0: Return true if the cursor is before or on the first
|
||||||
// non-blank in the line.
|
// non-blank in the line.
|
||||||
// When extra == 1: Return TRUE if the cursor is before the first non-blank in
|
// When extra == 1: Return true if the cursor is before the first non-blank in
|
||||||
// the line.
|
// the line.
|
||||||
int inindent(int extra)
|
int inindent(int extra)
|
||||||
{
|
{
|
||||||
@ -440,9 +440,9 @@ int inindent(int extra)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (col >= curwin->w_cursor.col + extra) {
|
if (col >= curwin->w_cursor.col + extra) {
|
||||||
return TRUE;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ int get_expr_indent(void)
|
|||||||
// code in lisp-like languages than the traditional one; it's still
|
// code in lisp-like languages than the traditional one; it's still
|
||||||
// mostly heuristics however -- Dirk van Deun, dirk@rave.org
|
// mostly heuristics however -- Dirk van Deun, dirk@rave.org
|
||||||
|
|
||||||
// TODO:
|
// TODO(unknown):
|
||||||
// Findmatch() should be adapted for lisp, also to make showmatch
|
// Findmatch() should be adapted for lisp, also to make showmatch
|
||||||
// work correctly: now (v5.3) it seems all C/C++ oriented:
|
// work correctly: now (v5.3) it seems all C/C++ oriented:
|
||||||
// - it does not recognize the #\( and #\) notations as character literals
|
// - it does not recognize the #\( and #\) notations as character literals
|
||||||
@ -637,11 +637,9 @@ int get_lisp_indent(void)
|
|||||||
|
|
||||||
if (vi_lisp || ((*that != '"') && (*that != '\'')
|
if (vi_lisp || ((*that != '"') && (*that != '\'')
|
||||||
&& (*that != '#') && ((*that < '0') || (*that > '9')))) {
|
&& (*that != '#') && ((*that < '0') || (*that > '9')))) {
|
||||||
|
|
||||||
while (*that && (!vim_iswhite(*that) || quotecount || parencount)
|
while (*that && (!vim_iswhite(*that) || quotecount || parencount)
|
||||||
&& (!((*that == '(' || *that == '[')
|
&& (!((*that == '(' || *that == '[')
|
||||||
&& !quotecount && !parencount && vi_lisp))) {
|
&& !quotecount && !parencount && vi_lisp))) {
|
||||||
|
|
||||||
if (*that == '"') {
|
if (*that == '"') {
|
||||||
quotecount = !quotecount;
|
quotecount = !quotecount;
|
||||||
}
|
}
|
||||||
@ -691,8 +689,8 @@ static int lisp_match(char_u *p)
|
|||||||
len = (int)STRLEN(buf);
|
len = (int)STRLEN(buf);
|
||||||
|
|
||||||
if ((STRNCMP(buf, p, len) == 0) && (p[len] == ' ')) {
|
if ((STRNCMP(buf, p, len) == 0) && (p[len] == ' ')) {
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -11,4 +11,4 @@ int get_number_indent(linenr_T lnum);
|
|||||||
int inindent(int extra);
|
int inindent(int extra);
|
||||||
int get_expr_indent(void);
|
int get_expr_indent(void);
|
||||||
int get_lisp_indent(void);
|
int get_lisp_indent(void);
|
||||||
#endif
|
#endif // NEOVIM_INDENT_H
|
||||||
|
@ -1516,7 +1516,6 @@ static void init_startuptime(mparm_T *paramp)
|
|||||||
*/
|
*/
|
||||||
static void allocate_generic_buffers(void)
|
static void allocate_generic_buffers(void)
|
||||||
{
|
{
|
||||||
IObuff = alloc(IOSIZE);
|
|
||||||
NameBuff = alloc(MAXPATHL);
|
NameBuff = alloc(MAXPATHL);
|
||||||
TIME_MSG("Allocated generic buffers");
|
TIME_MSG("Allocated generic buffers");
|
||||||
}
|
}
|
||||||
|
@ -369,7 +369,6 @@ void free_all_mem(void)
|
|||||||
|
|
||||||
clear_hl_tables();
|
clear_hl_tables();
|
||||||
|
|
||||||
vim_free(IObuff);
|
|
||||||
vim_free(NameBuff);
|
vim_free(NameBuff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,12 +55,12 @@ char *os_getenvname_at_index(size_t index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long os_get_pid()
|
int64_t os_get_pid()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return (long)GetCurrentProcessId();
|
return (int64_t)GetCurrentProcessId();
|
||||||
#else
|
#else
|
||||||
return (long)getpid();
|
return (int64_t)getpid();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,8 @@ void os_get_hostname(char *hostname, size_t len)
|
|||||||
hostname[len - 1] = '\0';
|
hostname[len - 1] = '\0';
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// TODO: Implement this for windows. See the implementation used in vim:
|
// TODO(unknown): Implement this for windows.
|
||||||
|
// See the implementation used in vim:
|
||||||
// https://code.google.com/p/vim/source/browse/src/os_win32.c?r=6b69d8dde19e32909f4ee3a6337e6a2ecfbb6f72#2899
|
// https://code.google.com/p/vim/source/browse/src/os_win32.c?r=6b69d8dde19e32909f4ee3a6337e6a2ecfbb6f72#2899
|
||||||
*hostname = '\0';
|
*hostname = '\0';
|
||||||
#endif
|
#endif
|
||||||
|
@ -136,8 +136,7 @@ static bool poll_uv_loop(int32_t ms)
|
|||||||
!input_ready() && // we have no input
|
!input_ready() && // we have no input
|
||||||
kl_empty(event_queue) && // no events are waiting to be processed
|
kl_empty(event_queue) && // no events are waiting to be processed
|
||||||
run_mode != UV_RUN_NOWAIT && // ms != 0
|
run_mode != UV_RUN_NOWAIT && // ms != 0
|
||||||
!timed_out // we didn't get a timeout
|
!timed_out); // we didn't get a timeout
|
||||||
);
|
|
||||||
|
|
||||||
input_stop();
|
input_stop();
|
||||||
|
|
||||||
|
@ -16,4 +16,4 @@ typedef struct {
|
|||||||
} data;
|
} data;
|
||||||
} Event;
|
} Event;
|
||||||
|
|
||||||
#endif // NEOVIM_OS_EVENT_H
|
#endif // NEOVIM_OS_EVENT_DEFS_H
|
||||||
|
@ -154,7 +154,7 @@ int os_inchar(char_u *buf, int maxlen, int32_t ms, int tb_change_cnt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return read_from_input_buf(buf, (long)maxlen);
|
return read_from_input_buf(buf, (int64_t)maxlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a character is available for reading
|
// Check if a character is available for reading
|
||||||
@ -168,7 +168,7 @@ bool os_char_avail()
|
|||||||
void os_breakcheck()
|
void os_breakcheck()
|
||||||
{
|
{
|
||||||
if (curr_tmode == TMODE_RAW && event_poll(0))
|
if (curr_tmode == TMODE_RAW && event_poll(0))
|
||||||
fill_input_buf(FALSE);
|
fill_input_buf(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a replacement for the old `WaitForChar` function in os_unix.c
|
// This is a replacement for the old `WaitForChar` function in os_unix.c
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
#include <uv.h>
|
#include <uv.h>
|
||||||
|
|
||||||
#include "os/job_defs.h"
|
|
||||||
#include "os/job.h"
|
#include "os/job.h"
|
||||||
|
#include "os/job_defs.h"
|
||||||
#include "os/time.h"
|
#include "os/time.h"
|
||||||
#include "os/shell.h"
|
#include "os/shell.h"
|
||||||
#include "vim.h"
|
#include "vim.h"
|
||||||
@ -22,7 +22,7 @@ typedef enum {
|
|||||||
kBufferLockStderr ///< Data read from stderr
|
kBufferLockStderr ///< Data read from stderr
|
||||||
} BufferLock;
|
} BufferLock;
|
||||||
|
|
||||||
struct _Job {
|
struct job {
|
||||||
// Job id the index in the job table plus one.
|
// Job id the index in the job table plus one.
|
||||||
int id;
|
int id;
|
||||||
// Number of polls after a SIGTERM that will trigger a SIGKILL
|
// Number of polls after a SIGTERM that will trigger a SIGKILL
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#ifndef NEOVIM_OS_JOB_DEFS_H
|
#ifndef NEOVIM_OS_JOB_DEFS_H
|
||||||
#define NEOVIM_OS_JOB_DEFS_H
|
#define NEOVIM_OS_JOB_DEFS_H
|
||||||
|
|
||||||
typedef struct _Job Job;
|
typedef struct job Job;
|
||||||
|
|
||||||
#endif // NEOVIM_OS_JOB_DEFS_H
|
#endif // NEOVIM_OS_JOB_DEFS_H
|
||||||
|
@ -86,7 +86,7 @@ char *os_getenvname_at_index(size_t index);
|
|||||||
/// Get the process ID of the Neovim process.
|
/// Get the process ID of the Neovim process.
|
||||||
///
|
///
|
||||||
/// @return the process ID.
|
/// @return the process ID.
|
||||||
long os_get_pid(void);
|
int64_t os_get_pid(void);
|
||||||
|
|
||||||
/// Get the hostname of the machine runing Neovim.
|
/// Get the hostname of the machine runing Neovim.
|
||||||
///
|
///
|
||||||
|
@ -138,9 +138,9 @@ int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
|
|||||||
signal_reject_deadly();
|
signal_reject_deadly();
|
||||||
|
|
||||||
// Create argv for `uv_spawn`
|
// Create argv for `uv_spawn`
|
||||||
// TODO we can use a static buffer for small argument vectors. 1024 bytes
|
// TODO(tarruda): we can use a static buffer for small argument vectors. 1024
|
||||||
// should be enough for most of the commands and if more is necessary we can
|
// bytes should be enough for most of the commands and if more is necessary
|
||||||
// allocate a another buffer
|
// we can allocate a another buffer
|
||||||
proc_opts.args = shell_build_argv(cmd, extra_shell_arg);
|
proc_opts.args = shell_build_argv(cmd, extra_shell_arg);
|
||||||
proc_opts.file = proc_opts.args[0];
|
proc_opts.file = proc_opts.args[0];
|
||||||
proc_opts.exit_cb = exit_cb;
|
proc_opts.exit_cb = exit_cb;
|
||||||
@ -219,8 +219,9 @@ int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
|
|||||||
|
|
||||||
if (got_int) {
|
if (got_int) {
|
||||||
// Forward SIGINT to the shell
|
// Forward SIGINT to the shell
|
||||||
// TODO for now this is only needed if the terminal is in raw mode, but
|
// TODO(tarruda): for now this is only needed if the terminal is in raw
|
||||||
// when the UI is externalized we'll also need it, so leave it here
|
// mode, but when the UI is externalized we'll also need it, so leave it
|
||||||
|
// here
|
||||||
uv_process_kill(&proc, SIGINT);
|
uv_process_kill(&proc, SIGINT);
|
||||||
got_int = false;
|
got_int = false;
|
||||||
}
|
}
|
||||||
@ -232,8 +233,9 @@ int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
|
|||||||
append_ga_line(&pdata.ga);
|
append_ga_line(&pdata.ga);
|
||||||
// remember that the NL was missing
|
// remember that the NL was missing
|
||||||
curbuf->b_no_eol_lnum = curwin->w_cursor.lnum;
|
curbuf->b_no_eol_lnum = curwin->w_cursor.lnum;
|
||||||
} else
|
} else {
|
||||||
curbuf->b_no_eol_lnum = 0;
|
curbuf->b_no_eol_lnum = 0;
|
||||||
|
}
|
||||||
ga_clear(&pdata.ga);
|
ga_clear(&pdata.ga);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,9 +298,9 @@ static int word_length(char_u *str)
|
|||||||
static void write_selection(uv_write_t *req)
|
static void write_selection(uv_write_t *req)
|
||||||
{
|
{
|
||||||
ProcessData *pdata = (ProcessData *)req->data;
|
ProcessData *pdata = (ProcessData *)req->data;
|
||||||
// TODO use a static buffer for up to a limit(BUFFER_LENGTH) and only after
|
// TODO(tarruda): use a static buffer for up to a limit(BUFFER_LENGTH) and
|
||||||
// filled we should start allocating memory(skip unnecessary allocations for
|
// only after filled we should start allocating memory(skip unnecessary
|
||||||
// small writes)
|
// allocations for small writes)
|
||||||
int buflen = BUFFER_LENGTH;
|
int buflen = BUFFER_LENGTH;
|
||||||
pdata->wbuffer = (char *)xmalloc(buflen);
|
pdata->wbuffer = (char *)xmalloc(buflen);
|
||||||
uv_buf_t uvbuf;
|
uv_buf_t uvbuf;
|
||||||
@ -356,9 +358,10 @@ static void write_selection(uv_write_t *req)
|
|||||||
}
|
}
|
||||||
lp = ml_get(lnum);
|
lp = ml_get(lnum);
|
||||||
written = 0;
|
written = 0;
|
||||||
} else if (len > 0)
|
} else if (len > 0) {
|
||||||
written += len;
|
written += len;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uvbuf.base = pdata->wbuffer;
|
uvbuf.base = pdata->wbuffer;
|
||||||
uvbuf.len = off;
|
uvbuf.len = off;
|
||||||
@ -384,8 +387,8 @@ static void alloc_cb(uv_handle_t *handle, size_t suggested, uv_buf_t *buf)
|
|||||||
|
|
||||||
static void read_cb(uv_stream_t *stream, ssize_t cnt, const uv_buf_t *buf)
|
static void read_cb(uv_stream_t *stream, ssize_t cnt, const uv_buf_t *buf)
|
||||||
{
|
{
|
||||||
// TODO avoid using a growable array for this, refactor the algorithm
|
// TODO(tarruda): avoid using a growable array for this, refactor the
|
||||||
// to call `ml_append` directly(skip unecessary copies/resizes)
|
// algorithm to call `ml_append` directly(skip unecessary copies/resizes)
|
||||||
int i;
|
int i;
|
||||||
ProcessData *pdata = (ProcessData *)stream->data;
|
ProcessData *pdata = (ProcessData *)stream->data;
|
||||||
|
|
||||||
@ -429,12 +432,11 @@ static int proc_cleanup_exit(ProcessData *proc_data,
|
|||||||
uv_process_options_t *proc_opts,
|
uv_process_options_t *proc_opts,
|
||||||
int shellopts)
|
int shellopts)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (proc_data->exited) {
|
if (proc_data->exited) {
|
||||||
if (!emsg_silent && proc_data->exit_status != 0 &&
|
if (!emsg_silent && proc_data->exit_status != 0 &&
|
||||||
!(shellopts & kShellOptSilent)) {
|
!(shellopts & kShellOptSilent)) {
|
||||||
MSG_PUTS(_("\nshell returned "));
|
MSG_PUTS(_("\nshell returned "));
|
||||||
msg_outnum((long)proc_data->exit_status);
|
msg_outnum((int64_t)proc_data->exit_status);
|
||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ void signal_handle(Event event)
|
|||||||
case SIGPWR:
|
case SIGPWR:
|
||||||
// Signal of a power failure(eg batteries low), flush the swap files to
|
// Signal of a power failure(eg batteries low), flush the swap files to
|
||||||
// be safe
|
// be safe
|
||||||
ml_sync_all(FALSE, FALSE);
|
ml_sync_all(false, false);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case SIGPIPE:
|
case SIGPIPE:
|
||||||
@ -136,7 +136,7 @@ static void deadly_signal(int signum)
|
|||||||
// Set the v:dying variable.
|
// Set the v:dying variable.
|
||||||
set_vim_var_nr(VV_DYING, 1);
|
set_vim_var_nr(VV_DYING, 1);
|
||||||
|
|
||||||
sprintf((char *)IObuff, "Vim: Caught deadly signal '%s'\n",
|
snprintf((char *)IObuff, sizeof(IObuff), "Vim: Caught deadly signal '%s'\n",
|
||||||
signal_name(signum));
|
signal_name(signum));
|
||||||
|
|
||||||
// Preserve files and exit. This sets the really_exiting flag to prevent
|
// Preserve files and exit. This sets the really_exiting flag to prevent
|
||||||
|
@ -9,5 +9,5 @@ void signal_accept_deadly(void);
|
|||||||
void signal_reject_deadly(void);
|
void signal_reject_deadly(void);
|
||||||
void signal_handle(Event event);
|
void signal_handle(Event event);
|
||||||
|
|
||||||
#endif
|
#endif // NEOVIM_OS_SIGNAL_H
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user