Allan Odgaard
36fedf5bee
Change most buffer helper functions to accept buffer_api_t
2016-06-13 13:01:10 +02:00
Allan Odgaard
417193e089
Update link dependencies for all targets
...
Some targets were including headers from frameworks not specified in their link dependencies. For a clean build this could cause an issue because the header was not available at the time of building the target.
The updated link dependencies are also based on what a target’s tests require. Ideally tests would have separate link dependencies, but as we don’t want to maintain this manually, this will have to wait until the build system automatically handles link dependencies.
Currently the commit command uses constants from the CommitWindow framework but should actually not be linked with it. However, the optimizer will strip dead code, so it should not result in much if any difference in the resulting binary and does solve a build dependency issue.
2016-05-07 13:00:55 +02:00
Allan Odgaard
8d8c539313
Truncate environment variables that exceed ARG_MAX
...
Previously we only logged an error when this happened, but (recently?) exceeding the limit will cause execve().
2015-10-28 15:38:18 +07:00
Allan Odgaard
a003d76234
Do not go via /usr/bin/env for bash
...
For standard commands we want to use the system’s standard interpreter, as that makes it easier to ensure compatibility.
2015-03-24 13:38:43 +07:00
Allan Odgaard
30be46a166
Support discontinuous selections in command input API
2015-03-08 14:21:59 +07:00
Allan Odgaard
40879d5683
Replace sizeofA macro with range-based for loop or std::begin/end
2015-03-05 16:38:09 +07:00
Allan Odgaard
57033d89a3
Insert at caret for exit_insert_snippet when input is document
...
Previously we would insert “after input” which I don’t think is desired (when input is entire document).
2014-12-16 16:02:09 +07:00
Allan Odgaard
38b68bd4fe
Don’t support dispatch queue parameter for runner_t::launch
...
We do not use it and starting with the 10.8 SDK, dispatch types are Objective-C objects when building as Objective-C(++), which is a problem for a header that is included from both C(++) and Objective-C(++).
2014-11-30 05:25:26 +07:00
Allan Odgaard
c5e1303a2a
Rename stdinFd variable to inputFd
...
This is just to make it consistent with our outputFd and errorFd variable names.
2014-09-13 16:19:07 +02:00
Allan Odgaard
6359a2ef7c
Use symbolic exit success/failure constants
2014-04-21 17:05:35 +07:00
Allan Odgaard
ec6d0b7e4e
fixup! Add assertion about being called in the main dispatch queue
2014-04-11 20:54:13 +07:00
Allan Odgaard
c7bfb36d25
Use variadic template function instead of varargs macros (C++11)
2014-04-10 11:13:13 +07:00
Allan Odgaard
4307d9eb91
Add ‘onDocumentSave’ HTML output auto refresh option
2014-04-10 11:13:13 +07:00
Allan Odgaard
6d1da8ce97
Use bundle item’s effective name in error and cancel sheets
...
For example the bundle item “Execute Line / Selection” will (without a selection) show as “Execute Line” in the menu, and now also if the command causes the error sheet to appear or the user press ⌃C / ⌘. to prematurely kill it.
2014-04-09 15:15:36 +07:00
Allan Odgaard
7bb584c604
Add assertion about being called in the main dispatch queue
2014-04-08 15:43:19 +07:00
Allan Odgaard
f93f793bc5
Keep dispatch group around as we may call wait after process exit
2014-04-02 14:02:28 +07:00
Allan Odgaard
a735a37b9b
We shouldn’t (potentially) call fprintf() after vfork()
...
Since it was only incase of failing to close a file descriptor, it shouldn’t have played any role in practice.
2014-04-02 12:36:07 +07:00
Allan Odgaard
589e62b1a7
File descriptors without FD_CLOEXEC are closed before we execve()
...
No file descriptors (other than input/output) should be inherited by our child process. We set FD_CLOEXEC ourself, but system frameworks might not always set it, or there might be a race condition (e.g. with socket(), pipe(), mkstemp(), etc.).
2014-03-29 13:44:13 +07:00
Allan Odgaard
7a66926231
Let command::runner_t use io::create_pipe
2014-03-29 09:57:10 +07:00
Allan Odgaard
dac27f7587
Use constants for input, output, and error file descriptors
2014-03-29 09:57:09 +07:00
Allan Odgaard
e68290aaec
Convert CxxTest test to custom test framework
2014-03-29 09:57:09 +07:00
Allan Odgaard
d985a83845
Use runner_t::wait_for_command instead of runner_t::wait(true)
...
The latter API has been removed.
2014-03-29 09:57:09 +07:00
Allan Odgaard
ffd034453a
Extend command::runner_t API
2014-03-29 09:57:09 +07:00
Allan Odgaard
c9400e036d
Use std::string for memory management
2014-03-28 19:31:15 +07:00
Allan Odgaard
935da75a43
Use new path::temp API to set initial content
2014-03-28 19:31:15 +07:00
Allan Odgaard
1fbf878a4d
Refactor/simplify command runner
2014-03-28 19:31:15 +07:00
Allan Odgaard
ccac862602
Remove process_t
2014-03-28 10:19:06 +07:00
Allan Odgaard
45b297a150
Use custom code instead of process_t
2014-03-28 10:19:06 +07:00
Allan Odgaard
1e2f10ed46
Use dispatch queue instead of a thread for reading command output
2014-03-28 10:19:06 +07:00
Allan Odgaard
9d218ea846
We use camelCase for parameter names
2014-03-28 10:19:06 +07:00
Allan Odgaard
63d431b5ed
Simplify parsing of multiple choice keys (tmCommand)
2014-03-28 10:19:06 +07:00
Allan Odgaard
4313571fc9
Parse ‘autoRefresh’ key from tmCommand files
...
This can be set to ‘onDocumentChange’ to indicate that the command should be re-run when the document changes, though the code hasn’t yet been written to handle this.
2014-03-28 10:19:05 +07:00
Allan Odgaard
cf8f796053
Do not use va_start macro with variable reference
...
This is undefined according to the standard and is a warning with clang-503.0.38.
2014-03-13 20:51:15 +07:00
Allan Odgaard
19d03df1fb
Add bundle item setting for how to re-use output windows
...
This presently does not have any effect.
2014-03-09 17:13:57 +07:00
Allan Odgaard
c2397484b8
Use C++11 for loop
...
Majority of the edits done using the following ruby script:
def update_loops(src)
dst, cnt = '', 0
block_indent, variable = nil, nil
src.each_line do |line|
if block_indent
if line =~ /^#{block_indent}([{}\t])|^\t*$/
block_indent = nil if $1 == '}'
line = line.gsub(%r{ ([^a-z>]) \(\*#{variable}\) | \*#{variable}\b | \b#{variable}(->) }x) do
$1.to_s + variable + ($2 == "->" ? "." : "")
end
else
block_indent = nil
end
elsif line =~ /^(\t*)c?iterate\((\w+), (?!diacritics::make_range)(.*\))$/
block_indent, variable = $1, $2
line = "#$1for(auto const& #$2 : #$3\n"
cnt += 1
end
dst << line
end
return dst, cnt
end
paths.each do |path|
src = IO.read(path)
cnt = 1
while cnt != 0
src, cnt = update_loops(src)
STDERR << "#{path}: #{cnt}\n"
end
File.open(path, "w") { |io| io << src }
end
2014-03-03 10:34:13 +07:00
Allan Odgaard
112a3a9e80
Allow aborting commands by pressing ⌘. or ⌃C
2014-02-12 15:50:13 +07:00
Allan Odgaard
7fb5b75219
Restore default signal handlers for commands
...
Before this commit it wasn’t possible to SIGINT / SIGTERM commands launched from TextMate since TextMate itself has a custom handler for these signals (so they are set to be ignored) — this included pressing ⌃C in the HTML output window (for commands using the TextMate.Executor API).
2014-02-12 15:08:28 +07:00
Allan Odgaard
f128304d75
Handle non-mouse/key events while running commands
...
Fixes textmate/diff.tmbundle#5
2014-02-12 11:33:37 +07:00
Allan Odgaard
1c14143575
Switch file from C++ to Objective-C++
2014-02-12 11:15:29 +07:00
Allan Odgaard
3064fb82b4
Change text::range_t → ng::range_t
2013-10-20 19:10:02 +02:00
Allan Odgaard
1c308c810d
Use map::emplace instead of inserting std::pair (C++11)
2013-09-05 20:59:11 +02:00
Allan Odgaard
e4e80a946c
Use std::make_shared
2013-09-03 12:27:20 +02:00
Allan Odgaard
2022fab80c
Commands with input set to none would not have stdin closed
...
This meant if such command would read from its stdin, it would hang.
Fixes #1081
2013-08-21 22:51:40 +02:00
Allan Odgaard
6718a8a32c
Use libdispatch for threaded write to pipe
2013-07-26 23:09:14 +02:00
Allan Odgaard
29ff131f26
Don’t assert that only main thread can launch a process
...
When we run our tests then we are likely not on the main thread when we indirectly test this API.
2013-07-26 13:53:57 +02:00
Allan Odgaard
eb6b0541b2
Move reader_t and process_t to command framework
...
These are now only used by the command framework and should soon be retired.
2013-05-16 21:36:49 +07:00
Allan Odgaard
ce4ae62547
Change ‘variables_for_path’ API
...
We now accept the a directory in addition to the path. If a directory is provided, the path is only used to filter variables rooted at the directory.
2013-05-12 11:09:18 +07:00
Allan Odgaard
a6cf964e9f
Remove callback support from document::run
2013-05-12 11:09:16 +07:00
Allan Odgaard
ccf2414768
Add pwd argument to command runner
...
Previously this was only possible to change by setting PWD in the passed-in environment.
2013-05-12 11:09:15 +07:00
Allan Odgaard
0fd03842b7
Move bundle requirement checking to bundles framework
...
This also generalizes it to being applicable to all bundle items (not just commands).
2013-05-09 15:16:33 +07:00