mcviewer: clarify support of UTF-8 codeset.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2014-09-09 14:58:53 +04:00
parent 8f8c5217ee
commit 60e1a06c06
2 changed files with 11 additions and 6 deletions

View File

@ -135,7 +135,9 @@ struct mcview_struct
gboolean hexedit_lownibble; /* Are we editing the last significant nibble? */
gboolean locked; /* We hold lock on current file */
#ifdef HAVE_CHARSET
gboolean utf8; /* It's multibyte file codeset */
#endif
coord_cache_t *coord_cache; /* Cache for mapping offsets to cursor positions */

View File

@ -376,16 +376,15 @@ mcview_moveto_eol (mcview_t * view)
else
{
off_t eol;
bol = mcview_bol (view, view->dpy_start, 0);
eol = mcview_eol (view, view->dpy_start, mcview_get_filesize (view));
if (!view->utf8)
{
if (eol > bol)
view->dpy_text_column = eol - bol;
}
else
#ifdef HAVE_CHARSET
if (view->utf8)
{
char *str = NULL;
switch (view->datasource)
{
case DS_STDIO_PIPE:
@ -406,6 +405,10 @@ mcview_moveto_eol (mcview_t * view)
else
view->dpy_text_column = eol - bol;
}
else
#endif /* HAVE_CHARSET */
if (eol > bol)
view->dpy_text_column = eol - bol;
if (view->dpy_text_column < (off_t) view->data_area.width)
view->dpy_text_column = 0;