Commit Graph

131 Commits

Author SHA1 Message Date
Kevin Ballard
35595dbffd Make escape() return a wcstring
This avoids the potential for leaking the resulting string.
2014-09-25 18:20:03 -07:00
Kevin Ballard
cd4fa518b8 Remove my_wcswidth() in favor of fish_wcswidth()
my_wcswidth() was just a wrapper around fish_wcswidth() already.
Instead, add two convenience overrides of fish_wcswidth() to common.h
that make it a drop-in replacement for my_wcswidth().
2014-09-25 18:04:11 -07:00
Kevin Ballard
cc52a59e1a Rework how screen size is tracked
The screen size is fetched after a SIGWINCH is delivered. The current
implementation has two issues:

* It calls ioctl() from the SIGWINCH signal handler, despite ioctl() not
  being a function that is known to be safe to call.
* It's not thread-safe.

Signals can be delivered on arbitrary threads, so we don't know if it's
actually safe to be modifying the cached winsize in response to a
signal. It's also plausible that the winsize may be requested from a
background thread.

To solve the first issue, we twiddle a volatile boolean flag in the
signal handler and defer the ioctl() call until we actually request the
screen size.

To solve the second issue, we introduce a pthread rwlock around the
cached winsize. A rwlock is used because it can be expected that there
are likely to be far more window size reads than window size writes. If
we were using C++11 we could probably get away with atomics, but since
we don't have that (or boost), a rwlock should suffice.

Fixes #1613.
2014-08-29 12:46:03 -07:00
ridiculousfish
d0c85471b4 Make escape_string transform wildcard characters
The characters ANY_CHAR, ANY_STRING, and ANY_STRING_RECURSIVE are
currently transformed by unescape, but not by escape. Let's try escaping
them. Fixes #1614.
2014-08-16 19:25:36 -07:00
ridiculousfish
3ff104ba30 Rename lock_t to mutex_lock_t to fix Solaris compilation
Fixes #1510
2014-07-07 00:38:37 -07:00
ridiculousfish
11c1562512 Remove connection_t usage from write_to_fd 2014-06-09 12:57:44 -07:00
ridiculousfish
ecf56606dc Remove large parts of fishd interaction, including
env_universal_server
2014-06-06 10:34:42 -07:00
ridiculousfish
a0e6d4375a Merge branch 'master' into death_of_fishd 2014-05-14 14:09:32 +08:00
ridiculousfish
c7aca5cc35 Hopefully better fix for prompt under Windows. Things that may store
NOT_A_WCHAR must be wint_t, not wchar_t
2014-05-14 13:30:41 +08:00
Konrad Borowski
6596d91c82 Fix prompt under Windows.
The fix is obviously a hack caused by that NOT_A_WCHAR
doesn't fit in wchar_t. Better fix would be nice.
2014-05-10 17:13:08 +02:00
ridiculousfish
f27232bd0a Initial work on strategy_named_pipe universal notifier. 2014-05-04 15:06:40 -07:00
ridiculousfish
f5e62f28bc Save a memory allocation in append_formatv 2014-04-30 16:29:52 -07:00
ridiculousfish
4948508277 Squelch some more warnings on Linux 2014-04-27 18:27:34 -07:00
Konrad Borowski
bb0b82a110 Remove useless return. 2014-04-22 18:54:26 +02:00
ridiculousfish
3cfdc6d126 Fix line number reporting in new parser 2014-03-20 21:32:02 -07:00
ridiculousfish
e47ad09130 Make contains take the string by const reference again, for performance reasons 2014-03-11 12:43:52 +08:00
Daniel J. Hofmann
7dc0b6f40b Fixed various Undefined Behavior occurrences.
Conditionally uninitialized:
 - builtin_commandline.cpp:577
 - expand.cpp:869
 - parse_util.cpp:1036

Initialization of POD structs:
 - event.cpp:61
 - autoload.cpp:22

References used with va_start:
 - common.cpp:608:18

Found with clang-3.4's awesome -Wconditional-uninitialized,
-Wmissing-field-initializers and -Wvarargs.
2014-03-07 18:28:16 +01:00
ridiculousfish
be33d3f2a4 Revert "Merge pull request #1317 from pullreq/cpp"
This reverts commit 74135c0600, reversing
changes made to 6d749789ce.

