104 Commits

Author SHA1 Message Date
Allan Odgaard
371d426c5f Add ‘char const*’ insertion API to ng::buffer_t 2016-06-21 23:23:44 +02:00
Allan Odgaard
4758061719 Do not add final newline to hex dump 2016-06-21 10:51:55 +02:00
Allan Odgaard
a60e32b41a Draw selection in left/right margin when line is fully selected 2016-06-13 13:02:49 +02:00
Allan Odgaard
b2ce37f1c4 Add getter for a layout’s wrap column
Also rename wrapping member function to soft_wrap.
2016-06-13 13:01:11 +02:00
Allan Odgaard
f7e61679b9 Add missing space (coding style) 2016-06-13 13:00:04 +02:00
Allan Odgaard
c136a21804 Use indexed_map_t to track foldable lines
It is not clear to me whether there was a reason that this code was using the basic_tree_t directly or if it was just written before the indexed_map_t layer was introduced.
2016-06-13 12:59:31 +02:00
Allan Odgaard
ec42982b13 Simplify code to setup folding patterns 2016-06-13 12:59:31 +02:00
Allan Odgaard
0af49d6d27 Folding indented blocks no longer include trailing empty lines
The rationale for this is that when empty lines are included it leaves no whitespace between functions.

Example and TextMate 1.x behavior described here: http://pastie.org/private/lgtnlvc8tdvghoppocob5q
2016-05-29 20:51:57 +02:00
Allan Odgaard
e83fee564c Refactor: use emplace_back(…) instead of push_back(make_pair(…)) 2016-05-28 22:12:46 +02:00
Allan Odgaard
63ce297012 Fix issue with lines matched by multiple folding patterns
Previously when a line was a start or stop marker, and was also matched by `foldingIndentedBlockIgnore` then we would set the line’s indent to INT_MAX to ensure the line would not terminate a foldable indented section, i.e. basically storing the “line should be ignored” in the indent since the line’s type was already set to start or stop marker (rather than “ignored line”).

However, the indent is used to pair start/stop markers, so if only one of a start/stop pair was also matched as an ignored line, they would not be considered a pair because of the different indent levels. The opposite could also be the case, where two lines with different indent were both ignored, and this was seen to share the same indent.

This partially reverts commit 337ac1219d.
2016-05-28 22:07:11 +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
Josh Bernitt
263da53c81 Optionally draw a horizontal line for every tab stop
This can be toggled using View → Show/Hide Indent Guides or controlled per file type via the `showIndentGuides` setting in `.tm_properties`.
2016-05-02 19:58:01 +02:00
Allan Odgaard
337ac1219d Preserve indent ignore matches for start/stop fold markers
See issue at http://lists.macromates.com/textmate/2016-January/039183.html

This is a continuation of 536ea62f2d
2016-04-18 20:10:17 +07:00
Orta Therox
34fa11ab3d Add a horizontal 2px margin on the Folding closed indicator 2016-04-15 00:25:24 +07:00
Allan Odgaard
edf2923f3a Allow obtaining character rectangle placed on the baseline 2015-11-19 22:29:27 +07:00
Allan Odgaard
f06f447ede Avoid referencing private types by using std::remove_pointer 2015-08-27 22:46:53 +02:00
Allan Odgaard
123471a6e8 Use arc4random_uniform (in tests) to avoid modulus bias 2014-12-16 16:02:09 +07:00
Allan Odgaard
5b39bdc98b Remove double semi-colons at end of line 2014-11-14 10:21:34 +01:00
Allan Odgaard
fe71fa1aaf Use CGImageRelease instead of CFRelease 2014-10-14 12:29:46 +02:00
Allan Odgaard
9a326d1f5f Do not prevent empty lines from being a fold start/stop marker
This is compatible with how TextMate 1.x works. We identify empty lines because we want to ignore them when finding the last line in an indented block, though this commit should not break that, unless the language in question have one of the folding patterns match empty lines and have also enabled indent based foldings.
2014-10-03 21:49:13 +02:00
Allan Odgaard
c9a13a82c5 Fix deprecation warnings 2014-09-03 17:02:25 +02:00
Allan Odgaard
6bdad1733e Move handling of invisible character mapping to ng::context_t 2014-09-03 16:06:44 +02:00
Allan Odgaard
06b6802d05 Do not export ng::paragraph_t and supporting to_s function 2014-09-03 16:05:14 +02:00
Allan Odgaard
2f1c4c05c4 Do not use ‘timeIntervalSinceNow’ with dates in the past
We previously negated the result but now we instead ask for [[NSDate date] timeIntervalSinceDate:startDate].
2014-08-21 16:07:23 +02:00
Allan Odgaard
833d724779 Check for failure when creating CTLineRef related objects 2014-07-31 15:36:19 +02:00
Allan Odgaard
bb3b997a56 Do not create temporary CTLineRef for lines without tabs
This also avoids creating the paragraph style object for these lines.
2014-07-31 15:36:19 +02:00
Allan Odgaard
082c665457 Do not create tab stop at location zero
I do not understand what the point of this tab stop is.
2014-07-31 15:36:19 +02:00
Steven Clukey
98dfefb5e0 Add space invisible
The implements the space invisible using the new method of drawing the invisibles so it does not affect right-to-left text.
2014-07-31 15:36:18 +02:00
Steven Clukey
e0c6e14de0 Make CoreText manage the tabs
Rather than putting tabs in their own node, leave them in the text nodes and allow core text to handle the size. This fixes the issue with using tabs in right-to-left text.
2014-07-31 15:36:18 +02:00
Boris Dušek
e08a40a507 layout: Fix bol_as_eol for case where range length is 0
bol_as_eol was meant for non-empty ranges, but the only place where
empty ranges were attempted with bol_as_eol was for Zoom tracking,
and it seems like I did not re-test Zoom after making the bol_as_eol
commit.

