Commit Graph

127 Commits

Author SHA1 Message Date
Allan Odgaard
8fe7681ebd Remove unnecessary include of oak/compat.h 2015-08-05 12:31:20 +02: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
439601b8b0 Introduce API to check if a file reader works on an “open” buffer 2015-01-29 14:35:34 +07:00
Allan Odgaard
29a576ffbe Don’t go via helper for pthread_setname_np
This was previously done because the function wasn’t available until 10.7, but since that is (now) our deployment target, there is no need to wrap the call.
2014-12-25 09:36:01 +01:00
Allan Odgaard
24c510bbd5 Add a “document will delete” callback function 2014-11-11 08:44:07 +01:00
Allan Odgaard
d3b0ef3677 Allow a string value to be stored with each mark (document) 2014-10-19 20:26:00 +02:00
Allan Odgaard
2cb480364f Asking for marks of any type now return both type and value
Previously we would only return the type.
2014-10-19 20:26:00 +02:00
Allan Odgaard
0d917f8f94 Allow a string value to be stored with each mark (buffer)
We were already storing a string for each mark but was (redundantly) using the mark type as value.
2014-10-19 20:25:59 +02:00
Allan Odgaard
405e627c18 Add test for wrong checksum passed to document::replace 2014-10-18 13:03:01 +02:00
Allan Odgaard
9c9de99418 Verify checksum when replacing in non-open documents
If the checksum does not match we simply skip the document and does not show the replacement as having been done (in the UI).
2014-10-18 13:03:01 +02:00
Allan Odgaard
60465ce465 Ask for bookmarks (instead of marks) and drop local filtering
Also rename the member function so it’s clear we only get the bookmarks (not all marks).
2014-10-16 13:53:30 +02:00
Allan Odgaard
ece4ca014a Preserve and adjust bookmarks when replacing in closed documents 2014-10-15 14:02:57 +02:00
Allan Odgaard
524d281046 Rework how marks are stored when there is no buffer_t 2014-10-15 13:51:00 +02:00
Allan Odgaard
b20629d9a1 Use public constant for bookmark identifier 2014-10-15 10:31:22 +02:00
Allan Odgaard
bb6206608b Use text::pos_t as key when storing marks for closed documents
Since open documents only support a single position (not a range) it doesn’t make sense to use a range for closed documents.
2014-10-14 22:53:10 +02:00
Allan Odgaard
c341765fe9 Add API to remove (all) marks from (all) documents 2014-10-14 22:06:32 +02:00
Allan Odgaard
7724abb022 Cleanup code dealing with marks
Previously marks were lost when disposing a document.
2014-10-13 23:20:25 +02:00
Allan Odgaard
fc09b3c0c6 Use std::string instead of document_t::mark_t
This is consistent with the marks kept by buffer_t.
2014-10-12 11:46:19 +02:00
Allan Odgaard
012a700429 Allow clearing the (cached) content of a non-open document 2014-10-08 21:52:27 +02:00
Allan Odgaard
8322954ec9 Ignore extended attribute storing foldings if content has changed 2014-10-07 18:24:27 +02:00
Allan Odgaard
c0c7f04a10 Only retrieve encoding settings during save when they are missing
Previously we would also retrieve settings for untitled documents, but we now rely on untitled documents getting their encoding settings from the choice made in the save panel.
2014-10-06 20:42:42 +02:00
Allan Odgaard
44b8d5986f Go via set_disk_encoding member function 2014-10-06 20:42:42 +02:00
Allan Odgaard
6928505062 Only set encoding settings (post open) for documents with a path 2014-10-06 20:42:38 +02:00
Allan Odgaard
5eb7ede829 Don’t ignore case changes on case-insensitive file systems 2014-09-26 23:10:24 +02:00
Allan Odgaard
651138d660 Update debug output 2014-09-16 14:54:11 +02:00
Allan Odgaard
9a3ab4c46f Add option to search linked files (rather than folders)
Also reworked API slightly to make things more explicit.
2014-09-14 18:17:00 +02:00
Allan Odgaard
7e63510cfd Document changed on disk would sometimes be marked as modified
We wrap the “update document” in an undo group, but if we already have an undo group at a higher level then our “end group” would be postponed to the root group, which would delay updating the document revision, and thus the revision we use as the disk revision would be wrong.

