Commit Graph

3671 Commits

Author SHA1 Message Date
Allan Odgaard
b45212f73d Make document_view_t’s document instance private 2016-06-13 13:01:10 +02:00
Allan Odgaard
998c0da999 Pass document_view_t when a buffer_api_t type is required 2016-06-13 13:01:10 +02:00
Allan Odgaard
db5120c940 Add buffer_api_t conformance to document_view_t 2016-06-13 13:01:10 +02:00
Allan Odgaard
2ae0f41a10 Make write_unit_to_fd helper function work with buffer_api_t 2016-06-13 13:01:10 +02:00
Allan Odgaard
029dab73be Make to_xml a member function of buffer_t
We could implement this by using the public scopes member function though this function includes dynamic scopes such as misspelled ranges which would change the current semantics of the to_xml helper function.

It might actually make sense to make this change, but I’m avoiding functional changes while refactoring.
2016-06-13 13:01:10 +02:00
Allan Odgaard
36fedf5bee Change most buffer helper functions to accept buffer_api_t 2016-06-13 13:01:10 +02:00
Allan Odgaard
84ef816ec3 Introduce a buffer_api_t abstract base class
This allows us to use the various helper functions (mainly found in the selection library) with alternative buffer implementations.
2016-06-13 13:01:10 +02:00
Allan Odgaard
9dc2eb0aee Make refresh_helper_t’s document requirement explicit 2016-06-13 13:01:10 +02:00
Allan Odgaard
0a58c4e44d Make document_view_t’s layout and editor instances private 2016-06-13 13:01:10 +02:00
Allan Odgaard
857ce3a2e1 Pass document_view_t to items_for_tab_expansion 2016-06-13 13:01:09 +02:00
Allan Odgaard
14eb6fdca4 Add refresh cycle wrappers to document_view_t 2016-06-13 13:01:09 +02:00
Allan Odgaard
18eb5b98a8 Remove layout_t argument from document_view_t::perform 2016-06-13 13:01:09 +02:00
Allan Odgaard
424f396c86 Add document_t::set_indent wrapper to document_view_t 2016-06-13 13:01:09 +02:00
Allan Odgaard
c1c92e21c1 Add namespace qualifier to some helper functions
This should make their origin more clear.
2016-06-13 13:01:09 +02:00
Allan Odgaard
e77049d55f Add buffer_t::operator[] wrapper to document_view_t 2016-06-13 13:01:09 +02:00
Allan Odgaard
7d7914c46b Add undo_manager_t wrapper functions to document_view_t 2016-06-13 13:01:09 +02:00
Allan Odgaard
03529a0184 Add buffer_t wrapper functions to document_view_t 2016-06-13 13:01:07 +02:00
Allan Odgaard
9be3c12879 Add editor_t wrapper functions to document_view_t 2016-06-13 13:00:39 +02:00
Allan Odgaard
3d175d3ff7 Add layout_t wrapper functions to document_view_t 2016-06-13 13:00:37 +02:00
Allan Odgaard
f7e61679b9 Add missing space (coding style) 2016-06-13 13:00:04 +02:00
Allan Odgaard
2a0a3b6172 Pass document_view_t to refresh helper instead of its members 2016-06-13 13:00:04 +02:00
Allan Odgaard
84d83c93ed Introduce wrapper for editor_t and layout_t
This is first step toward consolidation of document_t, buffer_t, editor_t, and layout_t.
2016-06-13 13:00:00 +02:00
Allan Odgaard
10e6527eaa Remove unused indentCorrections property from OakTextView
The intent was to expose indent settings via the UI which is still a goal, but we’ll do a lot of refactoring first, so removing unused public API to make refactoring simpler.
2016-06-13 12:59:31 +02:00
Allan Odgaard
b59dee8e6d Use semantic assertion 2016-06-13 12:59:31 +02:00
Allan Odgaard
02a5747f89 Ignore /usr/bin/git if /usr/bin/xcode-select -p fails
On recent OS versions the /usr/bin/git executable will prompt the user to install git (if Xcode is not already installed) which can cause some user confusion, so we now avoid using /usr/bin/git unless Xcode is installed.
2016-06-13 12:59:31 +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
39a7d5a867 Do not prevent coalescing last edit when redoing it
We always undo the last edit without any coalescing so the user can be sure that ⌘Z only undos the last thing they did. For redo though this makes less sense, although it does break symmetry, i.e. pressing ⌘Z n times will bring us back again by pressing ⇧⌘Z only n-1 times.
2016-06-13 12:59:31 +02:00
Allan Odgaard
32be8a4541 Cap line/column given to buffer_t::convert 2016-06-13 12:59:31 +02:00
Allan Odgaard
20fb69494b Make two buffer_t member functions private
One of them is used by the undo manager so we declare undo_manager_t a friend of buffer_t.
2016-06-13 12:59:31 +02:00
Allan Odgaard
59c5b0023d Refactor: Consistent buffer_t parameter name (buf → buffer) 2016-06-13 12:59:31 +02:00
Allan Odgaard
414c336ba9 Remove descendants when mark to remove has a trailing slash 2016-06-02 21:07:43 +02:00
Allan Odgaard
8e8a647e25 Add algorithm to erase descendent keys form a std::map
This can be used when the key is name spaced, e.g. `/foo/bar` or `foo.bar`. Here we can erase everything under foo by using `/foo/` or `foo.` respectively.
2016-06-02 21:07:43 +02:00
Allan Odgaard
4ee49c95f6 Remove forward declaration of non-existing data type 2016-06-02 21:07:43 +02:00
Adam Strzelecki
aba1eb42ac Exclude given scopes when extending selection
This introduces new scope setting - excludeFromParagraphSelection, that
prevents extending selection to some scopes, eg. on comment.line.

