Commit Graph

45 Commits

Author SHA1 Message Date
Maxime Coste
04b5d44b3c Rework custom CSI parsing code and add support for SGR (1006) mouse
This will support parsing mouse coordinates bigger than 255 - 32.
And get correct release support.
2019-09-07 22:29:05 +10:00
Maxime Coste
afd45c6755 Extract most ncurses calls into NCursesUI::Window methods
Try to isolate ncurses as much as possible to explore alternate
terminal UI implementation.
2019-09-05 00:25:27 +10:00
Maxime Coste
2359df0f17 Make scrolling speed configurable
The UI now can send a 'Scroll' key, whose value is the scrolling
amount encoded as a signed integer. This replaces the MouseWheelUp
and MouseWheelDown keys.

The NCursesUI now has a ncurses_wheel_scroll_amount ui_option that
controls that amount, it can be negative to swap scrolling direction.

Fixes #3045
2019-08-19 22:16:39 +10:00
Maxime Coste
64f1c31401 Refactor parsing of keys and introduce a builtin key parser mode
By setting the ncurses_builtin_key_parser ui_option to true, we
can disable ncurses parsing of key strokes to get less portable
parsing but support for more complex modifiers.
2018-12-09 21:35:22 +11:00
Maxime Coste
b82d31016b Do not draw menu if it would hide prompt content 2018-06-20 08:12:53 +10:00
Maxime Coste
226db75aeb Change Search completion to display on top of the modeline 2018-06-19 21:02:24 +10:00
Maxime Coste
539832bf29 Add position offset to Window to limit moves with search menu style
Window can be resized with an "offset_pos" flag, which means that
the resize took place on the top left corner of the window, leading
to a change in current window position. This is treated as temporary
and the position change is stored in a m_position_offset field.

That allows the ncurses UI to offset the position when it displays
a Search menu, so that the window does not constantly scroll when
the search menu open/closes. The window will only scroll if it needs
to in order to keep the main selectin visible.
2018-06-11 15:10:30 +10:00
Maxime Coste
2bdbf7e379 Add MenuStyle::Search that prevents the menu from hiding buffer text
Fixes #2042
2018-06-03 12:17:38 +10:00
Maxime Coste
178d2d3cd3 Rework the way UI can trigger a client quitting
Add a UserInterface::is_ok method and return false on
SIGHUP/stdin closing/socket dropping

This should be cleaner and more robust than the previous SIGHUP
handling code.

Fixes #1594
2018-04-29 22:31:57 +10:00
Maxime Coste
5fa19f4d7f NCursesUI: Add support for shifted function keys
Shifted function keys are not well standardized around terminals,
Shift F(N) usually returns F(X) + N, with X=12 on xterm, X=10 on
rxvt-unicode... Default to X=12 and make it configuable through
the ncurses_shift_function_key ui_option.

This fixes what #1898 tried to.
2018-04-11 20:39:57 +10:00
Maxime Coste
91bfd714e4 Place hardware terminal cursor at the current main cursor/prompt cursor position
Fixes #1318
Also fixes https://gitlab.com/gnachman/iterm2/issues/5408
2017-04-12 10:39:17 +01:00
Maxime Coste
f0ae0b8410 Replace IdMap with HashMap 2017-03-07 01:12:37 +00:00
Maxime Coste
6373338c50 Replace uses of UnorderedMap with HashMap 2017-03-07 01:03:26 +00:00
Maxime Coste
dcd8f6ef01 Apply clang-tidy modernize to the codebase 2017-01-08 22:39:01 +00:00
Maxime Coste
190a04d6c8 Add a ncurses_change_colors option that can disable color palette change
Closes #1057
2016-12-30 07:01:13 +00:00
Maxime Coste
e44129577a Fix one definition rule violation in ncurses_ui.hh
The memory domain of Vector<DisplayBuffer> was different depending
on if display_buffer.hh has been included or not.
2016-12-10 13:43:41 +00:00
Maxime Coste
3a81260917 Simplify greatly UI input handling
This round trip through an input callback expected to call
is_key_available and get_key was overcomplicated, just send the
keys as they arrive, the client is already buffering due to urgent
event mode.
2016-11-29 21:59:36 +00:00
Maxime Coste
c2989704d5 More correct handling of SIGHUP while suspended
Fixes #833
2016-11-14 00:49:34 +00:00
Maxime Coste
35559b65dd Support codepoints of variable width
Add a ColumnCount type and use it in place of CharCount whenever
more appropriate, take column size of codepoints into account for
vertical movements and docstring wrapping.

