Skip to content

Commit

Permalink
Merge pull request FarGroup#857 from MKadaner/mzk/ChangeHexModeBytesP…
Browse files Browse the repository at this point in the history
…erLine-only-in-hex-view

Do not change the number of bytes per line in Hex View when not in Hex mode.
  • Loading branch information
alabuzhev authored Jul 22, 2024
2 parents 6829295 + 41ee0ae commit 4a17fce
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
5 changes: 5 additions & 0 deletions far/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
--------------------------------------------------------------------------------
MZK 2024-07-21 18:59:11-04:00 - build 6352

1. Do not change the number of bytes per line in Hex View when not in Hex mode.

--------------------------------------------------------------------------------
drkns 2024-07-21 12:25:59+01:00 - build 6351

Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6351
6352
18 changes: 14 additions & 4 deletions far/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ wchar_t Viewer::ZeroChar() const

void Viewer::ChangeHexModeBytesPerLine(int const Amount)
{
assert(m_DisplayMode == VMT_HEX);

if (Amount == 0) return;

const auto AbsAmount = std::abs(Amount);
Expand Down Expand Up @@ -1964,22 +1966,30 @@ bool Viewer::process_key(const Manager::Key& Key)

case KEY_ALTLEFT:
case KEY_RALTLEFT:
ChangeHexModeBytesPerLine(-1);
if (m_DisplayMode == VMT_HEX)
ChangeHexModeBytesPerLine(-1);

return true;

case KEY_CTRLALTLEFT: case KEY_RCTRLALTLEFT:
case KEY_CTRLRALTLEFT: case KEY_RCTRLRALTLEFT:
ChangeHexModeBytesPerLine(-16);
if (m_DisplayMode == VMT_HEX)
ChangeHexModeBytesPerLine(-16);

return true;

case KEY_ALTRIGHT:
case KEY_RALTRIGHT:
ChangeHexModeBytesPerLine(1);
if (m_DisplayMode == VMT_HEX)
ChangeHexModeBytesPerLine(1);

return true;

case KEY_CTRLALTRIGHT: case KEY_RCTRLALTRIGHT:
case KEY_CTRLRALTRIGHT: case KEY_RCTRLRALTRIGHT:
ChangeHexModeBytesPerLine(16);
if (m_DisplayMode == VMT_HEX)
ChangeHexModeBytesPerLine(16);

return true;

case KEY_CTRLSHIFTLEFT: case KEY_CTRLSHIFTNUMPAD4:
Expand Down

0 comments on commit 4a17fce

Please sign in to comment.