Commit Graph

156 Commits

Author SHA1 Message Date
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