See discussion in #1317
2014-02-28 02:16:48 -08:00
Geoff Nixon
18dd6f58e3 Fixes .c -> .cpp in comments. For doxygen. 2014-02-27 06:23:40 -08:00
Geoff Nixon
ddcd2b0810 Dead stores 2014-02-27 06:23:40 -08:00
ridiculousfish
688ea28bed Optimize the tokenize_variable_array hot spot to do less string copying 2014-02-24 09:54:30 -08:00
ridiculousfish
414530c9c2 Partially rework profiling. Fix profiling crash with new parser. Fixes
1295
2014-02-09 14:04:43 -08:00
ridiculousfish
53814983ff Update style and formatting to conform to fish style guide. 2014-01-15 01:40:40 -08:00
ridiculousfish
40e223c12d Additional miscellaneous fixes based on cppcheck static analysis 2014-01-12 13:53:59 -08:00
ridiculousfish
89069fdaa4 Miscellaneous minor fixes based on cppcheck static analyzer 2014-01-12 13:33:35 -08:00
ridiculousfish
e8d6c96c1e Merge branch 'master' into ast 2014-01-08 15:07:56 -08:00
ridiculousfish
041120aab4 Clean up and reduce memory allocations in string escaping 2014-01-08 15:06:40 -08:00
ridiculousfish
a23441109d Merge branch 'master' into ast
Conflicts:
	complete.cpp
	fish_tests.cpp
	highlight.cpp
2013-12-07 12:54:43 -08:00
ridiculousfish
9f5547327e Fix for compile error identified in
https://github.com/fish-shell/fish-shell/issues/1142
2013-11-26 23:18:12 -08:00
ridiculousfish
5121417725 Fix for annoying error message when converting out of range escape
https://github.com/fish-shell/fish-shell/issues/1107
2013-11-26 10:52:32 -08:00
ridiculousfish
5b3397359f Fix support for backslash-newline in double quotes in unescape functions. Makes tests pass
again.
2013-11-26 01:39:16 -08:00
ridiculousfish
920adb8296 Merge branch 'master' into ast 2013-11-24 23:45:59 -08:00
ridiculousfish
8ceb4b83a4 Remove old unescape() function 2013-11-24 23:29:25 -08:00
ridiculousfish
34540babdb Merge branch 'master' into ast
Conflicts:
	complete.cpp
	fish_tests.cpp
2013-11-24 23:21:00 -08:00
ridiculousfish
9f6223311e Large cleanup and refactoring of unescape() function. 2013-11-24 22:58:39 -08:00
ridiculousfish
8e07e55c1f More work on new parser 2013-08-08 15:06:46 -07:00
ridiculousfish
220e1e8fb5 Fix for crash when setting tmux pane title
https://github.com/fish-shell/fish-shell/issues/846
2013-06-02 01:50:22 -07:00
ridiculousfish
464187491f Formatting 2013-06-02 01:14:26 -07:00
ridiculousfish
908b07527e Support for fuzzy completions
https://github.com/fish-shell/fish-shell/issues/568
https://github.com/fish-shell/fish-shell/issues/528
2013-05-25 15:41:18 -07:00
ridiculousfish
2da81b0ae7 Formatting and style updates 2013-05-05 02:33:17 -07:00
ridiculousfish
b8f34cdd35 Teach case-insensitive completions about tildes. Fixes https://github.com/fish-shell/fish-shell/issues/647 2013-04-07 23:54:43 -07:00
ridiculousfish
9394583f96 Implement actual error handling for builtin_printf. Fix the tests. 2013-03-24 15:58:24 -07:00
David Adam (zanchey)
daf5ef1bbd Kill termio.h and sys/termios.h
On FreeBSD, compilation complains that "this file includes
<sys/termios.h> which is deprecated, use <termios.h> instead". On Linux
and FreeBSD, <sys/termios.h> literally just pulls in <termios.h>. On OS
X and Solaris, <termios.h> pulls in <sys/termios.h>.

<termio.h> doesn't exist on FreeBSD or Mac OS X, and on Linux is marked
as deprecated and just includes <termios.h>. It does exist on Solaris,
but no `struct termio` is ever actually used in the codebase.
2013-03-05 12:25:00 -08:00
lledey
bbab6b2fdc Fix compilation by using std::ptrdiff_t instead of ptrdiff_t
Signed-off-by: lledey <lledey@gmail.com>
2013-02-23 21:47:10 +01:00
ridiculousfish
a8e92639af Cleanup and simplify null_terminated_array_t and its clients 2013-02-22 16:22:56 -08:00
ridiculousfish
6d522e6ed6 First round of fixes based on cppcheck
https://github.com/fish-shell/fish-shell/issues/575
2013-02-16 00:02:40 -08:00
ridiculousfish
dc37a8079e Added a seq function that defers to the seq command if present
https://github.com/fish-shell/fish-shell/issues/137
2013-01-12 14:18:34 -08:00
ridiculousfish
373cca0bf6 Formatting 2013-01-12 12:55:23 -08:00
ridiculousfish
9d6c4fa678 Make do_builtin_io multi-fork safe, moved it to postfork.cpp
Addresses https://github.com/fish-shell/fish-shell/issues/495
2013-01-11 15:09:53 -08:00
ridiculousfish
552d8f394e Make fishd base its variable files on the MAC address instead of hostname
Fixes https://github.com/fish-shell/fish-shell/issues/183
2013-01-08 02:39:22 -08:00