aboutsummaryrefslogtreecommitdiff
path: root/text-motions.c
AgeCommit message (Collapse)AuthorFilesLines
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.
2015-08-02vis: add motions [[, [], ][, ]]Marc André Tanner1-0/+107
They behave not like in vim, but instead try to find the start/end of C-like function definitions. The first character stands for the direction [ for backwards, ] for forwards. The second character denotes the start [ or end ] respectively.
2015-08-01text-motion: fix text_find_{next,prev}Marc André Tanner1-5/+12
It is after all a stupid O(n*m) algorithm, hence restart after a failed partial match. Code like this would benefit from a proper test suite ...
2015-07-28text-motion: introduce text_line_char_{get,set}Marc André Tanner1-6/+27
2015-07-28text-motion: add functions to iterate over lines of a rangeMarc André Tanner1-0/+33
2015-07-24text-motion: introduce text_line_{up,down}Marc André Tanner1-0/+12
2015-07-03Add movements to next/previous character within same lineMarc André Tanner1-0/+18
These movements always keep the cursor on the same line and do not move over newlines.
2015-04-21Clean up to/till movementsMarc André Tanner1-8/+10
2015-04-10Highlight matching cursor symbolMarc André Tanner1-2/+7
2015-01-13Add new logical linewise movementsMarc André Tanner1-0/+9
The column position is currently not correctly preserved when there are lines with multibyte characters involved spanning multiple screen lines. In general this might still be a bit fragile.
2015-01-05define underscores to be part of a wordMatthias Braun1-1/+1
2014-09-27Add text objects for word (lowercase) variantMarc André Tanner1-1/+1
2014-09-27Simplify text_line_finishMarc André Tanner1-5/+1
2014-09-27Implement proper distinction between word and WORDMarc André Tanner1-26/+37
2014-09-25Add infrastructure for word (lowercase) motionsMarc André Tanner1-0/+25
This unfortunately doesn't work as is which is why it is not actually hooked up to key bindings.
2014-09-25Perform some renames in preparation for different word typesMarc André Tanner1-4/+4