Re: [dev] [sandy] [PATCH] VIM key bindings.
On July 11, 2014 1:26:08 AM EEST, Maxime Coste <frrrwww_AT_gmail.com> wrote:
>On Thu, Jul 10, 2014 at 11:45:07PM +0300, Dimitris Zervas wrote:
>> On July 10, 2014 11:29:59 PM EEST, Evan Gates <evan.gates_AT_gmail.com>
>wrote:
>> >> I will agree that it's super easy to implement and understand and
>it
>> >covers most needs.
>> >> But how about search?
>> >> Is it fast?
>> >
>> >What about structural regular expressions as found in sam that
>aren't
>> >limited to lines?
>> >-emg
>> Oh, I've got a lot more to learn...
>> and how will you pass the whole text?
>
>It is very fast to search or use regexes with that, as long as your
>algorithm
>supports strings in multiple part (PCRE does, I am not familiar enough
>with
>Posix regex API to tell if you can easily use multiple strings in
>them). But
>that is a requirement for any buffer storage strategy besides a big
>malloc.
>
>In C++, I basically use a std::vector<std::string> so I do not have to
>care
>about maintaining the sizes and capacities myself, but in C a buffer
>would
>be:
>
>struct line_t
>{
> char* data;
> size_t size;
> size_t capacity;
>};
>
>struct buffer_t
>{
> line_t* lines;
> size_t size;
> size_t capacity;
>};
>
>Accessing a character is just buffer.lines[line].data[column],
>iterating
>on character is just incrementing column, checking if column ==
>line.size
>and if so setting column to 0 and incrementing line.
>
>Cheers,
>
>Maxime.
But how are you going to deal with lines longer than the capacity of a line? or buffers longer than the capacity of buffer?
Received on Fri Jul 11 2014 - 00:26:38 CEST
This archive was generated by hypermail 2.3.0
: Fri Jul 11 2014 - 00:36:07 CEST