Allan Odgaard
09ea4b3e46
When document changes (on disk) ensure all selections are valid
2014-04-12 14:13:50 +07:00
Allan Odgaard
db13d4c1f9
Use std::string::back() instead of operator[] with size()-1
2014-03-31 08:27:18 +07:00
Allan Odgaard
cefb8cb2db
Simplify sub-word movement tests
2014-03-25 12:19:58 +07:00
Allan Odgaard
527668683c
Include numbers as a group for sub-word movement
2014-03-25 12:19:58 +07:00
Allan Odgaard
15025edbcc
Set “color” to true if range is untouched by ‘extend_if_empty’
2014-03-25 12:19:57 +07:00
Allan Odgaard
62645601f5
Introduce range_t::color field for somewhat arbitrary use
...
Also do a better job of preserving the “unanchored” property of a range.
2014-03-25 12:19:57 +07:00
Allan Odgaard
54d7f4bbeb
Split regexp used for sub-word movement into multiple lines
2014-03-23 22:47:15 +07:00
Allan Odgaard
9397335400
Add tests for sub-word movement
2014-03-23 22:47:15 +07:00
Allan Odgaard
af0e6cc643
Change decltype(mapVariable)::value_type → auto (C++14)
2014-03-16 18:06:03 +07:00
Allan Odgaard
c2397484b8
Use C++11 for loop
...
Majority of the edits done using the following ruby script:
def update_loops(src)
dst, cnt = '', 0
block_indent, variable = nil, nil
src.each_line do |line|
if block_indent
if line =~ /^#{block_indent}([{}\t])|^\t*$/
block_indent = nil if $1 == '}'
line = line.gsub(%r{ ([^a-z>]) \(\*#{variable}\) | \*#{variable}\b | \b#{variable}(->) }x) do
$1.to_s + variable + ($2 == "->" ? "." : "")
end
else
block_indent = nil
end
elsif line =~ /^(\t*)c?iterate\((\w+), (?!diacritics::make_range)(.*\))$/
block_indent, variable = $1, $2
line = "#$1for(auto const& #$2 : #$3\n"
cnt += 1
end
dst << line
end
return dst, cnt
end
paths.each do |path|
src = IO.read(path)
cnt = 1
while cnt != 0
src, cnt = update_loops(src)
STDERR << "#{path}: #{cnt}\n"
end
File.open(path, "w") { |io| io << src }
end
2014-03-03 10:34:13 +07:00
Allan Odgaard
9cfd98446f
The ng::word_at function would not extend selection to full word
...
This would affect the buffer completion, which would work sub-optimally when selecting part of the word for replacement.
2014-02-14 00:40:54 +07:00
Allan Odgaard
da31c2d11a
Introduce ng::word_at (refactoring)
2014-02-11 20:55:01 +07:00
Allan Odgaard
286a92c792
Select word at EOL with trailing whitespace was a no-op
2014-02-01 21:34:34 +07:00
Allan Odgaard
16f7109656
Fix swapped freehanded left/right constants
...
In practice move() isn’t called with a freehanded left/right constant so the incorrect placement wasn’t causing an issue.
2014-01-13 11:16:11 +07:00
Allan Odgaard
7b0e92376c
Add “wordCharacters” as a scoped setting
...
Set this to a string of which characters should be added to the set of word characters.
2013-10-30 21:16:20 +01:00
Allan Odgaard
1c308c810d
Use map::emplace instead of inserting std::pair (C++11)
2013-09-05 20:59:11 +02:00
Allan Odgaard
b52b13329e
Call scope_t::empty instead of using an operator bool cast
2013-08-30 12:30:34 +02:00
Allan Odgaard
69316d4da1
Don’t call scope_t::push_scope with empty scope attributes
...
Previously would be called with an empty string.
2013-08-30 12:30:33 +02:00
Allan Odgaard
d93b20d571
Use new scope_t API
2013-08-28 00:23:08 +02:00
Allan Odgaard
057096af5b
Rename API to make searching easier
...
Using generic names like ‘append’ is not good when analyzing code for potential refactoring.
2013-08-27 15:30:09 +02:00
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