Ticket #2435: goto to the specified address in hex mode of viewer.

Viewer Goto dialog doesn't allow go to the specified offset. The value
of input line is rounded to the next line start. Such bevaviour
is useless in hex mode of viewer. In hex mode we must heve a
capability to go to the specified address as is without any round.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2010-12-04 12:57:45 +03:00
parent 4bc7c55cba
commit 0f3729426a

View File

@ -266,22 +266,31 @@ mcview_dialog_goto (mcview_t * view, off_t * offset)
{ {
case MC_VIEW_GOTO_LINENUM: case MC_VIEW_GOTO_LINENUM:
mcview_coord_to_offset (view, offset, addr, 0); mcview_coord_to_offset (view, offset, addr, 0);
*offset = mcview_bol (view, *offset, 0);
break; break;
case MC_VIEW_GOTO_PERCENT: case MC_VIEW_GOTO_PERCENT:
if (addr > 100) if (addr > 100)
addr = 100; addr = 100;
*offset = addr * mcview_get_filesize (view) / 100; *offset = addr * mcview_get_filesize (view) / 100;
if (!view->hex_mode)
*offset = mcview_bol (view, *offset, 0);
break; break;
case MC_VIEW_GOTO_OFFSET_DEC: case MC_VIEW_GOTO_OFFSET_DEC:
*offset = addr;
break;
case MC_VIEW_GOTO_OFFSET_HEX: case MC_VIEW_GOTO_OFFSET_HEX:
*offset = addr; *offset = addr;
if (!view->hex_mode)
*offset = mcview_bol (view, *offset, 0);
else
{
addr = mcview_get_filesize (view);
if (*offset > addr)
*offset = addr;
}
break; break;
default: default:
*offset = 0;
break; break;
} }
*offset = mcview_bol (view, *offset, 0);
} }
} }