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.
add support for filesystem, that use others encodings than mc (vfs). Now can be
encoding set only manually, but automatic detection is possible. Filename is
converted in mc_readdir and other function translate it back by vfs_translate
added menu etries encodnig in left and rigth menu (localization will be neede)
modified subshell.c to put subshell correct working directoy,
modified ext.c and execute.c to translate filename before running command
there could be one problem, vfs_translate_path does not use something like
path_magic function
rest of fixes in files cmc.c, main.c (xterm title), panelize.c, subshell.c,
tree.c, tty.c, user.c, util.c, win.c
now, basic mc's function should work well, editor and view are still broken.
like buttons use menu entries hotkey_t. But menus are staticly defined, so this
change is much bigger. All menu declaration must be edited. follow standard
changes in drawing and handling hotkeys.
now basic mc's functions works in utf-8, remain correct calculation of controls
width in dialogs, replace functions like tolower, toupper,isspace, ... width
functions from strutil or g_ascii variant.
like in input, added multibytes characters buffer for search in panel (ctrl+s)
drawing is simplier, because alignment do directly str_fit_to_term function
from strutil, changed time functions in util to work correctly in utf-8
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.
add support for filesystem, that use others encodings than mc (vfs). Now can be
encoding set only manually, but automatic detection is possible. Filename is
converted in mc_readdir and other function translate it back by vfs_translate
added menu etries encodnig in left and rigth menu (localization will be neede)
modified subshell.c to put subshell correct working directoy,
modified ext.c and execute.c to translate filename before running command
there could be one problem, vfs_translate_path does not use something like
path_magic function
rest of fixes in files cmc.c, main.c (xterm title), panelize.c, subshell.c,
tree.c, tty.c, user.c, util.c, win.c
now, basic mc's function should work well, editor and view are still broken.
changes in sorting strings (name, extension), for comparing are created keys
from strings and than their are compared instead of primary strings. (in
reality, keys are created only for case insensitive comparing, case
sensitive compare original strings). In utf-8 shall by keys faster than
compare strings directly. But this need ediding declaration of all sorts
functions.
changes in handlig keys,
if key is ascii characters, is clear what to do. But when key is between 0x80 and
0xff, it is impossible say, if is valid, alpha, number, ...
I think, that will be better support multibytes characters directly in message
handler, but is not necessary and my patch do not do that.
like buttons use menu entries hotkey_t. But menus are staticly defined, so this
change is much bigger. All menu declaration must be edited. follow standard
changes in drawing and handling hotkeys.
now basic mc's functions works in utf-8, remain correct calculation of controls
width in dialogs, replace functions like tolower, toupper,isspace, ... width
functions from strutil or g_ascii variant.
like in input, added multibytes characters buffer for search in panel (ctrl+s)
drawing is simplier, because alignment do directly str_fit_to_term function
from strutil, changed time functions in util to work correctly in utf-8
in input widget I made a lot of changes:
1. rename some members in WInput to reflect more their functions
(field_len -> field_width, ...)
2. buffer for reading multibytes characters - charbuf, (taken from UTF-8
patch)
3. modified insert_char to accept mulstibytes characters, drawing changed
4. works only with valid strings, str_fix_string used to assure that
input->buffer is valid
changes in complete.c:
- some iteration strings with ++/-- replaced with str_next_char,
str_prev_char, where was needed. ++ was offset oriented, but str_next_char
use directly referecne (char *), so result is not extra beatiful in every
cases
- other buffer for multibytes characters
- complete only valid filenames
all options of radio box are stored in an array of hotkey_t, so radio box has own
copy of options now (in original mc has only a reference to options), changed
drawing and handling hotkey
text of button stored in hotkey_t instead of char*, modified achown.c, because
access directly button text, change in drawing button adn handling hotkey
add new structure hotkey_t for storings caption with hotkey in buttons, menus,...
contains three strings - start, hotkey, end. So hotkey could be any characters,
but mc's message handles works correct only with ascii characters.
for me is working with hotkey_t easier than how are stored hotkeys in original
mc.
add functions for working with strings
some functions are implemented directlu in strutil.c, others have ascii, 8bit
or utf-8 variant. (8bit means singlebyte encodings, where all characters have
width one). Mc autodetects terminal encoding at start and chooses right
variant. If does not know terminal encoding, chooses ascii variant.
contains functions:
1. for translation strings and growing strings
2. for working with characters (next char, prev char, length in
characters, isspace, isalnum, ...)
3. prepeare for display, replace invalid characters with questionmark,
unprintable with dot, left / right / center align
4. comparing strings
in future all string function from util should be moved into strutil, some
function from util have new variant in strutil.