User forums > Using Code::Blocks
how can i insert a hard tab?
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 :)
takeshimiya:
Or another more funny solution would be using AngelScript.
You would only need to create a script that does something like:
--- Code: (cpp) ---// toggle tab usage
bool use = editor->GetUseTabs();
editor->SetUseTabs(!use);
--- End code ---
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.
Navigation
[0] Message Index
[#] Next page
Go to full version