Fixes textmate/bugs#4
2014-07-16 23:21:21 +02:00
Allan Odgaard
5af1ec23ca Enable ligatures
If you are using the Mensch font then you need to update to version 2 to avoid problems with the ligature for ‘fi’: http://robey.lag.net/2012/08/22/mensch-2.html
2014-07-06 14:50:11 +02:00
Allan Odgaard
af3f4aaa33 Check result of most CF/CT ‘Create’ functions 2014-05-15 13:17:30 +07:00
Allan Odgaard
b8804d1164 Fix three memory leaks
One was per launch, one was per key event, and one was per (unique) line drawn.
2014-05-15 13:17:29 +07:00
Allan Odgaard
39b94e6ac3 Harmonize whitespace and add trailing newline 2014-04-14 14:26:52 +07:00
Allan Odgaard
f445f19287 Add assertion to check if index is within allowed range 2014-04-12 11:23:07 +07:00
Allan Odgaard
ff94480298 Check that CoreFoundation functions succeed
Several crash reports indicate failure to create a CFString (in ct::line_t’s constructor). As we have an explicit UTF-8 check, I am not sure why it would fail, but at least now TextMate should not crash when it happens.
2014-04-10 17:46:30 +07:00
Allan Odgaard
96de950ed1 Return initializer list instead of using std::make_pair (C++11) 2014-04-06 19:36:09 +07:00
Reza Mohammadi
54d0903c2f No representation for usual ZERO-WIDTH chars
ZWNJ is so common in Persian texts, and its unicode bi-direction class in neutral.
But the representation chunk contains latin characters and are so left-to-right.
So, when ZWNJ is replaced by the representation chunk, rtl texts are rendered incorrectly.

ZWJ and ZWSP are from the same class, but less common at least in Persian texts.
2014-03-15 18:21:28 +03:30
Allan Odgaard
1e11a30a53 Remove redundant storage keywords for @property
These were required prior to the new 64 bit run-time.
2014-03-05 16:39:54 +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
ae26988b39 If any folding pattern is set as a scoped setting, use it
Previously we would fallback on the grammar’s folding patterns unless ‘foldingStartMarker’ was set, which meant setting just the stop marker or indented folding patterns, would be ignored.
2014-02-22 16:00:00 +07:00
Joachim Mårtensson
0d0ee4c51c refactor duplicate folding code into one method 2014-02-08 01:31:09 +01:00
Allan Odgaard
26f60bc52a Change ASSERT_NE → ASSERT
Since we do not have a to_s function defined for the iterator type, we cannot use “semantic assertions”.
2013-12-21 11:20:15 +07:00
Allan Odgaard
bc56cc240f Add API to unfold a range
The function will unfold anything completely within the range that also touches one of the range’s end points.

This is because the layout will show adjoining folded ranges as a single image, so if the user clicks this, it is unclear which of the ranges to actually unfold (the layout return a range that encompass all the adjoining folds).
2013-12-20 09:55:29 +07:00
Allan Odgaard
43d3ead3e3 Add API to get folded range for a point
This is required to show tool tips when hovering a fold marker or to unfold the fold marker clicked.
2013-12-20 09:13:48 +07:00
Boris Dušek
c7fbcf06ed Fix accessibility visual bounds ending at line boundary
Accessibility visual bounds for a range of a single softline should always
be also visually restricted to the softline. This is in order to be consistent
with implementation in Apple's apps (e.g. TextEdit).
2013-11-15 17:58:28 +07:00
Boris Dušek
e0298cf29c Provide conversions between softlines and buffer positions 2013-11-15 17:58:11 +07:00
Boris Dušek
b8cad485d9 Track softline count in layout 2013-11-15 17:04:50 +07:00
Allan Odgaard
c5449af10f Revert "Added spaces as an invisible"
Fixes #1145

This reverts commit 8cea97aeca.

Conflicts:
	Frameworks/layout/src/paragraph.cc
2013-10-18 20:31:56 +02:00
Steven Clukey
49c949d65e Add layout_t::set_character_mapping
This allow configuring which characters should be used to render tabs, spaces, and newlines (when “show invisibles” is enabled).
2013-10-08 23:03:40 +02:00