Commit Graph

245 Commits

Author SHA1 Message Date
ridiculousfish
e7d7eff0ee Rename all readline commands to lowercase and remove R_ prefix 2019-03-23 23:31:35 -07:00
ridiculousfish
9187458d51 Continued refactoring of reader_data_t::readline 2019-03-23 23:31:34 -07:00
ridiculousfish
6ba94fd81b Factor readline command handling into new function handle_readline_command() 2019-03-23 23:31:33 -07:00
ridiculousfish
42f4d2bd86 Factor out the "read coalescing" part of reader_data_t::readline 2019-03-23 23:31:31 -07:00
ridiculousfish
7ae7865071 Factor reader_data_t::readline state into a new struct
Will help break up this monster.
2019-03-23 23:31:29 -07:00
ridiculousfish
6aba28ad3d Add missing cases to readline loop
Handle all readline commands in our switch.
2019-03-23 23:31:27 -07:00
ridiculousfish
2c56e27d37 Switch readline commands to readline_cmd_t enum class 2019-03-23 23:31:25 -07:00
ridiculousfish
0841072462 Minor cleanup of kill ring 2019-03-23 23:31:24 -07:00
ridiculousfish
c2be5e8986 Introduce char_event_type_t::readline
Baby steps towards eliminating readline actions as characters.
2019-03-23 23:31:18 -07:00
ridiculousfish
14663089c8 Finish removing R_NULL 2019-03-23 23:31:09 -07:00
ridiculousfish
28b79a2c88 Some further steps towards removing R_NULL
Introduce char_event_type_t::check_exit to represent "check for exit"
instead of R_NULL.
2019-03-23 23:31:01 -07:00
ridiculousfish
00f24695fe Remove R_EOF
Promote R_EOF to a new char_event_type_t instead of keeping it as a char
value.
2019-03-23 23:11:23 -07:00
ridiculousfish
185805641c Remove R_TIMEOUT
Promote timeout to a char_event_type_t, moving it out of the "char" namespace.
This will help simplify the readline implementation.
2019-03-23 20:10:06 -07:00
Aaron Gyes
477b2e8d7c std::vector<wcstring> is wcstring_list_t 2019-03-14 11:17:26 -07:00
Aaron Gyes
f92c2921d2 Remove mini() and maxi()
C++11 provides std::min/std::max which we're using all over,
obviating the need for our own templates for this.

util.h now only provides two things: get_time and wcsfilecmp.
This commit removes everything that includes it which doesn't
use either; most because they no longer need mini or maxi from
it but some others were #including it unnecessarily.
2019-03-12 23:25:15 -07:00
Aaron Gyes
aaacdb89b6 Switches over to cstring from string.h. 2019-03-12 15:09:36 -07:00
Aaron Gyes
d5ac239f68 This commit changes wchar.h includes to cwchar, and uses std::
for everything it provides.
2019-03-12 15:09:36 -07:00
ridiculousfish
89a7cc5da3 Switch s_write to accepting const vector & instead of raw pointers 2019-03-03 18:49:57 -08:00
ridiculousfish
ccbc9d57f2 Remove reader_data_t::next
It's no longer used
2019-03-03 18:14:41 -08:00
ridiculousfish
717ac9a8d5 Switch highlight_spec_t to a struct
Rather than a janky bitmask, use a real struct with real fields.
2019-03-03 18:04:22 -08:00
ridiculousfish
43a11af5e4 Reorganize reader.cpp to separate te current_data users from reader_data_t 2019-03-03 15:49:56 -08:00
ridiculousfish
c09544b288 Migrate more functions to instance methods on reader_data_t 2019-03-03 15:10:47 -08:00
ridiculousfish
29db076f4a exec_prompt to be an instance method on reader_data_t 2019-03-03 14:38:53 -08:00
ridiculousfish
7ff4b5e5fe Switch highlighting to instance methods on reader_data_t 2019-03-03 14:34:52 -08:00
ridiculousfish
e477b99a8b Switch more autosuggestions to instance methods on reader_data_t 2019-03-03 14:30:32 -08:00
ridiculousfish
b014c327a2 reader_data_t to become enable_shared_from_this
For background operations such as autosuggestions, we need a way for the
completion handler to keep the reader_data alive.
2019-03-03 14:21:15 -08:00
ridiculousfish
c334a41f96 Switch accept_autosuggestion to an instance method on reader_data_t 2019-03-03 14:11:09 -08:00
ridiculousfish
d7a156e7d9 Switch clear_pager to an instance method on reader_data_t 2019-03-03 14:09:23 -08:00
ridiculousfish
164c5b1c18 Migrate a lot of free functions in reader into reader_data_t 2019-03-03 14:02:27 -08:00
ridiculousfish
ecf51b575e Clean up input initialization and destruction 2019-03-03 12:59:55 -08:00
ridiculousfish
dc1073f905 reader_set_buffer_maintaining_pager to take reader_data directly 2019-03-03 12:19:46 -08:00
ridiculousfish
0bc08c6197 highlight_search to take reader_data directly 2019-03-03 12:11:32 -08:00
ridiculousfish
b07345ed18 set_command_line_and_position to take reader_data directly 2019-03-03 12:07:51 -08:00
ridiculousfish
968152ddc7 clear_pager to accept reader_data directly 2019-03-03 12:00:09 -08:00
ridiculousfish
dac5d79059 Switch wait command to use topics
Prior to this fix, the wait command used waitpid() directly. Switch it to
calling process_mark_finished_children() along with the rest of the job
machinery. This centralizes the waitpid call to a single location.
2019-03-02 16:58:27 -08:00
ridiculousfish
dc27de8190 Rename reader_interrupted to reader_test_and_clear_interrupted 2019-03-02 15:17:00 -08:00
Fabian Homborg
2418e1e50b Don't mix up pgroup and pid
This is another case where we used pid when we meant pgroup.

