Commit Graph

250 Commits

Author SHA1 Message Date
Allan Odgaard
41b4f03712 Let gutter view observe frame changes from OakTextView
Previously it would only observe NSViewBoundsDidChange from the clip view containing the text view, and while it worked most of the time, it failed to see notifications when a text view was smaller than the clip view’s view port and grew, yet still staying smaller than the view port.
2013-08-12 23:49:00 +02:00
Allan Odgaard
772143088a Rework code to avoid strange crash
I’m seeing a crash in ‘-[OakDocumentView dealloc]’ stating that “selectionString” is not being observed. This would indicate that a OakDocumentView instance is created that doesn’t go through the designated initializer, how that can happen is beyond me, but with the reshuffled code, if it happens, it should no longer cause a crash in dealloc.
2013-08-12 22:57:57 +02:00
Allan Odgaard
a68d206468 Add more info to crash reports 2013-08-12 22:57:56 +02:00
Allan Odgaard
a52165694c Move crash reporter info support to own framework
This is to avoid cyclic dependencies since it was previously in a somewhat high-level framework, so everything that framework depended on, could not augment crash reports.
2013-08-12 19:32:23 +02:00
Allan Odgaard
231f1f8160 Improve application specific data in crash log
This makes it easier to automatically extract and index.
2013-08-10 11:55:39 +02:00
Allan Odgaard
f17f49e95d Spelling suggestions can be chosen with 1-n 2013-08-10 00:51:27 +02:00
Allan Odgaard
1c783fede9 Use implicitly synthesized properties 2013-08-06 15:00:04 +02:00
Allan Odgaard
f4828036fe Preserve document’s scroll offset when changing soft wrap or font
Technically we preserve which line is the first visible.

Fixes #993.
2013-08-04 15:18:40 +02:00
Allan Odgaard
faf30e4786 Update document dimensions before restoring scroll position
Since the document starts out the same width as the view port, horizontal scroll position was effectively never restored, fixes #605.
2013-08-04 14:40:27 +02:00
Allan Odgaard
2c0010a141 Restore “first visible character” instead of visible rectangle
This is when switching tabs ore re-opening a file.

Restoring the visible rectangle doesn’t always work because we do an initial heuristic layout where we don’t do proper soft wrap and may also lack scoped settings to increase font size for headings, meaning that the restored visible rectangle does not point to the same section of the text, as it would with a fully updated layout.

This fixes #243.
2013-08-04 14:36:45 +02:00
Allan Odgaard
ad44540209 Use document’s indent accessor instead of going via buffer() 2013-07-29 12:43:37 +02:00
Jacob Bandes-Storch
79a1f49ec5 fixup! Show a tool tip when searching wraps around 2013-07-28 00:15:45 +02:00
Allan Odgaard
6718a8a32c Use libdispatch for threaded write to pipe 2013-07-26 23:09:14 +02:00
Allan Odgaard
974d027f23 Include key event in potential crash reports 2013-07-24 15:56:19 +02:00
Allan Odgaard
70411fa11a Show a tool tip when searching wraps around
Closes #1049, although the visual feedback could be improved (see issue).
2013-07-23 22:50:29 +02:00
Allan Odgaard
06f349507a Add a “did wrap” boolean to the OakFindProtocol API
This informs the “server” that searching wrapped around to find the match.
2013-07-23 22:45:52 +02:00
Jacob Bandes-Storch
b533df1a40 Bar button positioning tweaks 2013-07-21 13:42:43 +02:00
Allan Odgaard
27e0abfa39 Add support for printing
Closes #517.
2013-06-28 19:32:56 +02:00
Allan Odgaard
5c4a2025a3 Add menu item to toggle column selection
The motivation for this is mainly to make the ⌥ shortcut visible in the UI, which presently, it is not, as we need to “hack” the menu item to show it.
2013-06-23 11:23:42 +07:00
Allan Odgaard
e3bc6e982b Introduce editor_delegate_t
This is to avoid having editor_t hold a document_t.
2013-05-15 22:38:02 +07:00
Allan Odgaard
adf52e1ab2 Forward grammar changes to text view 2013-05-15 15:45:36 +07:00
Allan Odgaard
6e4926177e Provide symmetric content/set_content for document_t 2013-05-15 15:45:36 +07:00
Allan Odgaard
61b8c844a5 fixup! Handle “did-save” bundle item callback in OakTextView 2013-05-12 22:48:46 +07:00
Allan Odgaard
e5cca3de18 Remove ‘document_settings’ API 2013-05-12 11:09:18 +07:00
Allan Odgaard
ce4ae62547 Change ‘variables_for_path’ API
We now accept the a directory in addition to the path. If a directory is provided, the path is only used to filter variables rooted at the directory.
2013-05-12 11:09:18 +07:00
Allan Odgaard
8b3f05485d Change argument ordering for ‘scope_variables’
Generally we should always provide a base environment, since the scoped variables are format strings. The filtering scope selector is however optional, and we do not have one when executing commands outside an fi;e/editor context.
2013-05-12 11:09:17 +07:00
Allan Odgaard
10e3536a80 Change method signature
We return a variables map instead of updating a map passed in by reference. The previous API was mainly done because we couldn’t previously return non-POD from Objective-C methods. Returning a map with variables makes the API more exact, e.g. how to handle existing entries is no longer an issue (that is, the caller will have to chose the appropriate duplicate strategy).
2013-05-12 11:09:17 +07:00
Allan Odgaard
12491e22f8 Let OakTextView set TM_CURRENT_THEME_PATH
Previously we relied on the delegate to set this, but a text view may not have a delegate. One could however argue that this is a “global” setting so should be set even when there is no text view.
2013-05-12 11:09:16 +07:00
Allan Odgaard
9b4734bf98 Explicitly collect variables from different components 2013-05-12 11:09:16 +07:00
Allan Odgaard
92192341d4 Let OakTextView pass an environment to document::run()
We no longer pass the bundle item by const-reference because it is now used (delayed) in a block and const-references are not captured by blocks (i.e. the lifespan is not extended).
2013-05-12 11:09:16 +07:00
Allan Odgaard
421a46d116 Rework setup/execution of drop commands
We now collect all variables (and working directory) prior to calling document::run() to remove the need for a callback.
2013-05-12 11:09:16 +07:00
Allan Odgaard
964b56898f Consult text view delegate when setting up variables
The delegate provides file browser variables.
2013-05-12 11:09:16 +07:00
Allan Odgaard
ccf2414768 Add pwd argument to command runner
Previously this was only possible to change by setting PWD in the passed-in environment.
2013-05-12 11:09:15 +07:00
Allan Odgaard
7f4649ba32 Factor out deprecated variable collecting 2013-05-12 11:09:15 +07:00
Allan Odgaard
428739352c Obtain variables and scope context via ‘self’
This is instead of direct instance variable access.
2013-05-12 11:09:15 +07:00
Allan Odgaard
88ae04572c Handle “did-save” bundle item callback in OakTextView
While it’s easier to execute bundle items from a text view, it doesn’t work when saving documents that are not in the current text view.

