18 Commits

Author SHA1 Message Date
Ingo Karkat 461680fd4b Add ingo#text#frompattern#GetNext() 2022-12-05 21:28:01 +01:00
Ingo Karkat 1be8756170 ingo#{area,text}#frompattern#Get(): ENH: Use (new) matchArea / (old) replacement to add to result
This allows the predicate to actually modify what get's added; for more flexibility.
2022-03-05 10:32:01 +01:00
Ingo Karkat ab9fe6afe9 ingo#{area,text}#frompattern#Get(): ENH: Add cursorPos and additional arguments to context object 2022-03-05 09:21:49 +01:00
Ingo Karkat c4ea0e478d ingo#text#frompattern#GetCurrent(): Add a:options.returnValueOnNoSelection
And also support the a:options.firstLnum, a:options.lastLnum that have been added to the underlying ingo#area#frompattern#GetCurrent().
2020-07-18 15:27:33 +02:00
Ingo Karkat 42cbfdb9db ingo#text#frompattern#GetCurrent() CHG: Turn a:currentPos argument into a:options
And also support the a:options.firstLnum, a:options.lastLnum that have been added to the underlying ingo#area#frompattern#GetCurrent().
2020-07-18 15:27:32 +02:00
Ingo Karkat b6a4807840 Documentation: FIX: Minor: Use correct corresponding function (copy-and-paste error) 2020-07-18 14:53:57 +02:00
Ingo Karkat 99b59c8db4 ingo#{area,text}#frompattern#Get(): Pass context object instead of just the match
This allows for more flexibility and avoids cumbersome setup work if the predicate needs to maintain some state across individual invocations.
2020-03-01 12:40:33 +01:00
Ingo Karkat 215292a6a5 ingo#text#frompattern#Get(): Inline s:UniqueAdd(), add s:PredicateCheck(), and only invoke the latter if non-unique match
This avoids predicate invocations that later would be discarded due to duplicate matches, which makes for better semantics if the predicate maintains some state across invocations (e.g. counting the number of matches).

Also, there was a small bug lurking in the previous implementation with a:isOnlyFirstMatch was set: a non-unique match would still discard the remainder of the line (and thereby potentially discarding following non-unique matches) because s:UniqueAdd() did not indicate the uniqueness and the code always proceeded.
2020-02-29 19:17:53 +01:00
Ingo Karkat 7e63d0cd5f Add optional a:Predicate argument to ingo#area#frompattern#Get() and ingo#text#frompattern#Get()
Additionally, the a:isOnlyFirstMatch and a:isUnique arguments are optional now, too.
2020-02-29 16:43:58 +01:00
Ingo Karkat 4a26ab8149 ingo#text#frompattern#Get(): Make last three arguments optional
Most clients don't have a different replacement and use the default global matching and non-unique return. This simplifies their use in the future.
2020-02-29 15:55:04 +01:00
Ingo Karkat 19df426b3d Add ingo#area#frompattern#GetCurrent() and ingo#text#frompattern#GetCurrent(), variants of ...#GetAroundHere() 2019-07-11 16:58:17 +02:00
Ingo Karkat 949da6c42d Add ingo/area/frompattern.vim module 2017-08-24 17:18:06 +02:00
Ingo Karkat 1d72dbaf06 Add ingo#text#frompattern#GetAroundHere()
inspired by http://stackoverflow.com/questions/30073662/vim-copy-match-with-cursor-position-atom-to-local-variable
2017-05-26 17:36:56 +02:00
Ingo Karkat fcd45e05e7 ingo#text#frompattern#GetHere(): Do not move the cursor (to the end of the matched pattern); this is unexpected and can be easily avoided 2017-05-26 17:34:17 +02:00
Ingo Karkat abb4dce7eb 2017-05-26 17:33:59 +02:00
Ingo Karkat bd836e6c04 2017-05-26 17:32:37 +02:00
Ingo Karkat 3616879748 Add ingo#text#frompattern#GetHere() 2017-05-26 17:27:30 +02:00
Ingo Karkat 18e0cec4fc file creation 2017-05-26 17:26:30 +02:00