We workaround this by forcing the undo group to end and thus ignore the one at the higher level, which should be safe.
2014-09-02 18:59:29 +02:00
Allan Odgaard
b0d57705cf Make encoding part of the document_t::reader_t API 2014-08-22 09:35:30 +02:00
Allan Odgaard
135667b655 Add file type extension to document backups 2014-07-29 23:48:37 +02:00
Allan Odgaard
e78764a89e Let threaded syntax highlight parsing for ng::buffer_t be opt-in 2014-06-28 17:42:23 +02:00
Allan Odgaard
e81286b0cd Remove unused include 2014-05-16 22:11:28 +07:00
Allan Odgaard
af3f4aaa33 Check result of most CF/CT ‘Create’ functions 2014-05-15 13:17:30 +07:00
Allan Odgaard
9a80fd4226 Fix potential stall using “save all” from find in folder
This would happen if the user manually saved one of the documents with replacements before invoking save all, since the wrong “did save” callback was called when trying to save an unmodified document.
2014-04-28 21:45:59 +07:00
Allan Odgaard
39b94e6ac3 Harmonize whitespace and add trailing newline 2014-04-14 14:26:52 +07:00
Allan Odgaard
86a5538992 Ensure server object is alive when client is destroyed 2014-04-12 20:33:30 +07:00
Allan Odgaard
375893fc7f Add a ‘did change content’ notification to document_t
This is only meant for when the document reloads content because the file was changed on disk. Long-term though, I think reloading document because of disk changes should be handled at a higher level.
2014-04-12 11:23:07 +07:00
Allan Odgaard
1452148a65 Run in default run-loop mode for document_t::sync_open 2014-04-12 11:22:53 +07:00
Allan Odgaard
e379021492 Assert that we are not blocking the main queue 2014-04-11 10:57:09 +07:00
Allan Odgaard
aaabfd2e26 Use custom test system for testing the ‘document’ framework 2014-04-08 15:43:21 +07:00
Allan Odgaard
e974582baa Allow specifying run-loop mode for document_t::sync_open 2014-04-08 15:43:20 +07:00
Allan Odgaard
3642ee2750 Save All from find window uses default run-loop mode for saving
When saving and the document needs to execute a command (e.g. callback.document.export) then we can no longer use our special run-loop mode, as command execution is now using queues, and queue dispatching is paused when running in a custom run-loop mode.
2014-04-07 17:29:49 +07:00
Allan Odgaard
6cc0108961 Rename document_t:{open,save} → document_t:sync_{open,save}
This makes it easier to search for code that use these functions.
2014-04-07 17:28:41 +07:00
Allan Odgaard
6b24c1b11f Missing broadcast when changing “on disk” in document_t::set_path
This resulted in missing proxy icon update e.g. when saving an untitled document over an existing one, as we would first set the path to the new location (and indirectly change the “is on disk” status without sending the proper notification).
2014-04-05 14:13:40 +07:00
Allan Odgaard
172d2d41c9 Ensure the com.macromates.visibleIndex attribute value is valid
Also skip checking for saved selection / visible index if there is no text in the buffer (since in this case, teh only valid values for seleciton / visible index are the default values).
2014-04-05 14:13:39 +07:00
Allan Odgaard
7f7613fe62 Change io::create_pipe API
We now return a tuple and always set FD_CLOEXEC.
2014-03-29 09:57:09 +07:00
Allan Odgaard
935da75a43 Use new path::temp API to set initial content 2014-03-28 19:31:15 +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
5bbbed72e5 Saving file with missing parent asks if it should be created 2013-12-14 14:37:55 +07:00
Allan Odgaard
94230858f8 Abort if unable to reload document
This should be handled better, but previously we would crash due to filling the stack, so better to just immediately abort when we detect the problem, so that we get a better crash report and can see how widespread the issue is.
2013-10-19 23:34:41 +02:00
Allan Odgaard
9b57695a5c Use file::reader_t for folder search 2013-10-08 21:59:56 +02:00