Commit Graph

80 Commits

Author SHA1 Message Date
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
Steven Clukey
8cea97aeca Added spaces as an invisible 2013-10-08 22:00:11 +02:00
Allan Odgaard
51a7424c90 Add additional crash report info 2013-10-08 21:59:54 +02:00
Allan Odgaard
40233245e2 Add crash report info to code involved in a crash 2013-10-04 16:51:27 +02:00
Allan Odgaard
fb8627d077 Intersect left/right scope for rendering soft break nodes
This is only relevant for indented soft wrap where e.g. the text following the soft break is underlined: Previously we would then render an underline for the soft break node itself (which normally consists of whitespace).
2013-09-12 23:46:04 +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
d93b20d571 Use new scope_t API 2013-08-28 00:23:08 +02:00
Allan Odgaard
057096af5b Rename API to make searching easier
Using generic names like ‘append’ is not good when analyzing code for potential refactoring.
2013-08-27 15:30:09 +02:00
Allan Odgaard
b25f716f86 Remove rforeach macro 2013-08-12 19:32:23 +02:00
Allan Odgaard
d9b446dcc2 Update some use of the iterate macro to for(… : …) 2013-08-03 17:44:30 +02:00
Allan Odgaard
c460535cf7 Add some debug output to layout_t 2013-08-03 17:30:13 +02:00
Allan Odgaard
3c1fe38190 Use a capturing lambda function instead of global variable
The code involved is only for debug output.
2013-08-03 17:25:42 +02:00
Allan Odgaard
c7764b8b14 Deleting trailing newline for line with foldings would misbehave
Here misbehave means unfold the folded text (on the same line) but as a single line.

Fixes #257
2013-08-03 17:18:53 +02:00
Allan Odgaard
560f2ce110 Inserting newline at start of line with foldings would misbehave
Here misbehave means unfolding the folded text on a single line.

Fixes #933
2013-08-03 16:59:15 +02:00
Allan Odgaard
84dc2dd871 Allow a target to use both new and old test system
Presently the new test system cannot be used for (interactive) GUI tests, so we keep the old one until we have that feature in the new.
2013-08-01 19:01:24 +02:00
Allan Odgaard
bc1fae555a Update testing system for layout framework 2013-07-26 17:37:16 +02:00
Allan Odgaard
c22ed7ce09 Make layout_t::update_metrics public 2013-06-28 17:21:11 +02:00
Allan Odgaard
715624b952 Handle failure to create folding dots image
Based on crash reports this appears to happen for some users, though only reason I can imagine is if the images are not found in the application bundle (which would happen if the application is moved after launch, but that normally cause many things to fail).
2013-04-28 11:46:35 +07:00
Allan Odgaard
9a7b440c5a Fix off-by-one when validating folding ranges
Closes #927.
2013-04-01 13:22:41 +07:00
Allan Odgaard
82c30b77db Don’t load bundles from layout test
Ideally we would have the BundlesManager load the bundles but since tests don’t have their own framework requirements, this would require that the layout framework is setup to depend on the BundlesManager framework.
2013-03-25 13:21:53 +01:00
Steven Clukey
636c321e46 Adjust scroll past end height logic
This will work properly with very long lines and soft wrap

Fixes #869.
2013-03-07 20:23:11 +01:00
Allan Odgaard
e8cd0b0df7 Reject bad folding meta data
Fixes issue #866.
2013-03-05 16:42:22 +01:00
Steven Clukey
7892eac2d4 Add “scroll past end” option to the View menu
When enabled the height of the document is increased by the height of the view port, which means the last lines of the document are not anchored to the bottom of the view port but can e.g. be centered.

Closes #513.
2013-03-03 15:14:29 +01:00
Allan Odgaard
461756bc09 Avoid typecasts 2013-02-18 15:38:27 +01:00