Compiler warns about buf always being nonnull.
buf is per function attribute always nonnull, so buf can be removed from
the assert(). But a buffer length of zero is also no problem, because it
makes uv_cwd() return a failure without writing into buf. So the
remaining length check can also be removed.
Explanation:
Running `:set encoding=utf-8` _after_ startup correctly initializes
multibyte; but mb_init() was _not_ called during startup if locale
detection (enc_locale()) failed. This wasn't a problem in Vim because
the Vim default encoding (latin1) does not require mb_init(). But Nvim
defaults to utf8, so mb_init() is required.
closes#1271closes#1672
* Force building Lua rocks instead of trying to install a binary.
* Set the CC and LD environment variables to pass
CMAKE_C_COMPILER_ARG1 (contains `-m32` for 32-bit builds)
to `luarocks build`.
This is necessary for newer versions of Busted, otherwise assert will be
nil and the tests will die.
Note: this does not mean the tests now work with the latest Busted.
There are still several issues preventing that from happening.
busted depends on a number of libraries that sometimes introduce crashing bugs.
The new custom target makes sure only stable versions of those dependencies are
installed.
Problem : Branch condition evaluates to a garbage value @ 2868.
Diagnostic : False positive.
Rationale : Array has_hotkey, declared at 2812, is initialized by
console_dialog_alloc (only the needed number of elements).
That same number of elements is used by
copy_hotkeys_and_msg.
Suggested path error is impossible, because it involves a
different number of elements in those functions.
Resolution : Above condition is cumbersome to prove through assertions.
Thus, we prefer to just initialize the array to all-false
at declaration point before calling console_dialog_alloc.
- process spawning was decoupled from the rest of the job control logic. The
goal is reusing it for spawning processes connected to pseudo terminal file
descriptors.
- job_start now receives a JobOptions structure containing all the startup
options.
Problem : Use after free @ 1795.
Diagnostic : Real issue.
Rationale : prev_curtab can in fact be freed as a result of call
`win_close_othertab(win, free_buf, prev_curtab);`, but it's
later used at
`sprintf(..., tabpage_index(prev_curtab));`.
This was introduced at
3ffc5d81c3.
Resolution : Move prev_idx calculation before the call freeing
prev_curtab.
Problems : Assigned value is garbage or undefined @ 5363.
Result of operation is garbage or undefined @ 5356.
Result of operation is garbage or undefined @ 5320.
Result of operation is garbage or undefined @ 5192.
Diagnostic : False positives / Multithreading issues.
Rationale : Suggested error paths contain incoherent values for
has_mbyte, enc_utf8, and enc_dbcs, which should always hold
the relationship has_mbyte = enc_utf8 || enc_dbcs, with
enc_utf8 and enc_dbcs being mutually exclusive.
Asserting on the globals, though, fails, because checker
believes they could be modified by other threads in
between.
Resolution : Make local copy of globals and assert relationship on them.
The current will segfault for large chunks of output because the output buffer
will be overrun.
Using unibi_format is simple because we can simply flush the buffer when its
full.
Many common terminals that set TERM=xterm and $COLORTERM support 256 colors. If
this is detected, use force the hardcoded xterm's setaf/setab capabilities.
- Removed term.c, term.h and term_defs.h
- Tests for T_* values were removed. screen.c was simplified as a
consequence(the best strategy for drawing is implemented in the UI layer)
- Redraw functions now call ui.c functions directly. Updates are flushed with
`ui_flush()`
- Removed all termcap options(they now return empty strings for compatibility)
- &term/&ttybuiltin options return a constant value(nvim)
- &t_Co is still available, but it mirrors t_colors directly
- Remove cursor tracking from screen.c and the `screen_start` function. Now the
UI is expected to maintain cursor state across any call, and reset it when
resized.
- Remove unused code