Menu

#518 buffer lock

none
closed-accepted
None
5
2017-12-31
2016-06-14
No

When I call "Macros / Files / Toggle ReadOnly", it changes not only readonly status of the buffer but also the permissions of the file.

I want another "ReadOnly", which would make the buffer read-only WITHOUT changing the file attributes.

This is useful when I view a mission-critical file, in order not to damage it incidentally.

Discussion

  • Skeeve

    Skeeve - 2017-10-28

    Is this macro sufficient?

    textArea.selectAll();
    Registers.copy(textArea,'$');
    jEdit.newFile(view);
    EditBus.send(new PositionChanging(editPane));
    Registers.paste(textArea,'$',false);
    

    It will copy the whole file content to a new file.

     
  • Roman Tsourick

    Roman Tsourick - 2017-11-02

    I believe this feature should be in the core.

     
  • Skeeve

    Skeeve - 2017-11-02

    Hmmm…

    I just tested with jEdit 05.04.99.00 on Mac OS X 10.12.6 (x86_64)

    I opened a read-only file and had no issues editing it. No need to change a read-only mode.

    But when I tried to save, I was asked whether or not I want to reset the read-only mode of the file.

    So I think it can be closed as fixed.

     
  • Roman Tsourick

    Roman Tsourick - 2017-11-03

    This is not what the creator asked for.
    The request is about "editing lock" of a buffer, not a file, as title states.

     
    • Skeeve

      Skeeve - 2017-11-06

      Oops…

      Completely misunderstood.

      In theory, this should make a buffer readonly:

      buffer.setReadOnly(true);
      

      In practice it didn't work on my Mac. I still can edit the file.

       
  • Dale Anson

    Dale Anson - 2017-11-14

    There is an 'isEditable' method in Buffer. I believe this is a request for a 'setEditable(true/false)' method, yes?

     
  • Dale Anson

    Dale Anson - 2017-11-14

    I've looked through the code and this is easy to implement at the buffer level, but I'm not sure where to put the setting. Should it be a checkbox in the Open dialog? In the buffer options? Both?

    I checked in the API change in revision 24779. There is no gui to set it yet, but it is testable by using beanshell: Utilities - Beanshell - Evaluate Beanshell Expression, enter buffer.setEditable(false). This will make the current buffer non-editable. Use buffer.setEditable(true) to restore editing capabilities.

     
  • Roman Tsourick

    Roman Tsourick - 2017-11-20

    I'd use "locked" instead of "editable". According to the code editable status used as more generic term, which can have many reasons. While "locked" state can be the one of those reasons itself. What do you think?

    Why not use widget in the status bar? I just made one while was learning, attached.

     

    Last edit: Roman Tsourick 2017-11-20
  • Roman Tsourick

    Roman Tsourick - 2017-11-24

    I think, I can implement the buffer option also, if there are no objections to my idea of "L". Dale, do you mind if I take over?

     
    • Dale Anson

      Dale Anson - 2017-11-24

      It's not assigned to me :)

       
  • Roman Tsourick

    Roman Tsourick - 2017-11-24
    • assigned_to: Roman Tsourick
     
  • Roman Tsourick

    Roman Tsourick - 2017-12-01
    • summary: Ability to change readonly status of the buffer (not file!) --> buffer lock
     
  • Roman Tsourick

    Roman Tsourick - 2017-12-31
    • status: open --> closed-accepted
     

Log in to post a comment.