Commit Graph

33 Commits

Author SHA1 Message Date
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
Allan Odgaard
b8ddc41bd0 Don’t show tool tips with only whitespace 2013-02-11 14:21:20 +01:00
Allan Odgaard
ddc85708f8 Allow disabling auto-indent for snippets
Snippets are normally inserted with indent matching that of the caret. This isn’t always desired, which is why TM 1.x allowed this feature to be disabled. This is now also supported for 2.0.

Closes #387.
2013-02-08 13:55:10 +01:00
Allan Odgaard
5c1eb0ae3e Use command name as title for output windows
The command can set a custom title so this is only for commands that doesn’t do that.
2013-01-25 13:15:36 +01:00
Allan Odgaard
4b369e3bf1 Close HTML output view when using exit_discard
This was also done by TextMate 1.x.
2013-01-13 11:56:07 +01:00
Allan Odgaard
4b5d668d85 Delete constructor instead of making it private 2013-01-12 13:09:16 +01:00
Allan Odgaard
4d8f0422ec Provide “More Info…” for unsatisfied command requirements
See issue #622 for more details.
2012-12-16 00:01:13 +01:00
Allan Odgaard
d71b9ea324 Avoid using begin/endof with strings
Mainly this is just to phase out the use of these custom helpers.
2012-09-20 12:22:20 +02:00
Jacob Bandes-Storch
e3aa997b06 Use libc++: replace std::tr1 with std 2012-08-28 13:30:20 +02:00
Allan Odgaard
9894969e67 Initial commit 2012-08-09 16:25:56 +02:00