Commit Graph

204 Commits

Author SHA1 Message Date
Alexandre Bury
92f919978c Rustfmt 2018-08-22 13:33:29 -07:00
Alexandre Bury
4ccc07c6d3 Update pancurses backend handling of multiple events 2018-07-22 20:13:49 -07:00
Alexandre Bury
6a728bf234 Move resize thread handling to separate module 2018-07-19 21:11:50 -07:00
Alexandre Bury
f4530d688b Fix compilation for non-Unix platforms 2018-07-19 20:50:46 -07:00
Alexandre Bury
5dfc27bd9f Fix compilation error on BLT backend 2018-07-19 20:13:37 -07:00
Alexandre Bury
af4e55ed18 Fix dummy & blt backends 2018-07-19 19:45:26 -07:00
Alexandre Bury
2610b697a8 Rustfmt 2018-07-19 19:44:59 -07:00
Alexandre Bury
acd3bbfcca Share resize thread logic between all unix backends 2018-07-18 20:01:26 -07:00
Alexandre Bury
e0cc2ea703 Share resize thread logic between ncurses backends 2018-07-18 19:49:10 -07:00
Alexandre Bury
fd75249633 Move resize-specific behaviour to backend 2018-07-18 18:17:39 -07:00
Alexandre Bury
1f1e238d2e Fix pancurses for windows 2018-07-08 12:54:35 -07:00
Alexandre Bury
6135b0df79 Refactor input system
* Moves from chan to crossbeam-channel
* Moves from chan_signal to signal-hook
2018-07-08 12:49:12 -07:00
Alexandre Bury
6ce2dba8a1 Fix clippy warnings 2018-06-21 14:44:30 -07:00
Alexandre Bury
bd78bca91b Don't drag scrollbars if they're not visible 2018-06-20 17:35:58 -07:00
Alexandre Bury
9bd1eb320d Add size cache to ScrollView 2018-06-20 11:48:09 -07:00
Alexandre Bury
b96ea52a92 Do not import chan_signal if not required 2018-06-18 18:47:11 -07:00
Alexandre Bury
3f16e8ed60 Do not use chan_signal on windows 2018-06-18 16:50:09 -07:00
Alexandre Bury
26e5f51192 Use term_size instead of ioctl 2018-06-18 16:08:55 -07:00
Alexandre Bury
804e41ec43 Fix resize event 2018-06-17 17:26:03 -07:00
Alexandre Bury
14fe6f3b36 Cargo fmt 2018-06-16 13:23:09 -07:00
Alexandre Bury
35eb1ec5a2 Fix pancurses 2018-06-16 12:57:20 -07:00
Alexandre Bury
83bcf4fb72 Merge branch 'master' into callback_preemption 2018-06-16 11:03:39 -07:00
Alexandre Bury
3f5b37951b Do not consume input before exit 2018-06-16 10:58:55 -07:00
Alexandre Bury
5e1956b737 Merge branch 'master' into scroll 2018-06-15 23:21:10 -07:00
Alexandre Bury
8acc08f340 Rustfmt 2018-06-10 23:29:19 -07:00
Alexandre Bury
70cddae454 Add comments 2018-05-21 22:51:10 -07:00
Alexandre Bury
c8d39910ab Backend: add AtomicBool to stop input thread 2018-05-20 10:55:13 -07:00
Alexandre Bury
0b6e5b6ad4 Add event polling to Blt backend
Basically simulates a constant set_fps(30)
2018-05-20 10:42:52 -07:00
Alexandre Bury
05e1212a50 Refactor Backend input model
Backends now have to send input to the given `chan::Sender<Event>`.
They send these events from a separate thread, allowing selection
between input and callbacks.

This currently breaks the BearLibTerminal backend, which requires all
calls to come from the UI thread.

