15 Commits

Author SHA1 Message Date
Allan Odgaard
5c7b04fbd3 Add missing include for test/jail.h 2016-06-19 08:45:16 +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
b20629d9a1 Use public constant for bookmark identifier 2014-10-15 10:31:22 +02:00
Allan Odgaard
39b94e6ac3 Harmonize whitespace and add trailing newline 2014-04-14 14:26:52 +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
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
1d4d3bd3d3 Fix path/inode lookup when opening documents
The strategy is to prefer an existing document with same path and if there is none, check if there is a document with the same inode. The latter is so that links or files that have been moved, do not create duplicate documents.

The old code used a single map for the lookup, using path::identifier_t as key (wrapping path and/or inode), though since the map is ordered, the code would occasionally fail, as the keys cannot be correctly ordered (so effectively this reworked code is a fix for an incorrect path::identifier_t::operator<).

Fixes #1052.
2013-07-30 15:34:17 +02:00
Allan Odgaard
98585e166e Use byte range for replacement API 2013-07-27 16:30:02 +02:00
Allan Odgaard
6e4926177e Provide symmetric content/set_content for document_t 2013-05-15 15:45:36 +07:00
Jacob Bandes-Storch
e3aa997b06 Use libc++: replace std::tr1 with std 2012-08-28 13:30:20 +02:00
Allan Odgaard
6f45ee4a9c Use encoding::type for open related API 2012-08-26 17:06:38 +02:00
Allan Odgaard
9894969e67 Initial commit 2012-08-09 16:25:56 +02:00