This is an intermediate refactoring step — handling should (likely) end up in the DocumentSaveHelper class, but we need to improve dealing with command execution first, and by having the callback piggyback on the normal performBundleItem: method, we (temporarily) limit the code which use the command execution API, making refactoring easier.
2013-05-09 15:16:33 +07:00
Allan Odgaard
4c24bd9c00 Avoid ref to static data when returning non-POD from Objective-C
Apparently clang (now?) support transferring non-POD types from and to Objective-C++ methods, eliminating the need for doing this by passing a (const) reference.
2013-05-09 15:16:33 +07:00
Allan Odgaard
5fd188531a Change naming of functions for obtaining variables
These are now all prefixed with what they are obtaining variables for (scope, document, bundle, …) which makes it easier to analyze/refactor the code.

Also change document_t’s settings function to document_settings.
2013-05-09 15:16:32 +07:00
Allan Odgaard
135c6c79b7 Remove redundant instance variable 2013-05-06 14:51:31 +07:00
Allan Odgaard
7796e18e59 Limit exposed stuff in OTV headers 2013-05-03 14:41:52 +07: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
bcc3e4c1fb Fix refresh/undo for commands causing document saving
Since saving is asynchronous the scoped refresh/undo helper would do “cleanup” before the command ran and potentially made document changes.

Commands executed at a lower level (i.e. by editor_t via macros) presently still has this issue. This should be fixed when macros are refactored (this isn’t the only issue related to macros).

Closes #450.
2013-04-25 16:38:33 +07:00
Allan Odgaard
f81292aa51 Only disable font smoothing on high-DPI displays
The fontSmoothing defaults key can now be set to:

 0: Always disabled
 1: Always enabled
 2: Disabled for dark themes
 3: Disabled for dark themes on high-DPI displays (default)

/cc issue #958.
2013-04-24 21:54:27 +07:00
Allan Odgaard
fe400c1487 Disable font smoothing for dark themes
If you wish to always have font smoothing enabled you can run:

    defaults write com.macromates.TextMate.preview fontSmoothing 1

Setting the value to 0 causes it to always be disabled and deleting the key (or setting it to 2) has it disabled only for dark themes.
2013-04-21 19:17:06 +07:00
Allan Odgaard
ced23336de Harmonize a few properties
This is just implementation detail.
2013-04-21 19:15:05 +07:00
Allan Odgaard
974e263588 Remove instance data from OakTextView.h 2013-04-21 19:15:05 +07:00
Sergey Chikuyonok
72dd8e2047 Extended OakTextView API
Added `scopeAsString` method to retrieve current scope as NSString
2013-04-21 12:20:07 +07:00
Allan Odgaard
773891cd47 Introduce global setting to disable typing pairs
This is presently only settable via the ‘disableTypingPairs’ user defaults key:

    defaults write com.macromates.TextMate.preview disableTypingPairs -bool YES

Closes #609.
2013-04-10 10:13:01 +07:00
Allan Odgaard
7f933bfc57 Disable auto-pairing when recording macros
Since auto-pairing can be adjusted via user customization we disable it for both macro recording and replay. Old macros will need to be updated (but this was already the case, as 2.0 never did pairing as part of replay).

A better solution is to record each implicit action of the auto-pairing in the macro. This can however be added later without breaking existing macros, as the macro player will remain the same.

Closes #130.
2013-04-10 10:13:01 +07:00
Allan Odgaard
0bf02dbeff Move divider line functions to OakUIConstructionFunctions.h 2013-04-02 04:11:32 +07:00