Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

How to temporarily disable the undo buffer while preserving its contents?

Hi! I wrote IDE Studio for MUMPS language.

In this language moment of modifying the source code stored in the first program line, like this:


APCateg; Comment; [05/03/2013 12:25 PM]

  code code code code

  code code code code

  code code code code


That is, before each saving I need to fix the first line of code, but it must be done without going through the undo buffer.Just reset the undo buffer is impossible.

how can I do this hack?

Comments

  • 7 Comments sorted by Votes Date Added
  • Hi,

    Unfortunately, this is not possible. This will break system consistency...
  • edited May 2013 Posts: 10Vote Up0Vote Down

    I understand that.

    In general, you have a very cool and comfortable to make the mechanism of cancellation.

    But what to do, the time stamp in the program - it's a good old tradition for MUMPS. It can not be canceled because of the beauty of architecture.I need a hack. I understand that this will break the system, but the system may "not notice" the change is only one line;)

  • Posts: 0 Accepted Answer Vote Up0Vote Down
    Hi,

    1) If you need a hack, you can change our sources and create it for yourself.
    2) But, you will never be able to **protect** this first line against modifications by the user.
    3) The system is implemented so that all offsets in undo buffer stored as direct Integer numbers, so, if the length of replaced by you fragment will by different, undo will fail to operate properly.
  • Ok. So sad :(

  • Posts: 0 Accepted Answer Vote Up0Vote Down
    In your situation, I would think about different way. For example, you can create UI closer to the tradition. Some thing like:

    1) Add a label on the top of edit view, adjust its back color and font to match the edit view. Turn off the border of the view itself and add a common border around view and label. This way the label will be seen just as a first text line. Yes, it will be non-scrollable, but just think more in this way... You can, for example,hide the label or just its text when the view is scrolled out from the top of document... 
    2) You can add this first line of code (stored in label) before saving in file.
    3) And remove this line (decode it) after loading the file.

    Of course, this will not be exactly equal to what you want, but at the same time, for usual user this can be seen as attempt to keep the tradition using modern UI style. And thus, will be considered by the user as a good aspect of your software.
  • Thanks for advice.
Sign In or Register to comment.