Commit Graph

428 Commits

Author SHA1 Message Date
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
13f35bd5b1 Whitelist rather than blacklist inherited variables
Initially the environment was clean but it was found that some variables should be inherited, e.g. SSH_AUTH_SOCK.

Therefor a blacklist was introduced, but it seems futile trying to keep it updated with all the variables that may affect the behavior of commands executed from within TextMate, therefor we now use a whitelist.

Probably the whitelist should be user configurable as launchd uses environment variables to communicate dynamically allocated sockets (like SSH_AUTH_SOCK, but there are also some Apple-prefixed variables pointing to named sockets).

Issue #238.
2012-09-21 17:50:52 +02:00
Allan Odgaard
9f339bbae1 Fix thread related crash
Since the std::map hosting the basic environment was using a (function local) static initializer, it would be destroyed during exit — though there might be threads using the basic environment, and joining these might happen after destroying the basic environment.

This should explain the crash in network::launch_tbz.
2012-09-21 17:50:52 +02:00
Allan Odgaard
a1a5569ae6 Don’t select implicit padding
For example moving the selection often require padding to be inserted, previously this padding would become part of the selection.

This fixes issue #72.
2012-09-21 16:24:43 +02:00
Allan Odgaard
e4ea7834c1 Refactoring 2012-09-21 16:24:43 +02:00
Allan Odgaard
057f07448f Fix “move selection” for east asian scripts
Since it moves one column left/right and east asian scripts have their glyphs count as two columns, it would effectively move half a column, which in practice would be done by inserting a space.

Fixes issue #469.
2012-09-21 16:24:43 +02:00
Allan Odgaard
86461a30b7 Add flag to ignore east asian width 2012-09-21 16:24:42 +02:00
Allan Odgaard
3f012ff11c Recent menu ignores files created with “New Tab” 2012-09-21 16:24:42 +02:00
Allan Odgaard
fbbe4ddac7 Cap line number when requesting info from layout
With the new constraint based layout, the gutter can issue line record requests before the layout has been updated to hold the new document buffer.
2012-09-21 16:23:35 +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
a3cae448b1 fixup! Use Objective-C for…in instead of macro 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
56ec46e1f9 fixup! Avoid using objc_ptr 2012-09-21 01:32:41 +02:00
Allan Odgaard
0f3861fec7 Retire custom begin/endof functions
We can now use std::begin/end although for containers we explicitly call the member functions.
2012-09-20 12:22:21 +02:00
Allan Odgaard
c7971c5f63 Use range-based for instead of std::for_each 2012-09-20 12:22:21 +02:00
Allan Odgaard
d06bd877e2 Avoid using begin/endof with ng::ranges_t 2012-09-20 12:22:21 +02:00
Allan Odgaard
d71b9ea324 Avoid using begin/endof with strings
Mainly this is just to phase out the use of these custom helpers.
2012-09-20 12:22:20 +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
a9ba549cda Use strchr instead of std::find 2012-09-20 12:22:20 +02:00
Allan Odgaard
39f0ea518b Use tuple instead of lexicographical_compare 2012-09-20 12:22:20 +02:00
Allan Odgaard
45c87c47f8 Rename CocoaSTL.h → objc_ptr.h 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
4273bf968b Get rid of C++ style NSIndexSet iteration 2012-09-20 12:22:19 +02:00
Allan Odgaard
101e0560f6 Avoid using objc_ptr 2012-09-20 12:22:19 +02:00
Allan Odgaard
4532099359 Use Objective-C for…in instead of macro
This avoids having to use C++ iterators and we want to get rid of some of this Objective-C/C++ mixing for ARC and other reasons.
2012-09-20 12:22:19 +02:00
Allan Odgaard
6b42343bd3 Add missing include 2012-09-20 12:22:19 +02:00
Allan Odgaard
017343a7dc TM_SELECTED_TEXT must not exceed ARG_MAX
If the selection exceeds ARG_MAX (256 KB) then we instead set it to a placeholder value.

Previously execve() would fail if given a selection (environment) variable too big.
2012-09-20 12:22:19 +02:00
Allan Odgaard
2ba66c5718 Add four flavors of copy to find in folder window
These actions are available from the settings / action menu in the status bar above the results.

Calling the regular copy (⌘C) copies the entire lines. Probably it should only copy the matching subset when a regular expression search has been performed.
2012-09-19 02:13:53 +02:00
Allan Odgaard
22644470f8 Fix crash when clicking exactly on split view divider 2012-09-19 00:11:11 +02:00
Allan Odgaard
b049dd8892 Opening folder sets up window title/scope attributes 2012-09-18 22:57:03 +02:00
Ryan Maxwell
c24f365daa Use curly quotes in dialog text 2012-09-18 20:28:07 +02:00
Allan Odgaard
536ea62f2d The indent ignore fold pattern would affect start/stop markers
When we wish to (ab)use the indented fold system to fold sections in markup languages we set the ignore pattern to ignore all but the heading markers. Some markup languages also have markup that might be suitable for folding with explicit start/stop markers, previously these were ignored, if matched by the ignore pattern.

This is an incomplete fix as we don’t correctly nest a start/stop marked block inside a section (the section will stop at the fold start marker).
2012-09-18 20:27:49 +02:00
Allan Odgaard
361d2daa5b Fix wrong document showing after session restore
Since documents are loaded asynchronously and we trigger a request for the first tab’s document, this might finish loading after the selected tab’s document, hence trigger a setDocument: after we loaded the selected document’s tab.
2012-09-18 19:38:01 +02:00
Allan Odgaard
48616a7ea1 Make document_t::scope private
Ideally should be removed entirely but as document presently does load/save where we need scopes (for import/export commands), we need it internally.
2012-09-18 19:38:01 +02:00
Allan Odgaard
8964971e98 Remove document_t::path_attributes 2012-09-18 19:38:01 +02:00
Allan Odgaard
79b0f7a14a Setup scope attributes for untitled documents
These are based on the potential save directory (i.e. the one showing in the file browser) and ensures pressing ⌥⌘N gives the new document proper project and SCM scopes (so ⌘Y and ⌘B works as expected).

This fixes issue #367.
2012-09-18 17:33:02 +02:00
Allan Odgaard
5e453d1172 Accept directory in file::path_attributes
This is so that we can get SCM system, build system, and similar.
2012-09-18 17:33:02 +02:00
Allan Odgaard
45763d4afc Don’t require file to get SCM info
We didn’t actually use the file itself, only its parent directory, and there are several places we want SCM info for an untitled file’s project directory, so removing the need for a file simplifies things.
2012-09-18 17:33:02 +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
54bf2be75f Make variable const
Just to stress that map is immutable.
2012-09-18 17:33:01 +02:00
Allan Odgaard
848d197f7a Use DocumentController over document_t 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
4ad00f7797 Avoid calling scope in completion functions
Instead we pass the scope as a parameter.
2012-09-18 17:33:00 +02:00
Allan Odgaard
19ef687334 Preserve arguments for recursive call to self 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
08666a37ba Fix type error 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