Skip to content

Commit

Permalink
cre: allow non-word chars in text selection (#742)
Browse files Browse the repository at this point in the history
By starting or ending text selection on a punctuation char,
a quote or a paren..., these will now be included in the text
selection and the higlighted text.

bump crengine, which includes:
- Avoid wrap on a space before or after some specific chars
  • Loading branch information
poire-z committed Oct 11, 2018
1 parent 19519c5 commit 01a39e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions cre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1129,9 +1129,13 @@ static int getTextFromPositions(lua_State *L) {
return 0;
r.sort();

if (!r.getStart().isVisibleWordStart())
// Only extend to include the whole word when we are actually
// holding inside a word. This allows selecting punctuation,
// quotes or parens at start or end of selection to have them
// included in the highlight.
if (r.getStart().isVisibleWordChar() && !r.getStart().isVisibleWordStart())
r.getStart().prevVisibleWordStart();
if (!r.getEnd().isVisibleWordEnd())
if (r.getEnd().isVisibleWordChar() && !r.getEnd().isVisibleWordEnd())
r.getEnd().nextVisibleWordEnd();
if (r.isNull())
return 0;
Expand Down

0 comments on commit 01a39e9

Please sign in to comment.