Commit Graph

137 Commits

Author SHA1 Message Date
Allan Odgaard
fe3dff7af6 Replace custom code with kSelectionExtendToWord 2013-01-20 12:49:34 +01:00
Allan Odgaard
ec79163f30 Avoid editor_t::variables for getting selected text 2013-01-20 12:49:34 +01:00
Allan Odgaard
e46ea56af9 Exclude gutter from accessibility
This was read as “empty scroll view” (using voice over), so better to skip it.
2013-01-17 09:16:04 +01:00
Allan Odgaard
8618224d00 Use OakCreateViewWithColor() 2013-01-16 04:40:20 +01:00
Allan Odgaard
bccaee4be6 Simplify document open API
Removed the ability to specify wether documents should open in current window or a new window — all documents opened via this API will go through the same algorithm to find where the documents should end up (more choice is just adding confusion and complexity).
2013-01-10 06:46:44 +01:00
Allan Odgaard
56ec501907 Only grab ‘untitled’ token for user-created documents
We may use OakDocumentView in a context where we don’t immediately assign it a document, or we wish to “overwrite” its default document with an untitled document that we create.

If the document view holds its own untitled document then the global counter includes that and the one we create is one higher than expected.
2013-01-08 22:48:08 +01:00
Allan Odgaard
47fa0f040c Use Objective-C literals for YES/NO 2013-01-02 01:46:48 +01:00
Allan Odgaard
8e937a7141 Require explicit import of OakFindProtocol.h 2013-01-02 01:46:48 +01:00
Allan Odgaard
c2d3690848 Remove ‘CT’-prefix from user functions 2012-12-21 16:05:28 +01:00
Allan Odgaard
8c4c927397 Workaround for possible NULL pointer
Seeing a few crashes related to CFRetain() called from CTFontCreateWithName(). My guess is that a nil font results from a bad/corrupted config file, so the actual fix might be to ensure we have a font (at a higher level).
2012-12-21 16:00:42 +01:00
Allan Odgaard
7428cd0939 Add workaround for 10.8 API
This should cause TextMate to once again run on 10.7 (issue #643).
2012-12-20 18:52:31 +01:00
Allan Odgaard
2374aafde2 Clear delegate/datasource in dealloc
There are crash reports showing the gutter view accessing its datasource in OakDocumentView’s dealloc (based on a “bounds did change” notification fired when releasing a view).
2012-12-20 14:02:39 +01:00
Allan Odgaard
71be61cbbb Enable ARC by default
We now explicitly disable it for targets that hasn’t yet been upgraded to ARC. This way, it’s easier to get an overview of which targets hasn’t yet been upgraded and ensures new targets has ARC enabled.
2012-12-19 19:42:36 +01:00
Allan Odgaard
1102f8a528 Remove use of ns::attr_string
This is only motivated by easier transition to ARC (one framework at a time) as the ns/attr_string.h header contains manual memory management, which thus cannot be included by a framework using ARC, yet the code needs to be in the header since the code is template-based.
2012-12-19 19:42:34 +01:00
Allan Odgaard
c7934a5ae5 Do not hide pop-up list when losing focus
The “hide on focus” setting is inherited by the parent window, causing the entire window to hide.

Closes issue #590.
2012-12-15 20:41:03 +01:00
Boris Dušek
5369b7cf81 Add support for “Zoom follows the keyboard focus”
Zoom is an OS X accessibility feature that lets sighted visually
impaired users magnify screen content. This commit notifies Zoom of
changes of TextMate’s caret position on screen so that Zoom can
automatically follow the caret when the user moves it.
2012-12-14 21:55:12 +01:00
Boris Dušek
224ee5fd5e VoiceOver/accessibility support for text view
This commit adds support for most common accessibility
methods/attributes to the OakTextView component. In user's language,
VoiceOver users (i.e. blind and visually impaired users) can now use
TextMate to read and write text.

A few less used accessibility attributes remain to be supported -
especially AttributedStringForRange and StyleRangeForIndex which should
allow blind users to e.g. see and seek for spelling errors in text.
2012-12-14 21:55:12 +01:00
Allan Odgaard
36902cbc6c Factor out ng::range_t ⇔ NSRange methods 2012-12-14 21:55:12 +01:00
Allan Odgaard
aef4a2206c Use caret’s right scope when expanding tab triggers 2012-09-30 15:25:45 +02:00
Allan Odgaard
9f2a4c74da Add callback.document.will-save
Commands can prepare the document for saving in this callback, e.g. strip trailing whitespace (issue #35), ensure the line always has a newline character as the last byte in the document (issue #76), or similar.

Presently having a “will-save” command fail does not abort saving (but likely should). Also, there is no check to see if the command called requires the document to be saved before running, so that likely leads to an infinite loop.
2012-09-27 17:52:41 +02:00
Allan Odgaard
e1dd99a0f5 Add window to “document will save” notification
The text view needs to do a little work before saving a document (serialize folded text) and with the window as part of the user data, we can now skip that for text views in windows for which documents are not going to be saved.

This is not an ideal solution; long-term saving will be moved up to the DocumentWindowController which has the full view of all documents and text views.
2012-09-27 17:52:41 +02:00
Allan Odgaard
e958a04945 Potentially resize gutter when bounds change 2012-09-25 22:06:16 +02:00
Allan Odgaard
71c1febc34 Constrain gutter view’s top to that of the text view
This might be what’s causing the gutter view to sometimes be shorter than the text view, although it’s merely a hunch.
2012-09-25 16:18:01 +02:00
Allan Odgaard
a0c4af64bd Remove trailing whitespace
Only removed from non-empty lines.
2012-09-25 14:16:50 +02:00
Allan Odgaard
45d38ff6c8 Use synthesized instance variables 2012-09-24 20:58:43 +02:00
Mads Hartmann Jensen
adec6e4184 Incremental search keybindings
You can now use CTRL+S and CTRL+SHIFT+S to jump forwards/backwards
in the incremental search results
2012-09-24 20:58:42 +02:00
Mads Hartmann Jensen
c2eee4578f Made the Live Search view prettier 2012-09-24 20:58:42 +02:00
Allan Odgaard
02ab2e858a Local key bindings no longer eclipse the default set 2012-09-21 20:32:31 +02:00
Allan Odgaard
bae6270d6c Add indent aware begin/end of line action methods
The methods going to “begin of indented line” will go to the first non-whitespace character on the line, unless the caret is already there or to the left of this character, in which case it will go to the actual beginning of the line.

The “end of indented line” methods work similarly.

If you want [⇪]⌘⇠/⇢ and ⌘⌫/⌦ to use this behavior, you can add the following to your key bindings file:

	"@\UF702"  = "moveToBeginningOfIndentedLine:";
	"$@\UF702" = "moveToBeginningOfIndentedLineAndModifySelection:";
	"@\UF703"  = "moveToEndOfIndentedLine:";
	"$@\UF703" = "moveToEndOfIndentedLineAndModifySelection:";
	"@\U007F"  = "deleteToBeginningOfIndentedLine:";
	"@\UF728"  = "deleteToEndOfIndentedLine:";
2012-09-21 20:29:58 +02:00
Allan Odgaard
8ea658b3cf Command-clicking single caret could lead to crash
Command-clicking an existing caret normally toggles, unless there only is a single caret, in which case it adds a caret. This would thus allow you to add a new caret sharing the position of the existing, and command-clicking again would then remove both the two existing carets, leading to an assertion failure (as there were no carets).

Fixes issue #466.
2012-09-21 16:23:35 +02:00
Allan Odgaard
6afa7601c0 Provide utf16::advance with range end
There are several crashes reported from firstRectForCharacterRange: which indicate that the system may ask for indexes “out of range”, hence why we now effectively just cap such request.
2012-09-21 01:32:41 +02:00
Allan Odgaard
d06bd877e2 Avoid using begin/endof with ng::ranges_t 2012-09-20 12:22:21 +02:00
Allan Odgaard
ebab500ba3 Use std::map/set instead of C arrays
These types come with a find() method and avoids having to use helper functions to get the begin/end of the array (for linear search).
2012-09-20 12:22:20 +02:00
Allan Odgaard
8fd7b82cbd Remove CocoaSTL.h include 2012-09-20 12:22:20 +02:00
Allan Odgaard
565242584f Ensure document stays open in refresh helper
The refresh helper uses the document’s undo manager in its destructor. Normally the document would stay open throughout the duration of the scope in which the refresh helper is used, but it might be possible to close the current document from a nested event loop, as spawned e.g. by showing a tool tip, in which case, the document will be closed when we reach the destructor.
2012-09-18 17:33:01 +02:00
Allan Odgaard
2ef3d52a3d Remove unnecessary refresh from performKeyEquivalent: 2012-09-18 17:33:01 +02:00
Allan Odgaard
c26e5c2d36 Scope attributes are now given to editor_t
While presently it works the same, it allows us to provide better scope attributes e.g. for untitled documents (which lack SCM attributes).
2012-09-18 17:33:01 +02:00
Allan Odgaard
dabcad588d Introduce OakTextViewDelegate 2012-09-18 17:33:00 +02:00
Allan Odgaard
130d0a168d Move check for indent corrections to OakTextView
This makes it easier to introduce a UI setting for the option.
2012-09-18 17:33:00 +02:00
Allan Odgaard
8f7346ee3e Reset potential column selection cursor on caret blink
Sometimes the cursor gets stuck and there is really no workaround other than periodically reset the image.
2012-09-18 17:33:00 +02:00
Allan Odgaard
1fafbecd54 Remove Chinese translation
It’s not feasible to maintain the old-style xib translations while we work on the UI. We’ll soon move fully to constraint-based layout which should allow translations to be purely string-based.
2012-09-16 11:41:23 +02:00
Allan Odgaard
baae923414 Remove resize buttons
Going forward we only allow resizing views by grabbing the dividers.
2012-09-15 15:12:57 +02:00
Allan Odgaard
5f24a91d44 Auto-layout: Update OakDocumentView
The gutter will invalidate its intrinsic size when its width changes which will cause the Cocoa layout engine to update the layout, so no more explicit code to deal with adjusting the gutter’s width.

Likewise, the height of the gutter (not the gutter scroll view) has been setup to match the height of the text view (again, not the containing scroll view). This avoids observing the text view frame and manually updating gutter height to match it.
2012-09-14 17:14:56 +02:00
Allan Odgaard
6bb23c1765 Gracefully handle missing gutter view delegate 2012-09-14 17:14:56 +02:00
Allan Odgaard
339c582f8c Auto-layout: Update incremental search (xib) 2012-09-14 17:14:55 +02:00
Allan Odgaard
144ee3762d Use NSBox to draw gutter divider
There’s a few subtle advantages of going with a view, mostly theoretical (about minimizing refresh rectangles) but switching to constrained based layout should provide minor code simplifications, since our ancestor view won’t have to deal with the gutter divider rectangle.
2012-09-14 17:14:54 +02:00
Allan Odgaard
2e2b91144d Change property to read-only
Since it uses a const reference we can’t synthesize a setter for this.
2012-09-12 18:30:37 +02:00
Allan Odgaard
cb46ba11e5 Change set-only property → method 2012-09-12 18:30:37 +02:00
Allan Odgaard
5dea94da01 Disable undo/redo menu items when appropriate 2012-09-10 22:47:58 +02:00
Allan Odgaard
cf5b5965da Don’t send theme bundle items to OakTextView
Since the text view delegates theme switching to its parent document view, we just send the theme (bundle item) directly to the document view.
2012-09-10 22:47:58 +02:00