Request: Anti-Overwrite Plugin

Discuss and announce AkelPad plugins
Post Reply
  • Author
  • Message
Offline
Posts: 84
Joined: Wed Jan 27, 2016 6:53 pm
Location: Europe

Request: Anti-Overwrite Plugin

Post by SaFeTyPe »

Hello,
I have been using a not-that-well-known editor by the name of "Smedit" (Sinner Computing) for about ten years.
Now I'd like to switch to Akelpad, but there's a function missing that I very much rely on with Smedit, namely the Ovr Sel (Overwrite Selection) function. This prevents deletion of selected text by any key, except for the Delete key. Even keys such as backspace and tab will not delete selected text. Since I select text very often and also scroll about in the document, there is always a chance of accidentally deleting text. Smedit makes sure this will not happen.
Is it possible to write such a plugin (it should be absolutely reliable and intefer in no way with the functioning of Akelpad other than the stated purpose), and would anyone be interested in writing it? :-)

Thanks a lot for your attention!

Offline
Posts: 3217
Joined: Wed Nov 29, 2006 1:19 pm
Location: Киев, Русь
Contact:

Post by VladSh »

AkelPad has the Read only mode - it's 4216 command. I have given the command to Ctrl+E.

Offline
Posts: 2247
Joined: Tue Aug 07, 2007 2:03 pm
Location: Vinnitsa, Ukraine

Post by FeyFre »

VladSh
Немного недопонял. Редактировать можно, НО если есть выделение, то единственное что можно делать - удалить его кнопкой Delete, остальные должны игнорироваться. Тут скрипт может справиться по моему.

Offline
Posts: 3217
Joined: Wed Nov 29, 2006 1:19 pm
Location: Киев, Русь
Contact:

Post by VladSh »

FeyFre
Просто представил альтернативу. Можно уже пользоваться, а можно ждать)

KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

SaFeTyPe
Resident script: NoOverwriteSelection.js.

Offline
Posts: 84
Joined: Wed Jan 27, 2016 6:53 pm
Location: Europe

Post by SaFeTyPe »

(sry, pls del)
Last edited by SaFeTyPe on Wed Feb 03, 2016 12:19 am, edited 1 time in total.

Offline
Posts: 84
Joined: Wed Jan 27, 2016 6:53 pm
Location: Europe

Post by SaFeTyPe »

(sry, pls del)
Last edited by SaFeTyPe on Wed Feb 03, 2016 12:19 am, edited 1 time in total.

Offline
Posts: 84
Joined: Wed Jan 27, 2016 6:53 pm
Location: Europe

Post by SaFeTyPe »

KDJ, thank you so much! Really! I am so happy I found Akelpad and this wonderful forum! I have tested dozens of editors (ALL mentioned on Wikipedia's "List of editors"!) and Akelpad is the only one that met all my criteria. That's so great! :-D

PS. For some stupid reason I started testing the editors from Z to A, so I found Akelpad when I was totally desparate :-D

Offline
Posts: 84
Joined: Wed Jan 27, 2016 6:53 pm
Location: Europe

Post by SaFeTyPe »

Hello,

there is a small but important bug:
CTRL-X (cut) no longer works with the script running... Would it please be possible to fix this? Thank you!

Also, in a related matter, may I ask for an additional safety measure: Would it be possible to deactivate the "OVERWRITE/INSERT" key (!) function altogether (i.e. the key left of the DELETE key is "INSERT". if you press this key, the cursor goes into overwrite mode (cursor is "_" instead of "|"). --> My suggestion would be to prevent OVERWRITE mode in all situations.

Perhaps this could be part of the anti-overwrite plugin to avoid too many scripts;) ?

Thanks!

Offline
Posts: 2247
Joined: Tue Aug 07, 2007 2:03 pm
Location: Vinnitsa, Ukraine

Post by FeyFre »

SaFeTyPe wrote:CTRL-X (cut) no longer works with the script running... Would it please be possible to fix this? Thank you!
Feature per your request :)
except for the Delete key.
You can fix it yourself by deleting

Code: Select all

(nCmd == 4153 /*IDM_EDIT_CUT*/) ||
in script you have received.

Offline
Posts: 84
Joined: Wed Jan 27, 2016 6:53 pm
Location: Europe

Post by SaFeTyPe »

Thank you! Stupid me could have peeked into the script beforehand. Again: What a wonderful program!

FYI: Ctrl-X should be an exception since this is an intentional action that requires some deliberation (hitting a key combination). I.e. the likelihood of losing text by unintentionally hitting Ctrl-X whilst some text is selected, is very low.

Also the danger posed by the Insert mode key (=Overwrite mode key) is low since it will only delete one character at a time.

