Justin Frank
a1e3fa02e6
added option for vertical menu layout in the ncurses ui
2018-10-15 14:07:39 -07:00
Maxime Coste
3b77398c5b
Add an assert to catch newpad returning a nullptr
2018-07-31 13:15:39 +01:00
Maxime Coste
b6933a2bdb
Fix infinite loop on SIGHUP with the NCursesUI
...
Fixes #2126
2018-07-08 15:54:01 +10:00
Maxime Coste
3d4ee7d201
Tweak search style menu completion display
2018-06-20 20:20:11 +10: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
310e5e3bcd
NCursesUI: Use only 3 line menu for MenuStyle::Search
2018-06-03 12:17:38 +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
c63502c7c6
Code cleanup and slight refactor in NCursesUI menu code
2018-06-03 12:17:38 +10:00
Maxime Coste
79b60f69a9
Small code cleanups
2018-05-17 22:55:53 +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
2fa553e728
Remove implicit conversion from String to DisplayAtom/DisplayLine
2018-04-29 20:45:53 +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
Tim Allen
50e422659b
Add support for the shift modifier.
...
Because keyboard layouts vary, the shift-modifier `<s-…>` is only supported
for special keys (like `<up>` and `<home>`) and for ASCII lowercase where
we assume the shift-modifier just produces the matching uppercase character.
Even that's not universally true, since in Turkish `i` and `I` are not an
uppercase/lowercase pair, but Kakoune's default keyboard mappings already
assume en-US mappings for mnemonic purposes.
Mappings of the form `<s-x>` are normalized to `<X>` when `x` is an ASCII
character. `<backtab>` is removed, since we can now say `<s-tab>`.
2018-04-11 15:15:45 +10:00
Maxime Coste
2f799b1acf
NCurses: Tolerate failure to open /dev/tty and to ioctl for resize
...
Not sure what to do when that happens, but asserting and quitting
is not necessarily the best option, try to tolerate it.
Fixes #1972
2018-04-04 14:01:24 +10:00
Frank LENORMAND
e06d048d2f
src: Make code more readable, assert function calls that shouldn't fail
...
Should help clarify what the issue is in #1972 .
2018-03-31 15:00:19 +03:00
Maxime Coste
f7f84b7402
NCursesUI: Rework menu_show to shrink menu height when needed
...
Closes #1886
2018-03-20 05:54:19 +11:00
Maxime Coste
8a7e844207
NCursesUI: refactor info_show code
...
Show MenuDoc info on the left of the menu if necessary. Cleanup the
code.
2018-03-19 01:23:32 +11:00
Maxime Coste
6f2b093eec
NCursesUI: Show full menu rather than triming to respect anchor
2018-03-13 15:18:06 +11:00
Maxime Coste
a480e566dc
ranges: Add transform overload taking directly a pointer to member
...
This overload will forward to the general transform implementation
using std::mem_fn to generate a callable.
2018-03-13 14:24:03 +11:00
Maxime Coste
c82bf31378
NCursesUI: Use accumulate algorithm to gather the longest element in menu
2018-03-13 14:14:16 +11:00
Maxime Coste
13ac0e367d
NCursesUI: Rework menu placement to fix missing menu on small window
2018-02-22 22:04:04 +11:00
Maxime Coste
c30a954dfc
ncurses: change handling of <c-z> suspend to improve terminal state
...
reset the mouse state so that the terminal can take back control
of the mouse while Kakoune is suspended, and does not emit focus
events anymore.
Fixes #1816
2018-01-30 10:46:34 +11:00
Maxime Coste
b298e01390
NCurses: use the general face merging function to handle default face
...
Merge attributes as well, and reuse an existing function instead of
reimplementing the same logic again.
Closes #1684
2017-11-12 23:02:40 +08:00
Net
74202fab45
Rename br* colors to bright-*
2017-10-24 23:08:22 -04:00
Net
2b44e93f79
Support bright named colors
2017-10-22 14:30:49 -04:00
Maxime Coste
6ada6e6d77
Move all non-core string code to string_utils.{hh,cc}
2017-10-10 10:52:32 +08:00
Maxime Coste
ab6a999431
Rename containers.hh to ranges.hh (and Container to Range)
2017-08-29 15:23:03 +07:00
Maxime Coste
0dec1e3a91
Remove unused only_buffer mode for DisplayLine::trim
2017-06-09 15:30:13 +01:00
Maxime Coste
b030088d60
Re-hide hardware cursor, seems its causing troubles with various terminal emulator
2017-05-29 10:02:18 +01:00
Maxime Coste
76d3425bf9
Change ncurses_ui info box generation logic to use a Vector<String>
...
We were generating a string, then splitting it into lines, there is
no need for that, we can directly generate a vector of lines and
simplify the code.
2017-05-28 19:58:18 +01:00
Maxime Coste
72acb0177d
Parse meta as 8 bit in Normal mode to fix the terminals using that
...
The solution is a bit hackish, as we only consider the 8th bit to
mean alt in normal mode, because its unlikely accentuated characters
are going to be mapped there. It fixes using Alt on xterm, and
probably on iterm2 as well (not requiring the meta-sends-esc config
change anymore)
2017-05-27 06:18:39 +01:00
Maxime Coste
2307cf500c
Small formatting tweak
2017-05-26 08:38:12 +01:00
Maxime Coste
119a5b8442
Fix hardware cursor positioning in prompt when status bar is on bottom
2017-05-24 15:20:23 +01:00
Maxime Coste
91ed57c985
Make hardware cursor visible in ncurses ui
2017-05-18 06:28:08 +01:00
Maxime Coste
8fa7e67abc
Use LineCount instead of int for ncurses assistant margin
2017-05-10 11:35:12 +01:00
Maxime Coste
a0752d8d46
Merge remote-tracking branch 'lenormf/fix-assistant-align'
2017-05-10 11:31:26 +01:00
Maxime Coste
34bf8c23e1
Fix uninitialised value for cursor mode
2017-04-19 21:23:16 +01: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
94145f2a89
ncurses: When hiding the menu, recompute the info position
2017-04-04 08:36:21 +01:00
Frank LENORMAND
2aa5d3b016
src: Align the assistant in the middle of the popup
2017-03-14 19:06:09 +03:00
Maxime Coste
564da076a6
Merge remote-tracking branch 'lenormf/assistant-dilbert'
2017-03-10 12:06:35 +00:00
Frank LENORMAND
59b65bb9fb
ncurses: Add a Dilbert assistant
...
Drawn by myself.
2017-03-08 20:03:29 +03:00
Maxime Coste
6373338c50
Replace uses of UnorderedMap with HashMap
2017-03-07 01:03:26 +00:00
Maxime Coste
4f18e56320
Fix non-returning parse_key lambda
2017-02-13 14:02:09 +00:00
Maxime Coste
34870eb353
Rework NCurses key parsing to properly handle <a-special key>
2017-01-30 13:38:56 +00:00
Maxime Coste
37fbe6c6eb
Treat <c-h> as backspace in ncurses ui
...
Fixes #1030
2017-01-10 13:35:10 +00:00
Maxime Coste
dcd8f6ef01
Apply clang-tidy modernize to the codebase
2017-01-08 22:39:01 +00:00
Maxime Coste
b3674a2f03
Add Modal
InfoStyle used for bufer reload info box
...
Modal info style wont be replaced by other info boxes.
NCursesUI will center that info box.
Fixes #1060
2017-01-04 11:39:51 +00:00
Maxime Coste
76c58aa022
Dont use constexpr to fix OSX compilation
2016-12-30 13:29:57 +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
7defdd3039
Make FDWatcher support Read, Write and Except events, instead of just Read
2016-12-01 19:44:07 +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
d15cc02c01
Remove some unneeded headers from ncurses_ui.cc
2016-11-22 09:49:55 +00:00
Maxime Coste
c2989704d5
More correct handling of SIGHUP while suspended
...
Fixes #833
2016-11-14 00:49:34 +00:00
Maxime Coste
6889494869
Emit an OSC 104 on quit to reset color palette on supporting terminals
...
xterm and vte based terminals support it, unfortunately rxvt-unicode
does not yet.
Fixes #914
2016-11-05 11:43:25 +00:00
Maxime Coste
e8dcdb6072
Support Ctrl + mouse dragging to add a new selection
...
Fixes #838
2016-10-13 22:59:02 +01:00
Maxime Coste
f81b8c137b
Replace non ascii chars with ? in xterm title, and limit to 511 chars
...
Closes #839
2016-10-04 20:13:15 +01: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
439f168928
Use named keys for Return and Tab instead of <c-m> and <c-i>
...
Fixes #722
2016-07-05 20:08:13 +01:00
Maxime Coste
e07ff0c669
Use tparm instead of tiparm as built in OSX ncurses does not support it
2016-06-27 20:59:02 +01:00
Maxime Coste
b77eff1b72
Fix parameter order in fputs
2016-06-21 00:47:46 +01:00
Maxime Coste
2edea2e0f6
Use fputs and fflush in ncurses_ui direct stdout access to respect buffering
...
Ncurses will write using the FILE* interface, using the fd based one is error
prone.
Fixes #703
2016-06-20 23:43:21 +01:00
Maxime Coste
f51ba6089c
Use variadic macros for kak_assert to remove the need for COMMA
2016-05-17 19:39:55 +01:00
Maxime Coste
a2d426abba
Use padding face on the whole line
2016-04-11 21:12:27 +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
b02883a112
Remove forced redraw in ncurses ui
2016-03-24 13:19:36 +00:00
Maxime Coste
517abf5e74
Redisplay info when menu appears so that info adapts its position
2016-03-09 23:28:23 +00: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
032219b119
Rename set_signal_wrapper to set_signal_handler and tweak SignalHandler def
2016-01-10 20:46:15 +00:00
Daniel Robertson
f5f7bc80e8
Add a signal function using sigaction
...
Use a wrapper for sigaction in place of signal to ensure that the
SA_RESTART flag is set for all signals used.
Signed-off-by: Daniel Robertson <danlrobertson89@gmail.com>
2015-12-23 14:03:31 -05:00
Maxime Coste
39fffec104
Improve info box placement behaviour in some corner cases
2015-12-05 10:51:46 +00:00
Maxime Coste
9a6347d6aa
Another try to fix csr problems ( #469 )
2015-12-02 01:12:24 +00:00
Maxime Coste
e91da2bd43
Try to just reset the scroll region to workaround #469
2015-11-30 13:35:15 +00:00
Maxime Coste
a81dbd90a1
Consolidate writing to fd
2015-11-27 13:50:40 +00:00
Maxime Coste
788c358720
Fix some cases where menu items are truncated needlessly
2015-11-19 20:23:27 +00:00
Maxime Coste
8d47cf0674
Fix correctly ncurses menu size computations and avoid divide by 0
2015-11-18 20:12:16 +00:00
Maxime Coste
6bd71c68e5
NCurses: Fix max menu item width computation
2015-11-17 23:34:03 +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
e5240ba4ff
Fix NCursesUI::m_items not being empty after a resize
...
Fixes #435
2015-10-13 13:40:04 +01:00
Maxime Coste
256e4d7862
NCursesUI: Remove color restoring support
2015-10-09 13:43:13 +01:00
Maxime Coste
0d8b9c6677
Tweak handling of SIGINT
2015-10-08 20:23:32 +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
3098cd12f8
Check for terminal resize on SIGCONT
...
Fixes #423
2015-10-08 13:24:58 +01:00
Maxime Coste
5e4443812c
Fix warning in ncurses_ui.cc
2015-10-06 21:15:13 +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
9fdb822c27
Add support for italic text attribute
2015-09-27 14:24:42 +01:00
Filip Szczepański
47e6eed7c9
Add Haiku support.
2015-09-24 22:36:29 +00:00
Maxime Coste
6ec693d598
Cleanup compute_needed_size implementation
2015-09-23 00:43:40 +01:00
Maxime Coste
eed3e5459d
Cleanup ncurses string writing code
2015-09-23 00:40:09 +01:00
Maxime Coste
8529720aef
Fix some redrawing problems after resize
2015-09-21 22:12:23 +01:00
Maxime Coste
96b6b1b647
Tweak NCursesUI behaviour to reduce flickering on resize
2015-09-19 11:30:17 +01:00