Commit Graph

135 Commits

Author SHA1 Message Date
Thiago de Arruda
7703fd328c ui: Use ui_linefeed to handle line breaks correctly
ui_linefeed will scroll the screen when it becomes full. This can happen when
executing external commands.
2015-01-12 09:47:41 -03:00
Thiago de Arruda
e1da130ca9 ui: Fix out_flush/ui_write behavior to always flush for abstract_ui 2015-01-12 09:47:41 -03:00
Thiago de Arruda
d992213678 ui: Reimplement :suspend command for remote UIs.
- Remove suspend method from the UI protocol
- Handle `:suspend` by disconnecting the last channel that sent a request to
  nvim.
2015-01-12 09:47:41 -03:00
Thiago de Arruda
abc147a977 ui: Don't parse abstract_ui codes if there are no attached UIs 2015-01-12 09:47:41 -03:00
Thiago de Arruda
74c247f75b ui: Add 'rgb' parameter to ui_attach
When set to false, nvim will send cterm color numbers with `highlight_set`.
2015-01-12 09:47:41 -03:00
Thiago de Arruda
a8fe32040b ui: Dont resize screen if no UIs are attached
This prevents a race condition when a UI attaches early in the program and can
receive redraw commands for a invalid screen
2015-01-12 09:47:41 -03:00
Thiago de Arruda
0887c5446e ui: Merge standout and reverse into one attribute 2015-01-12 09:47:40 -03:00
Thiago de Arruda
213c3c3e53 ui: Fix ui resizing and change some method names 2015-01-12 09:47:34 -03:00
Eliseo Martínez
7f7262e933 Cleanup: Rename getdigits() family functions. 2015-01-11 21:04:08 +01:00
Eliseo Martínez
04c0658024 Cleanup: Refactor getdigits().
Problem  : getdigits() currently returns a long, but at most places,
           return value is casted (unsafely) into an int. Making casts
           safe would introduce a lot of fuss in the form of assertions
           checking for limits.
Note     : We cannot just change return type to int, because, at some
           places, legitimate long values are used. For example, in
           diff.c, for line numbers.
Solution : Introduce new functions:
           - get_digits()      : Gets an intmax_t from a string.
           - get_int_digits()  : Wrapper for ints.
           - get_long_digits() : Wrapper for longs.
           And replace getdigits() invocations by the appropiate
           wrapper invocations.
2015-01-11 17:18:39 +01:00
Thiago de Arruda
b17005edd9 ui: Increase cursor row when text being rendered would cross its limit 2015-01-10 21:41:31 -03:00
Thiago de Arruda
4f5f246a95 ui: Add update_fg/update_bg methods
It is necessary to notify the UI when the default background/foreground colors
change in order to render correctly.
2015-01-10 21:41:31 -03:00
Thiago de Arruda
86542c6fd0 syntax: Use RGB/GUI attribute information for "abstract_ui"
Instead of using classic cterm color numbers and attributes, treat "abstract_ui"
as a GUI: Pass rgb color numbers and gui attributes when the "highlight_set" UI
method is called. The terminal UI will have to translate RGB color information
to an appropriate color number, and the "term"/"cterm" :highlight keys will
eventually be deprecated.
2014-12-08 23:44:24 -03:00
Thiago de Arruda
07e569a25d ui: Add abstract_ui termcap and split UI layer
This is how Nvim behaves when the "abstract_ui" termcap is activated:

- No data is written/read to stdout/stdin by default.
- Instead of sending data to stdout, ui_write will parse the termcap codes
  and invoke dispatch functions in the ui.c module.
- The dispatch functions will forward the calls to all attached UI
  instances(each UI instance is an implementation of the UI layer and is
  registered with ui_attach).
- Like with the "builtin_gui" termcap, "abstract_ui" does not contain any key
  sequences. Instead, vim key strings(<cr>, <esc>, etc) are parsed directly by
  input_enqueue and the translated strings are pushed to the input buffer.

