aboutsummaryrefslogtreecommitdiff
path: root/text-motions.c
AgeCommit message (Collapse)AuthorFilesLines
2025-12-22move all standard library includes into util.hRandy Palamar1-6/+0
2025-12-16delete functions which were exposed as unusedRandy Palamar1-47/+0
2023-07-16partial revert of commit f55312baJohn Vogel1-1/+2
text_paragraph_prev(): Bring back the previous usage of text_iterator_byte_get() in the while conditional and text_iterator_char_prev() in the loop body. Fixes #1028 - { moves back a paragraph too much if cursor at start of line
2020-09-17text: improve text_line_down on the last line of the fileMarc André Tanner1-0/+2
Fix #873
2020-01-28Merge branch 'master' of https://github.com/eafe/visMarc André Tanner1-1/+1
2020-01-26vis: don't search off screen when highlighting matchesGeorgi Kirilov1-7/+11
2020-01-24text: unconditionally use REG_NOTEOL for backward searchesMarc André Tanner1-3/+1
This fixes empty backward searches ?$ starting at the line end.
2020-01-23text: fix search wrapping for overlapping matchesMarc André Tanner1-6/+2
Previously, searches wrapping around did not report any results if they started from within the eventual match. Fix this by enlarging the search area to the whole text after reaching the first boundary. See also #787.
2020-01-23text: fix spurious regex anchor matchesMarc André Tanner1-4/+11
The regex anchors ^ and $ must not match at the start/end of the search range unless it is preceded/succeeded by a new line. This is implemented at the text-motion layer by passing the appropriate REG_NOT{B,E}OL flags to the search backend, meaning the caller can influence the anchor behavior depending on the context. This is important as for example in the command language the anchors apply to existing selections, not line boundaries.
2020-01-12vis: fix search wrapping bugszsugabubus1-2/+1
1) “$” matches in the middle of the text. visvis ^ - standing here \/ - at first we search forward-\ \_/ - wrap, if nothing found <---/ After wrapping, in the second range “$” will treat end of the range as EOL so “/vis$” will wisely match and moves cursor to the first column. 2) No match after wrapping. vissssss ^^ - standing here or here \\____/ - search this before wrapping ---\ V - search range after wrapping <--/ “/vis” will *not* match (after wrapping), because it crosses ranges. --- So the real solution would be that instead of the end position, the start position of the possible match should be limited because a match can cross the search ranges. To keep things simple, simply search two whole text after wrapping. visvis \____/
2018-07-11add tab character to special characters array (#1)eafe1-1/+1
The special characters array doesn't contain the tab character thus causing issue 711. By adding the tab character to the array, quotes are matched correctly across tab characters, too. Although much less used, other white space characters such as \v, \f, and \r should perhaps be added as well.
2018-04-08Fix "parenthese" in identifiersTwoFinger1-2/+2
2018-03-14Merge branch 'paranthese-typo' of https://github.com/Two-Finger/visMarc André Tanner1-2/+2
2018-03-11Reset parsing state after mbrtowc(3) failureMarc André Tanner1-0/+2
The standard says "if an encoding error occurs ... the conversion state is unspecified".
2018-03-05Fix a typo in identifiersTwoFinger1-2/+2
2018-02-27text-motion: ignore blank lines for next/prev paragraph motionsMarc André Tanner1-6/+4
2018-02-27text-motion: implement text_line_blank_{prev,next}Marc André Tanner1-0/+23
2017-04-09text: use MB_LEN_MAX instead of MB_CUR_MAXMarc André Tanner1-2/+3
2017-04-09text: drop special handling of \r\n line endingsMarc André Tanner1-54/+20
2017-04-08text: simplify \r\n handlingMarc André Tanner1-21/+17
2017-04-04vis: add motions to move by codepointsMarc André Tanner1-0/+12
Some people might prefer this for <Backspace> behavior. Except for that and debugging purposes using `ga` and `g8` it is not yet that useful.
2017-03-19vis: make sure g_ does not cross line boundariesMarc André Tanner1-8/+2
This also eliminates dead code as reported by CID 142387.
2017-02-25vis: fix $ motion for lines containing \rMarc André Tanner1-2/+2
2017-02-25vis: make ^ and g_ only skip blank (spaces+tabs) charactersMarc André Tanner1-2/+3
2017-02-24vis: fix ^ motion for blank lines terminated by \r\nMarc André Tanner1-1/+1
2017-02-15vis: remove motion and text objects related to C functionsMarc André Tanner1-75/+0
These do not really belong into the editor core. If desired they could be implemented in Lua instead.
2017-02-15text-motions: remove unused text_line_lastcharMarc André Tanner1-8/+0
2016-10-09vis: fix g_ motion to never cross line boundariesMarc André Tanner1-3/+11
2016-08-24text-motions: improve matching quotation marks heuristicMarc André Tanner1-32/+55
Prefer quotation marks on the same line to when looking for matching pairs. Improves #358.
2016-04-27text-motions: fix character next motion within a lineMarc André Tanner1-2/+1
2016-04-13text-motion: simplify implementation of [{, ]}, [( and ]) motionsMarc André Tanner1-21/+8
2016-04-12Add "[(" and "])" motions for jumping to a parenthese pair's start/endRob Pilling1-0/+8
2016-04-12Add "[{" and "]}" motions to jump to a block's start/endRob Pilling1-0/+26
2016-04-11text-motions: fix misspelled function name "is_word_boundry"Steven Noonan1-5/+5
Should be "is_word_boundary" Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2016-04-06text-motion: restore old text_{line_,}find_prev behaviorMarc André Tanner1-3/+1
This partially reversts the "Fix to/till movements" commit 0d4093c3371079c5f75055338f0341f684542465 The pos += len hunk was interfering with other code which does not want this behavior. The original issue should be fixed directly within the to/till movements.
2016-03-23Remove identically replicated copyright comments from source filesMarc André Tanner1-15/+0
2016-02-13Convert call sites of text_line_char_{get,set} to text_line_width_{get,set}Marc André Tanner1-4/+4
2016-02-13text-motion: add functions to get/set position based on display widthMarc André Tanner1-0/+77
This is inherently a tricky thing to do because we cannot rely on the current display state. The reason being that the position/cursor which is modified might not currently be in the visible area. Tabs are a particular problem because they have a variable display width. However this new code is certainly not worse than the current behaviour which relies on text_line_char_{get,set} and thus simply counts graphemes. Not yet completely convinced that this is the right approach.
2016-02-03text-motion: hide ugly casts for isboundary behind a #defineMarc André Tanner1-16/+17
2016-02-03text-motion: hide ugly casts for isspace behind a #defineMarc André Tanner1-17/+19
2016-02-03text-motion: export custom word motion functionsMarc André Tanner1-4/+4
2016-02-03fix {, }, (, ) movementsMarkus Teich1-70/+44
- split the functions, so the algorithms are more clear - paragraph movements work backwards - paragraph movements work consistently with \r\n line breaks always placing the cursor on the first character of the first empty line before/after the paragraph - sentence movements now work better at BOF/EOF - save a few lines of code
2016-01-27text-motion: change text_bracket_match APIMarc André Tanner1-3/+3
2016-01-20Fix to/till movementsMarkus Teich1-5/+6
Some corner cases allowed to move between lines with the to/till movements. The change in find_prev serves two purposes. When searching for a string which the cursor is already above the match, this match is returned (pos += len). Secondly there was a failure when searching for strings with len == 1 which lead to `matched == 0` which was always true, even if the string was not found, therefore leading to a wrong return value.
2016-01-10text-motion: fix integer overflow in text_search_{forward,backward}Marc André Tanner1-6/+6
2015-11-23Cast argument to ctype.h is* functions to unsigned charMarc André Tanner1-27/+27
The signedness of char is implemenation defined, calling the is* type of functions with negative values leads to undefined behaviour.
2015-11-08Update year numbers in Copyright clauseMarc André Tanner1-1/+1
2015-11-07text-motion: do not treat ' as string delimiter in match bracketMarc André Tanner1-2/+2
Currently symbols inside a string are ignored. This means that if the opening (closing) symbol is inside (outside) the string while the closing (opening) one is outside (inside), it will not be matched. It is not yet clear whether this "optimization" is useful. Closes #97
2015-08-07vis: limit to/till movements to current lineMarc André Tanner1-2/+22
2015-08-02text-motion: make text_bracket_match more robustMarc André Tanner1-8/+17
Brackets which occur inside strings are ignored.