patches by Rostislav Beneš: mc-30-view
commitb7b74c2f0316b22862d474d4e07c1cc7f7077aaa
authorSlava Zanko <slavazanko@gmail.com>
Sun, 28 Dec 2008 23:55:48 +0000 (29 01:55 +0200)
committerSlava Zanko <slavazanko@gmail.com>
Mon, 26 Jan 2009 10:05:43 +0000 (26 12:05 +0200)
tree5897223c63c85cab8e300bf6afc6ecb52607af2c
parent1efbe4a18a3594347a16194ff89cbcf664915ca4
patches by Rostislav Beneš: mc-30-view

experimental patch, completely different reading file, new cache structure,
shall view text in every encodings (remaped ctrl + t, new dialog need
localization).

1. to avoid backward reading, viewer keeps four following characters from
    file: next, actual and two previous. This is enough to handle new lines
    and nroff fortmatin correctly.
2. cache_line structure, that presents one line in file. cache_line stores,
    where line starts and ends in file,number of line and width of line. Width
    is at most equal to screen width, so longer lines are cached in more
    cache_lines. This makes wrapping text very easy. Cache_lines are stored
    in a linked list. file is loaded into cache_lines sequential, not whole at once.
    It only provides navigation in file.

I found two problems in this solution:
    1. slow first move to end in large files, because can not read files
        backward. (loading in background may help)
    2. it is slow with multibyte characters. I tried to eliminate calling iconv
        to two, but it did not help (iconv is called on every byte). I think
        caching some parts of file will be needed.
src/view.c