News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

how can i insert a hard tab?

Started by Allefant, April 01, 2006, 02:40:05 PM

Previous topic - Next topic

Allefant

I often want to insert a TAB character (ascii 09) into text, for example when I need to modify a makefile, or when I need to modify a source which has such ascii codes in it. Is there a way to do it?

(Without going to settings and enabling tabs there.. since I only need one single tab, but normal indentation for my normal source code..)

thomas

Since you do not want to edit settings, the only way to get this done is to type a tab char in notepad, copy that char, and paste it into the source...

If you need a tab character in a character string, it is of course easier to use \t :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

takeshimiya

Or another more funny solution would be using AngelScript.

You would only need to create a script that does something like:
Code (cpp) Select

// toggle tab usage
bool use = editor->GetUseTabs();
editor->SetUseTabs(!use);


And then register a menu with it along with an accelerator.

The only (minor?) problems with it are:
-*UseTabs() function are not registered, you'll need to register it in scriptbindings.cpp, and recompile C::B.
-Can a script create a new menu entry with an accelerator?
-The script would be loaded once, or it would be loaded each time the function is needed?

Allefant

A menu entry would be perfect. Anyway, since I don't feel like recompiling myself, I just filed a feature request :)

takeshimiya

But it'd be of actually use with AngelScript, or the ActionsManager stuff, or perhaps some future Macros recording feature.
As of now, putting a hardcoded menu for SetUseTabs() would polute menus only.

Allefant

Yes, I guess having a script for it (which I could add/enable/install/[anything but requiring me to completely recompile a huge C++ project]) would be best.