Previously when reformatting paragraph comment lines were selected as paragraph
lines, this have led to mixing comment content into reformatted paragraph
content breaking the syntax of reformatted code, eg.:

  some very long ... line of text
  # some comment
  some other long ... line of text

As an effect we got:

  some very long ...
  ... text # some comment some other ...
  ... line of text

The problem described above was especially visible when using ⌃Q to Reformat
block of Git commit message, when below of the typed text there was a Git
default comment. Also this problem could be noticeable by authors using LaTeX.

This change checks whether a candidate line scope for paragraph extension has a
excludeFromParagraphSelection set to true and breaks upon such line, eg.
comment line.

Doing Select Paragraph ⌃⌥P again will select the comment as well.
2016-06-02 21:07:43 +02:00
Allan Odgaard
4899fa17f1 Checkin release notes v2.0-beta.9.3 2016-05-30 15:16:24 +02:00
Allan Odgaard
b2940e56c9 Gutter images are only drawn as monochrome when isTemplate is YES
This allows adding color swatches to the gutter e.g. to show CSS colors.
2016-05-30 14:39:16 +02:00
Allan Odgaard
19b5b3f9a1 Add “Template” suffix to note, warning, error, and search images
If we fail to load an image by name then we try again with a “Template” suffix so that commands can still set marks using just `note`, `warning`, and `error`.

When loading by full path and the path (minus extension) has a “Template” suffix then we manually set the image’s template property to YES since the system only seems to do this for images loaded from bundles.
2016-05-30 14:30:45 +02:00
Allan Odgaard
0457c189c8 Add “Template” suffix to bookmark and folding gutter images
Currently we assume that all images are template images and thus render them as such, but this might change.
2016-05-30 13:57:51 +02:00
Allan Odgaard
ce41c94d93 Multiple semantic classes can now be assigned to a bundle item
The classes should be given as a comma-separated list and is mainly useful because the semantic class system doubles as a way to indicate that an item should be used as a callback.
2016-05-30 12:18:59 +02:00
Allan Odgaard
57d64d515a Introduce new callback: callback.document.did-open
Bundle items using this as their semantic class will be executed when the document is first loaded.
2016-05-30 12:00:44 +02:00
Allan Odgaard
c649aed750 Update window title for Recent Projects dialog 2016-05-29 21:19:07 +02:00
Allan Odgaard
a198d3c25b Rename Open Favorites… menu item to Recent Projects…
Also use ellipsis glyph for the Open… menu item.
2016-05-29 21:17: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
cda4b3fd63 Fix typo in release notes (horizontal → vertical) 2016-05-28 22:14:20 +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
be74280993 Checkin release notes 2016-05-25 09:55:20 +02:00
Allan Odgaard
039b787d37 Use same newline heuristic for open document and find in folder
Previously the heuristic used (when files mix LF, CR, and CRLF) for searching files on disk (find in folder) was not identical to the heuristic used when opening files.

This meant that in rare situations a match could be found at what the find in folder determined to be the n’th line, but when opening the file, it was the m’th line (where m != n).
2016-05-24 21:56:00 +02:00
Allan Odgaard
91a7fa0ad2 Change heuristic to detect line endings
Only if there is consistent use of CR or CRLF will we treat the file as such, otherwise it is treated as LF delimited.
2016-05-24 17:11:24 +02:00