Since 55b3c45f95, the assumption that
both are the same no longer holds in all cases, so this check was wrong.

Might fix #5663.
2019-02-25 20:23:34 +01:00
ridiculousfish
0a29eb3142 reader_readline to return maybe_t<wcstring>
Stop returning a raw pointer.
2019-02-24 14:00:22 -08:00
ridiculousfish
47f1b026e6 Simplify reader generation count using thread_local
Replaces pthread_set_specific
2019-02-24 13:39:43 -08:00
ridiculousfish
4b292c777d Clean up and clarify reader_exit() 2019-02-24 13:24:03 -08:00
ridiculousfish
144e37b8ba Remove some empty code 2019-02-24 13:14:36 -08:00
ridiculousfish
a81bfbb805 Rename end_loop to noni_end_loop
This helps distinguish between the global (noni_)end_loop and the reader
specific one.
2019-02-24 12:20:20 -08:00
ridiculousfish
5134949a14 Factor color and terminal sequence outputting into outputter_t
Removes some static variables and simplifies the behavior of the tputs
singletone receiver.
2019-02-23 20:07:29 -08:00
George Christou
de0b64409c Teach autosuggestions to respect forward-bigword
Closes #5336
2019-02-20 16:06:38 -08:00
Aaron Gyes
c2bc0c67f2 Don't use printf("%d") just to convert an int to a string.
std::to_string, std::to_wstring are more appropriate
2019-02-18 23:15:54 -08:00
Fabian Homborg
11009de431 Revert "Explicitly close input fd to fish_title"
This reverts commit b247c8d9ad.

It breaks the title entirely.

[ci skip]
2019-02-18 15:04:01 +01:00
Mahmoud Al-Qudsi
b247c8d9ad Explicitly close input fd to fish_title
`fish_title` as invoked by fish itself is not running in an interactive
context, and attempts to read from the input fd (e.g. via `read`) cause
fish to segfault, go into an infinite loop, or hang at the read prompt
depending on the exact command line and fish version.

This patch addresses that by explicitly closing the input fd when
invoking `fish_title`.

Reported by @floam in #5629. May close that issue, but situation is
unclear.
2019-02-12 19:55:20 -06:00
ridiculousfish
87b7b6b2bb Make control-S begin navigating the pager contents
In addition to showing the search field, actually allow the user to type in
it.
2019-01-22 14:41:13 -08:00
Mahmoud Al-Qudsi
0edaf42d10 Fix regression for #4178 and others introduced by 364c839
...while still keeping intact the fix for #5519.
2019-01-21 20:29:31 -06:00
ridiculousfish
3cc581fbb0 Unconditionally set the tty mode in reader_readline
There was a bogus check for is_interactive_session. But if we are in
reader_readline we are necessarily interactive (even if we are not in
an interactive session, i.e. a fish script invoked some interactive
functionality).

Remove this check.

Fixes #5519
2019-01-20 17:36:31 -08:00