📜 ⬆️ ⬇️

Vertical code alignment + a little punto

Greetings. Let's talk about vertical alignment of the code?

So, inspired by a recent article, I understood how to. Fully automatic leveling + syntax parsing is certainly a convenient thing, but no. And I had an idea. We simply give the programmer the most in each case to determine which characters and where to align the code.

It works in any editor and with any text. Something like this:
')


Immediately pick up the application here: sourceforge.net/projects/tnice/files
(select text, press Ctrl + Shift + D, write alignment characters, press Ctrl + Enter)
A detailed manual and the principle of operation under the cut.

Why a little punto?

I have long been brewing the thought of abandoning crafts called Punto Switcher. He uses global hooks (and this is a big responsibility), I do not trust him, because He climbs up to check for updates, although daws are not worth it. Repeatedly run up against the mistakes that Punto led to. Therefore, the most important function: the layout conversion - I brought to this software. Also, the caps conversion function + text translation into translite (just in case: D) got into it. And of course, the killer feature is vertical alignment of the code.

But what about no hooks?

In general, the software works like this. When a hotkey happens, the software does the following:
1. Back up the current text in the clipboard
2. Clears the clipboard
3. Emulates pressing Ctrl + C
4. Waits for text to appear in the clipboard (constantly checking it via GetClipboardSequenceNumber every 10 ms, and so on for one second)
5. As soon as the text appeared - either immediately converts or launches the editor.
6. In case of successful editing - puts a new text on the clipboard.
7. Emulates the user pressing Ctrl + V
8. Wait half a second and restore the old clipboard. If at any of the stages after the second - something goes wrong, it still restores the text in the clipboard.

How to use.

After launch, there will be a tray icon. Clicking on the icon will expand the settings window:



It left hotkeys on all functions. In the screenshot, the first hot key is 'Shift +'. In fact, there should be a Pause | Break, but for some reason, the default Windows control does not render it. Green check marks indicate hotkey has been successfully installed. Right options for vertical alignment window. In general, an intuitive interface ^ _ ^.

The main use case - select a piece of text, click the hot key. The conversion will take place immediately, but the editor will be launched to align the code:



In it in the right part on each line we write substrings by which we will align. When everyone has written - press Ctrl + Enter and editing will be completed (or Esc to cancel editing).

What's next.

It is necessary to modify the manuals and the description on sourceforge. Add autoload checkbox. I would like to add a sound when converting text (like a punto).

The project is open, the license will be GNU.

Now you know how I spent yesterday's Sunday.

Sourceforge TNice .

upd. 07/15/2014
Fixed errors when converting the language.
Fixed a bug when converting translit found by a friend of cmepthuk
Waiting for the buffer now via GetClipboardSequenceNumber.
Restoring the focus of the original window when you cancel editing.

upd. 07/21/2014
Fixed layout conversion bug

Source: https://habr.com/ru/post/229833/


All Articles