Menu

#224 Hexitor - Wrong message displayed when switching to read only mode

Fixed
nobody
Hexitor (13)
Low
Defect
2024-01-30
2024-01-27
No

If you modify a file in Hexitor, then press F4 to switch to Read Only mode, Hexitor shows the following message:

   ╔══════════════ Hex editor ═══════════════╗
   ║ The file was opened in "Read Only" mode ║
   ║          Switch to edit mode?           ║
   ╟─────────────────────────────────────────╢
   ║        { Yes } [ No ] [ Cancel ]        ║
   ╚═════════════════════════════════════════╝

This message is a little confusing, since the file was not opened in Read Only mode. Instead, we are now switching to Read Only mode from edit mode. I believe the correct message should be something like the following:

   ╔═════════ Hex editor ══════════╗
   ║ File has been modified. Save? ║
   ╟───────────────────────────────╢
   ║   { Yes } [ No ] [ Cancel ]   ║
   ╚═══════════════════════════════╝

The following patch implements the above change, and it appears to be working correctly for me.

--- a/editor.cpp
+++ b/editor.cpp
@@ -762,7 +762,7 @@ bool editor::switch_mode()
 {
    if (!_upd_data.empty()) {
        assert(_file.writable());
-       const wchar_t* msg[] = { _PSI.GetMsg(&_FPG, ps_title), _PSI.GetMsg(&_FPG, ps_swmod_warn), _PSI.GetMsg(&_FPG, ps_swmod_quest) };
+       const wchar_t* msg[] = { _PSI.GetMsg(&_FPG, ps_title), _PSI.GetMsg(&_FPG, ps_sav_modifq) };
        const intptr_t ret = _PSI.Message(&_FPG, &_FPG, FMSG_MB_YESNOCANCEL | FMSG_WARNING, nullptr, msg, sizeof(msg) / sizeof(msg[0]), 0);
        if (ret < 0 || ret == 2)
            return false;

Discussion

  • Vladimir Surguchev

    • status: New --> Accepted
     
  • Vladimir Surguchev

    • status: Accepted --> Fixed
     
  • Vladimir Surguchev

    3.16.1

     
  • Rohitab Batra

    Rohitab Batra - 2024-01-27

    The message doesn't appear to be fully fixed. Hexitor now displays the following:

       ╔══════════════ Hex editor ═══════════════╗
       ║ The file was opened in "Read Only" mode ║
       ║      File has been modified. Save?      ║
       ╟─────────────────────────────────────────╢
       ║        { Yes } [ No ] [ Cancel ]        ║
       ╚═════════════════════════════════════════╝
    

    I don't think The file was opened in "Read Only" mode should be displayed since it's misleading. This message is already displayed in the case where the file has a read-only attribute, and the user tries to input data. However, in this case, the file does not have the read-only attribute set, so this message is not accurate.

    Sorry to be so picky! If you feel this is the correct message, it's fine. Thank you.

    p.s. it would be useful to have keyboard accelerators for the above dialog, just like you have in Saving the file dialog.

     

    Last edit: Rohitab Batra 2024-01-27
  • Vladimir Surguchev

    Yes, sure. I was inattentive. Thank you.

     
  • Vladimir Surguchev

    3.16.2

     
  • Rohitab Batra

    Rohitab Batra - 2024-01-29

    Far crashes with a STATUS_ACCESS_VIOLATION when Hexitor tries to show the Saving the file dialog, i.e., if you edit the file and then press Esc or F4.

    The issue appears to be with the released binaries FarHexitor_3.16.2.4040_x64.7z.

    I compiled Hexitor from the current version [r504] of the source code, and it's working perfectly. The file save dialog shows without any issues, and pressing F4 shows the dialog with the correct message. So, this issue is resolved, except for released binaries.

    Thank you for adding the hotkeys as well.

     

    Related

    Commit: [r504]

  • Vladimir Surguchev

    Thanks again.
    Didn't rebuild release after debug finished.
    I've uploaded correct binaries as 3.16.3

     
  • Rohitab Batra

    Rohitab Batra - 2024-01-30

    No problem. All good now. Thanks!

     

Anonymous
Anonymous

Add attachments
Cancel