Author Topic: how can i insert a hard tab?  (Read 5047 times)

Allefant

  • Guest
how can i insert a hard tab?
« on: April 01, 2006, 02:40:05 pm »
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..)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: how can i insert a hard tab?
« Reply #1 on: April 01, 2006, 02:48:59 pm »
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

  • Guest
Re: how can i insert a hard tab?
« Reply #2 on: April 01, 2006, 03:07:10 pm »
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);

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

  • Guest
Re: how can i insert a hard tab?
« Reply #3 on: April 01, 2006, 08:19:23 pm »
A menu entry would be perfect. Anyway, since I don't feel like recompiling myself, I just filed a feature request :)

takeshimiya

  • Guest
Re: how can i insert a hard tab?
« Reply #4 on: April 01, 2006, 08:28:42 pm »
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

  • Guest
Re: how can i insert a hard tab?
« Reply #5 on: April 01, 2006, 10:25:36 pm »
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.