This might not be super-safe for the ncurses backend also. We hope that
input and output are separate enough that they can run concurrently without
problem.
2018-05-20 09:59:35 -07:00
Alexandre Bury
2088d5de2a Cargo fmt 2018-05-17 17:37:39 -07:00
Alexandre Bury
755854963f Fix clippy warnings 2018-05-17 17:35:57 -07:00
Alexandre Bury
f0b3287d73 Merge branch 'master' into scroll 2018-04-16 22:42:42 -07:00
Alexandre Bury
3731b7375d Ncurses: better color approximation
On terminals with only 8 colors (like with `TERM=screen`)
2018-04-11 22:20:00 -07:00
Alexandre Bury
8c00b171c0 Ncurses: better color approximation
On terminals with only 8 colors (like with `TERM=screen`)
2018-04-11 22:16:08 -07:00
Alexandre Bury
a355171844 Fix clippy warnings 2018-04-10 11:53:25 -07:00
Alexandre Bury
d5178e778b Do not flush stdout in ncurses backend 2018-04-09 10:06:11 -07:00
Alexandre Bury
2729e77838 Ncurses backend: write mouse command to /dev/tty 2018-04-08 22:51:51 -07:00
Alexandre Bury
b34fb14957 Use ncurses::newterm instead of initscr
This leaves stdout untouched, so it can better be composed in other
commands.
2018-04-05 17:40:08 -07:00
Alexandre Bury
fd09b5f806 Use Vec2 in backend methods 2018-04-02 18:08:12 -07:00
Alexandre Bury
126530b9a9 Cursive::new now takes the backend as argument 2018-04-01 16:39:03 -07:00
SEGFAULT
76d340f11d Making backend::Backend into a std::Boxable trait (#229)
* Making Backend into a Boxable Trait

* Fixed up some typos in the previous and modified some of the docs so they still compile.

* Minor Changes requested by @gyscos

* Whoops
2018-04-01 15:35:37 -07:00
Alexandre Bury
1ad515e5f0 rustfmt 2018-03-22 11:04:58 -07:00
Alexandre Bury
1ad9a53cf7 Small refactoring 2018-03-14 15:11:27 -07:00
Alexandre Bury
1ae3bbff89 Fix pancurses input
Fixes #210
2018-03-08 10:03:41 -08:00
Alexandre Bury
99046d10c3 Use special key detection for pancurses
Shared with the ncurses backend code
2018-02-20 15:44:07 -08:00
Alexandre Bury
beefac9c6a curses backends: don't crash on weird input 2018-02-20 11:18:02 -08:00
Alexandre Bury
3f35b87757 Use print! rather than println! for ncurses configuration 2018-02-20 10:43:38 -08:00
Alexandre Bury
c626779d8a Fix simple LinesIterator
Was stopping at the first empty line.
2018-02-19 19:55:31 -08:00
Alexandre Bury
b14a2ff5e7 Remove debug lines 2018-01-27 18:15:27 -08:00
Alexandre Bury
fbd4dd97f1 Add grayscale color matching for ncurses backend 2018-01-27 18:14:37 -08:00
Alexandre Bury
da8310b076 Rustfmt 2018-01-22 14:37:27 -08:00
Alexandre Bury
3674c118cb Rustfmt 2018-01-22 11:55:56 -08:00
Alexandre Bury
5003095171 Update ncurses and owning-ref dependencies 2018-01-15 13:58:26 -08:00
Alexander Gavrilov
f8f23a5dda Call resize_item on Windows only 2018-01-09 08:24:17 -08:00
Alexander Gavrilov
7469bd36be Call resize_term on KeySize 2018-01-09 08:01:22 -08:00
Alexandre Bury
f8588e74c1 Rustfmt 2018-01-09 15:17:49 +01:00
Alexandre Bury
2d7f8295cf Add Effect::{Bold,Italic,Underline} 2018-01-05 13:57:39 +01:00
Alexandre Bury
e4cd68a4eb Rustfmt 2017-12-30 23:03:42 +01:00
Alexandre Bury
d0c30ded21 Ncurses backend: use character pattern instead of string 2017-12-11 12:29:10 -08:00
Alexandre Bury
70906aa5de Add mines example 2017-11-29 02:11:11 -08:00
Alexandre Bury
5a52b8de69 Replace eprintln! with warn! 2017-11-20 12:47:51 -08:00
Alexandre Bury
0c39f52016 ncurses: compute whole modifier table at runtime 2017-11-20 11:44:23 -08:00
Alexandre Bury
b2097bd1c8 ncurses: detect key offset at runtime 2017-11-19 20:13:57 -08:00
Alexandre Bury
c10da1390b Use dynamic key code map in ncurses backend
In preparation for detecting key codes dynamically.
(Different ncurses versions will use different code offsets)
2017-11-19 17:14:20 -08:00
Alexandre Bury
42dbe40e3f Fix modifier keys on ncurses
I think we really need to read terminfo instead...
2017-11-19 11:08:52 -08:00
Alexandre Bury
b6cfd43556 Replace last u32 with mmask_t
I missed this one...
2017-11-19 01:21:57 -08:00
Alexandre Bury
eeca719a92 Rename split_u32 -> split_i32 2017-11-19 01:14:53 -08:00
Alexandre Bury
a11d02dfa4 Use mmask_t instead of u32 2017-11-19 01:13:24 -08:00
Alexandre Bury
0b5b6ceace Add mouse support to pancurses 2017-11-19 00:40:56 -08:00
Alexandre Bury
f90621811c More rustfmt 2017-10-14 21:18:50 -07:00
Alexandre Bury
93982517ae Fix clippy warnings 2017-10-13 11:24:17 -07:00
Alexandre Bury
111d593f55 Merge branch 'master' 2017-10-13 11:01:39 -07:00
Alexandre Bury
5f3e4b1842 Produce mouse events from BLT backend 2017-10-13 00:20:27 -07:00
Alexandre Bury
acd12326e1 Produce mouse events in termion backend 2017-10-12 21:24:17 -07:00
Alexandre Bury
a4ca7bbf1e Rustfmt 2017-10-12 16:43:59 -07:00
Peter Kloss
759f57f1f8 fix some clippy warnings 2017-10-11 18:09:49 +02:00
Alexandre Bury
e07e156ad0 Fix types for different ncurses versions 2017-10-10 18:01:03 -07:00
Alexandre Bury
9497ded014 Output mouse events from ncurses backend 2017-10-10 17:50:44 -07:00
Alexandre Bury
7df4b06ef8 Backend::poll_event now takes &mut self
To manage an internal buffer, in case backend events and cursive events
don't match 1-for-1.

Planned uses: mouse support (translate click into Press+Release).
2017-10-08 16:02:43 -07:00
Alexandre Bury
2ac5dcb559 Merge pull request #152 from hcpl/use-log
Use `log` crate
2017-08-23 12:31:51 -07:00
Alexandre Bury
a1737ca0ba Fix ncurses input key codes 2017-08-23 09:59:54 -07:00
hcpl
ca4410030a Use log crate
This provides a uniform way to handle logging and can be combined with
logs from other libraries in end-user apps.
2017-08-23 17:49:09 +03:00
Alexandre Bury
a48ff9082f Replace println_stderr! with eprintln! 2017-08-14 17:01:49 -07:00
Alexandre Bury
2ffae1f524 Rename {Color,ColorStyle}::Default to TerminalDefault 2017-07-18 01:36:34 +02:00
hcpl
e0d69da844 Set *curses backends to use default colors 2017-07-16 17:37:15 +03:00
hcpl
28d0db1bb6 Make use of colors preset by terminals 2017-07-16 16:05:04 +03:00
Alexandre Bury
19f87076f9 Use 256 color pairs in pancurses 2017-06-14 00:59:17 -07:00
Alexandre Bury
e4464cb44d Merge remote-tracking branch 'origin/master' into custom_color 2017-06-14 00:44:04 -07:00
Alexandre Bury
9089d9fd88 Cleaner colors example 2017-06-14 00:43:03 -07:00
Alexandre Bury
7a7ccbf45c Add colors example 2017-06-14 00:08:58 -07:00
Alexandre Bury
88d3d81e88 Use pancurses::chtype directly 2017-06-13 23:49:55 -07:00
Alexandre Bury
2cdf546455 Fix pancurses backend 2017-06-13 23:30:55 -07:00
Alexandre Bury
98be066b4d Don't re-apply current color 2017-06-12 23:51:41 -07:00
Alexandre Bury
dea07d29cf Give the background color to the clear method. 2017-06-12 23:29:26 -07:00
Alexandre Bury
059812f427 Update termion backend 2017-06-12 18:31:08 -07:00
Alexandre Bury
5c42a59954 Refactor colors management
Do not register pairs with backend. Let backend cache color pairs if
needed.
2017-06-12 11:59:33 -07:00
Alexandre Bury
9e1a83f7cc Set up Custom color in termion and ncurses backends 2017-06-11 15:01:35 -07:00
Alexandre Bury
cbe37172b5 pancurses: set ESCDELAY after initializing screen 2017-05-23 15:25:52 -07:00
Alexandre Bury
db0398ec81 ncurses: specify ESCDELAY after setting locale
Otherwise the locale change is ignored on some systems
2017-05-23 15:22:18 -07:00
Alexandre Bury
b799d83077 Add ColorStyle::Custom for theme-independent coloring
Moved `color_id` to curses backend.
2017-05-15 19:29:31 -07:00