Commit Graph

28 Commits

Author SHA1 Message Date
Allan Odgaard
bf1e92b865 Do not use global constructors for fixtures 2013-08-16 22:40:08 +02:00
Allan Odgaard
7e1242b26f Improve handling of zero-width search results
Previously when using find next/previous and the caret was already on a zero-width match position, TextMate would stay on this match.
2013-07-31 20:58:10 +02:00
Allan Odgaard
267471d7bb Account for multi-byte characters when moving search position
Fixes #1070
2013-07-31 20:24:16 +02:00
Allan Odgaard
0c59a10aa1 Update testing system for selection framework 2013-07-26 13:53:58 +02:00
Allan Odgaard
d40faab873 Improve ng::find semantics
When no matches are found then we search the selected range for a match and use that.

Also add a “did wrap” out parameter to the API.
2013-07-23 21:15:35 +02:00
Allan Odgaard
25ed8b4e62 Highlight pairs can now be regular expressions
These settings are also consulted for “pair movement”, i.e. ⌃↓/⌃↑ and ⇧⌘B, so by using regular expressions we can match begin/end tags and navigate between these.
2013-07-21 13:25:30 +02:00
Allan Odgaard
920d75b2e7 Remove warning from regexp test
The problem is with the underlying library and has been reported to its issue tracker.
2013-07-21 13:25:30 +02:00
Allan Odgaard
32e18b2697 Improve code to find “paired character ranges”
The algorithm now handle overlapping character ranges like: ‘(f{o)o}’ and unpaired characters surrounded by character pairs.

This is for selecting (⇧⌘B) and moving to the begin or end of the range (⌃↓/⌃↑).
2013-07-21 13:25:28 +02:00
Allan Odgaard
ad02f214ac Improve readability of brace movement tests 2013-07-21 13:25:27 +02:00
Allan Odgaard
4480684421 Prevent (some forms of) overlapping selections 2013-06-25 19:36:32 +02:00
Allan Odgaard
6e5181210e Don’t let up/down abort multiple carets when all on same line
In this situation, abort the multiple carets by moving them all to the beginning or end of the current line (⌘←/⌘→ or ⌃A/⌃E).
2013-06-21 01:43:42 +07:00
Allan Odgaard
e75e7ec8e5 Change text::format → std::to_string (C++11) 2013-02-08 11:20:34 +01:00
Allan Odgaard
1f1883db28 Regular expression searches no longer ignore case 2013-02-08 11:20:34 +01:00
Allan Odgaard
89dccee126 Fix wrong behavior when selecting to end of line
This also affected a few other selection actions.

Fixes #738.
2013-02-02 08:52:13 +01:00
Allan Odgaard
3752b0205f Add to list of actions that enable multiple carets
Selecting to begin/end of typing pairs or end of line/paragraph will now also break up a column selection into multiple carets.
2013-01-30 19:29:02 +01:00
Allan Odgaard
fa6659db28 Update dyn.caret/selection scopes
If there is one or more selections:

    dyn.selection

If there is a single zero-width selection:

    dyn.caret.mixed.columnar

If there are multiple carets and/or selections:

    dyn.caret.mixed

When there is only a single caret or a single continuous selection the left scope may contain:

    dyn.caret.begin.line
    dyn.caret.begin.document

Likewise the right scope may contain:

    dyn.caret.end.line
    dyn.caret.end.document
2012-09-30 15:25:45 +02:00
Allan Odgaard
a0c4af64bd Remove trailing whitespace
Only removed from non-empty lines.
2012-09-25 14:16:50 +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
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
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
2ab6f4bfc8 Introduce an “extend selection” find option
This will find (forwards or backwards) but preserve the existing selection.

Presently if the current selection is a zero-width selection (i.e. caret) then we still preserve it. This might not be desired, but one could imagine “extend selection” used with a regular expression which use a look-around assertion (resulting in zero-width matches).
2012-09-06 23:10:55 +02:00
Allan Odgaard
2c572b5921 Add initializer list constructor to ng::ranges_t
This is primarily for using in tests.
2012-09-06 23:10:55 +02:00
Allan Odgaard
2076f80ca8 Make selections created from string unanchored
The selection string syntax doesn’t support specifying an anchor and mainly it is used in situations where the selection should be unanchored.
2012-09-06 14:08:08 +02:00
Allan Odgaard
cbe91ff831 Assume compiler support for explicit keyword
Since we require a fairly recent clang for other features, there is no reason to test for this one.
2012-08-29 14:27:35 +02:00
Allan Odgaard
1477288795 Redefine definition of paragraph
When we need to work on a paragraph (reflow, unwrap, select, etc.) we now extend upward until we see a blank line, and likewise move downward until there is a blank line.

This is related to issue #154.
2012-08-18 21:52:08 +02:00
Allan Odgaard
be63bda3e7 Support East Asian Width
There is a bunch of functions that deal with the logical column count and these now all count code points with the “east asian width” (unicode) property set as two columns.

This closes issue #206.
2012-08-18 21:29:05 +02:00
Allan Odgaard
c7c45b448b Make code to obtain character class public
This includes renaming the constants from using a rather generic kType prefix to kCharacterClass.
2012-08-15 16:00:28 +02:00
Allan Odgaard
9894969e67 Initial commit 2012-08-09 16:25:56 +02:00