Fixes #811
2016-10-01 13:45:00 +01:00
Maxime Coste
064e965500 Remove padding control options from ncurses ui 2016-04-11 13:54:47 +01:00
Maxime Coste
815924e4da Merge remote-tracking branch 'lenormf/buffer-padding' 2016-04-11 13:44:10 +01:00
Maxime Coste
f1fb2114da Handle <c-l> redrawing on the server side
That way we can force a redraw at any moment, including during
batch execution.
2016-03-07 21:44:50 +00:00
Maxime Coste
f0edf40543 Slight refactor in ncurses_ui, group info and menu data in structs 2016-02-27 17:22:31 +00:00
Frank LENORMAND
e74878c299 Cleanup/fix some code 2016-02-17 16:09:34 +02:00
Frank LENORMAND
f408cf7ed3 Allow users to chose how the buffers are padded 2016-02-17 15:48:09 +02:00
Maxime Coste
39fffec104 Improve info box placement behaviour in some corner cases 2015-12-05 10:51:46 +00:00
Maxime Coste
05f7337eb0 Change ncurses wheel down default button to 5 2015-11-05 13:28:58 +00:00
Maxime Coste
49557f5b17 Restore info box after a resize as well
Fixes #425
2015-10-13 13:58:39 +01:00
Maxime Coste
9f78f9bfd5 Try to restore menu after a resize 2015-10-13 13:52:02 +01:00
Maxime Coste
473196e18d Store color/color pairs mapping in the ncurses ui instance 2015-10-08 20:23:32 +01:00
Maxime Coste
c54e6738b9 Use DisplayLine for menu choices 2015-10-05 01:25:23 +01:00
Maxime Coste
a6cd764042 Add ncurses_enable_mouse ui option 2015-10-02 13:52:41 +01:00
Maxime Coste
80726a789b Refactor NCursesUI implementation, use pads instead of windows 2015-09-10 23:39:19 +01:00
Maxime Coste
ea7f76f7f2 Change ncurses title logic, use hard coded \033]2;<title>\007 sequence
And add a ncurses_set_title ui option defaulting to true.
2015-09-03 00:03:07 +01:00
Maxime Coste
130b22ff74 Refactor resize handling in NCursesUI 2015-06-30 00:31:26 +01:00
Maxime Coste
7c22ff217d Improve ncurses redraw behaviour 2015-06-21 19:51:14 +01:00
Maxime Coste
bf46870ff2 Move status/mode line drawing as a separate ui method 2015-06-17 21:28:02 +01:00
Maxime Coste
9668dccea9 Add support for Default face
The Default face is used to set default color values, if set
to default (the default), refers to terminal default colors.
2015-06-04 13:49:28 +01:00
Maxime Coste
b7144fff6c Make ncurses wheel scroll button configurable 2015-04-06 18:43:27 +01:00
Maxime Coste
1cec8df45e ArrayView content is not const anymore
As in upcoming std c++ array_view, ArrayView<T> points to mutable
data, use ArrayView<const T> or alias ConstArrayView<T> for const
data.
2015-03-09 13:54:09 +00:00
Maxime Coste
ec1d5509bb Refactor ncurses assistant option handling
The option is now ncurses_assistant, defaults to clippy, none
and off a recognized to disable assistant.
2015-02-09 13:33:54 +00:00
Maxime Coste
da562e03a0 replace all std::vector with Vector 2015-01-12 13:58:41 +00:00
Maxime Coste
295a97f2a6 Rename memoryview to ArrayView 2015-01-06 13:43:37 +00:00
Maxime Coste
2852e0fbe5 Remove trailing blank lines 2014-12-23 23:00:20 +00:00
Maxime Coste
0a57fa0766 Rename ncurses.{cc,hh} to ncurses_ui.{cc,hh} 2014-12-09 13:57:21 +00:00