The highest remaining threat would be hitting Delete by mistake whilst some part of text is selected, and not noticing. This could be addressed by a dialogue "really delete selected text?", or by requiring Shift to be pressed together with Delete, if selected text should be deleted (in fact both of these can be done in combination, i.e. if shift is not pressed, a dialogue could aappear). Of course, simple deletion of 1 character should not trigger a dialogue.

Similarly, a dialogue "really enter overwrite mode", when pressing the insert/overwrite key, would be ideal.

HOWEVER: I have been working with Smedit (Sinner Computing) for 10 years with exactly the same handling as that of the script KDJ already provided. So Akelpad already does everything Smedit did, thanks to KDJ. My above ideas are just some "icing on the cake" in case someone is just as paranoid as I am and feels it would be cool to eliminate even the most unlikely of events and make Akelpad not 99.999% but 99.99999% data loss resistant :-) ;-) This means, I am already super-happy with the current situation!

Offline
Posts: 2247
Joined: Tue Aug 07, 2007 2:03 pm
Location: Vinnitsa, Ukraine

Post by FeyFre »

SaFeTyPe, well, for [s]prevention[/s] fixing really unintentional modification of text we have wonderful function of Undo/Redo. Does Smedit lack that function?

Offline
Posts: 84
Joined: Wed Jan 27, 2016 6:53 pm
Location: Europe

Post by SaFeTyPe »

Hi!

Smedit has a detailed undo function. It does not go as far back as Akelpad though. But that's not the reason I am asking for those paranoid functions.

I often have many texts opened (not in tabs, but as separate instances on the windows task bar). For example 10 text files.

In some of the text files, some text might be selected (perhaps simply forgotten to de-select). The selected area might even be in a non-visible area of the text. I use Alt-Tab a lot. When quickly alt-tabbing, it can happen that by mistake a pure tab is sent to the text editor, deleting the selected area. This was just an example. It happened to me once. There are many other situations where selected text might get deleted by mistake, especially if one juggles with 10 text editors + 10 other programs, and if one does a LOT of selecting of text.

The point is: I am talking about deletion of text that goes UNNOTICED. Otherwise, of course, undo would solve the problem.

It is also for peace of mind. When I don't have the great function that KDJ made for me, I am always super-careful and this makes me nervous. Now I can relax, knowing that even when I'm tired and unconcentrated, I will not lose any text.

So that's the story behind the request. As I said, KDJ's script has already solved most of the "problem".

PS. could someone explain to me what AkelEdit is? I could not find information, but it was mentioned in the WordWrap settings.

Offline
Posts: 84
Joined: Wed Jan 27, 2016 6:53 pm
Location: Europe

Post by SaFeTyPe »

Just info for newbies:
>>>
I found you can disable the INSERT key with the hotkey plugin, you need to set it to Command(0). I didn't expect the hotkey plugin to be able to handle INSERT. Great! :-D You can disable all dangerous hotkeys there:
for example:
esc
ctrl w
ctrl d
alt: r w d k l b u
alt: f5
f5 f6 f8 f9

Bonus tips:
- Don't forget to set ctrl-y to REDO! otherwise it will delete a line.
- Use Command(-1) instead of (0) to keep system-wide hotkeys active (I think).
<<<

<3 Akelpad <3

Offline
Posts: 84
Joined: Wed Jan 27, 2016 6:53 pm
Location: Europe

allowing indent function with TAB/shift-TAB

Post by SaFeTyPe »

Hello, I have been using this script every day since @KDJ kindly has written it.

I have started to use the built-in Akelpad-function to indent text blocks a lot - it is triggered by TAB and SHIFT-TAB. The other requirement for this feature is that at least TWO lines of text are selected:

selection is one word or one line ---> tab/shift-tab will delete
selection is more than one line ---> tab/shift-tab will indent/unindent

This does not work with the script, unfortunately.

There are two ways this could be fixed:

A) ELEGANT solution:
add a feature: IF more than one line is selected, THEN allow TAB/SHIFT TAB (because this will not delete text)

=============

B) ALTERNATIVE solution:

if solution (A) is not possible to implement, then one could give a keyboard shortcut that will toggle between

I) function of script is to "block all including tab/shift-tab"; show message about that.
II) function of script is to "block all except tab/shift-tab"; show message about that.

The user could then toggle between I and II with the shortcut if he wants to use TAB to indent in a certain situation. After being done, he could toggle it back to full protection. He will still be mostly protected from overwrite in both situations, except for the tab/shift-tab key. (At the moment I am not protected then also I often forget to toggle it back on.)

===============

I am going to donate 25 Euro to those that take their time to help, in advance if anybody is willing to help. (You can forward the donation to a good cause if you don't want anything for yourself.)

Thank you for reading.

Matthias
Post Reply