With this new input model, its not possible to send mouse events yet. Thats
because mouse sequence parsing happens in term.c/check_termcodes which must
return early when "abstract_ui" is activated.
2014-12-08 23:44:23 -03:00
Justin M. Keyes
ad848ced11 Merge pull request #1186 from splinterofchaos/write
Non-unix-specific os_unix function.
2014-11-28 14:50:09 -05:00
Scott Prager
a3ef5723a9 mch_write -> term_write
Switch from POSIX's write() to fwrite(stdout,...) and disable buffering
since vim buffers output explicitly and flushes when needed, like when a
key is typed.
2014-11-28 14:24:27 -05:00
Thiago de Arruda
7b0f7ea87c ui: Move check_col/check_row functions to mbyte.c
These functions were only being used by mbyte.c, so move them and add the
"static" modifier.
2014-11-27 20:33:11 -03:00
Thiago de Arruda
6f7fe5d1b9 Remove code defined under USE_IM_CONTROL #ifdefs
This is not being used and should not be part of the core anyway.
2014-11-27 20:26:10 -03:00
Thiago de Arruda
bf6bb27e79 ui: Remove redundant ui.h includes
Also move read_error_exit to os/input.c
2014-11-27 15:00:30 -03:00
Thiago de Arruda
a3534138a8 ui: Extract mouse.c/mouse.h 2014-11-27 14:48:30 -03:00
Thiago de Arruda
1865b8c1c1 ui: Remove ui_delay, ui_breakcheck and ui_set_shellsize
These functions only used to call another os_* function, so remove them and
replace all occurences in the project.
2014-11-27 14:27:18 -03:00
Thiago de Arruda
541eaf598c ui: Remove ui_inchar/ui_char_avail
Also:

- Remove NO_CONSOLE_INPUT/NO_CONSULE preprocessor conditionals
- Remove ctrl_c_interrupts variable, check for mapped_ctrl_c directly in
  process_interrupts()
- Move ui_inchar profiling to input_poll which is where Nvim blocks for input.
2014-11-27 14:12:59 -03:00
Scott Prager
f5aee19ac0 Use bool for flags in oparg_T.
Several opart_T members like use_reg_one, end_adjusted, empty,
is_VIsual, and block_mode, only ever store TRUE or FALSE, so make this
constraint explicit by changing them to bools, and TRUE to true and
FALSE to false in the context of their uses.

The member, inclusive, has several other uses such as in arithmetic
equations and one inequality, but every single assignment (obtained with
'grep -r "inclusive \\="') sets it to either TRUE or FALSE.

This also implies that the inequality, "oap->end.coladd <
oap->inclusive", can only be true when coladd==0 and inclusive==true, so
test for that instead.

For consistency, change the first argument of findpar (which ends up
being inclusive) to bool.

Include stdbool.h for consistency with issue #918.

This commit shrinks the size of oparg_T from 128 bytes to 112 (-13%) on
my machine.
2014-11-11 11:34:58 -05:00
Thiago de Arruda
42112e04a9 ui: Refactor input buffer handling
All input buffer code was moved to os/input.c, and `inbuf` is now a `RBuffer`
instance(which abstracts static buffer manipulation).
2014-10-18 12:51:35 -03:00
Pavel Platto
0868818d3e Include stdbool.h in some files which use it
Done by manual inspection of the output of this script:
grep -r -l -w "bool\|true\|false" * | grep 'c$\|h$' > has_bool
grep -r -l "stdbool.h" * | grep 'c$\|h$' > has_include
grep -F -x -v -f has_include has_bool
2014-07-11 18:33:07 -04:00
Brandon Coleman
bf219e1442 move <inttypes.h> include out of vim.h 2014-07-09 00:18:19 +02:00
Klemen Košir
ef34a0ab13 Replace int with bool in some files. #654 2014-07-08 17:25:48 +00:00
Brandon Coleman
7f21665673 move/remove W_* macros
move W_ENDCOL to screen.c
remove the rest of the W_* macros
2014-06-12 01:20:36 -05:00
Hinidu
75f152d09b Remove FEAT_MENU
Support for :menu command. It can be used in terminal Vim too.
2014-05-28 13:08:54 -04:00
Hinidu
a29b94e2f9 Remove FEAT_EVAL
Support for VimScript, :let, :if, etc.
2014-05-28 13:08:54 -04:00
Hinidu
4e0fc575d7 Remove FEAT_MBYTE
Multi-byte character handling.
2014-05-28 13:08:54 -04:00
Hinidu
e62722922b Extract cursor.h from misc{1,2}.h and memline.h 2014-05-28 10:42:06 -04:00
Felipe Oliveira Carvalho
21784aeb00 Replace alloc() with xmalloc() and remove immediate OOM checks 2014-05-19 14:50:23 -03:00
Eliseo Martínez
409cc138f2 Introduce nvim namespace: Fix project-local includes.
Prepend 'nvim/' in all project-local (non-system) includes.
2014-05-15 20:46:01 +02:00
Eliseo Martínez
da51dc9cf2 Introduce nvim namespace: Move files.
Move files from src/ to src/nvim/.
- src/nvim/ becomes the new root dir for nvim executable sources.
- src/libnvim/ is planned to become root dir of the neovim library.
2014-05-15 20:46:01 +02:00