Typing symbols "", '', (), {} in pairs

Let us know what you would like to see in the next version of this software

Moderator: kfury77

Forum rules
Please follow these guidelines when posting feature requests. This will help to increase the value of your contribution.
  • Do not create new topics for already requested features. Add your comments to the existing feature request topics instead;
  • Create separate topic for each feature suggestion. Do NOT post a number of non-related feature suggestions in a single topic;
  • Give your topic a meaningful title. Do NOT create topics with meaningless titles, such as "My Suggestion" or "My Problem".
Please note that we DO READ all suggestions, even if a reply is not posted. Thanks!
Post Reply
Laisvunas
Posts: 15
Joined: Sat Jan 19, 2008 4:12 pm

Typing symbols "", '', (), {} in pairs

Post by Laisvunas »

Hi,

It seems to me that symbols such as ", ', (, ), {, } in most cases could be typed in pairs, that is, if the left one is typed the right one immediately appears on the screen. This feature would be a nice improvement of usability.

The most elegant implementation of this feature I have seen is in PSPad Editor.
multifarious
Posts: 32
Joined: Tue Feb 05, 2008 4:40 pm
Location: Amsterdam
Contact:

Post by multifarious »

that could indeed be helpful.. IF it's an option you can turn off (for those of us who type faster then we think ;))

a workaround I've been using for quite some time (and this might be useful for you too) is adding those to your library and place them under their corresponding keys with a modyfier.. ie;

[] = Ctrl + [
{} = Ctrl+shift+[
'' = Ctrl + '
"" = Ctrl + shift + '

I have to say this works pretty well... (and no erronous extra entries when your editing ;))
Gatis
Blumentals Software Developer
Posts: 545
Joined: Sun Mar 05, 2006 12:30 am
Location: Latvia

Post by Gatis »

We will have this functionality for "{}" first (next major version).
If we see there is demand, we will certainly add some more items later in some update.
fuzzylogic
Posts: 43
Joined: Thu Jan 10, 2008 11:55 am

thanks

Post by fuzzylogic »

Hey, thanks for the suggestion multifarious it works great!
Laisvunas
Posts: 15
Joined: Sat Jan 19, 2008 4:12 pm

Post by Laisvunas »

Hi, Gatis,

Certainly, there is demand for this feature and ability to type symbols ", ', (, ) in pairs is as much important as ability to type { and } in pairs.

Consider, for example such situation:

At first I do some HTML coding such as this

Code: Select all

<div> id="some_id">
some code
</div>
Coding this I need symbols "" to be inserted as pair and the cursor to be placed between them.

After coding this I start programming some javascript such as this

Code: Select all

var my_div=document.getElementById('some_id');
Coding this I need symbols () and '' (I prefer single quotes in javascript) to be inserted as pair and the cursor to be placed between them.

Then I proceed as this

Code: Select all

var aElements=my_div.getElementsByTagName('a');
for (var i=0; i<aElements.length; i++) {
   if (aElements[i].className=='some_claassname') {
       some code
   }
}
Coding this I need symbols {} and [] to be inserted as pair and the cursor to be placed between them.

I have written here only a couple of lines of code, but to write them I needed to be able to insert all of the mentioned symbols - '', "", {}, [] - as pairs.
fuzzylogic
Posts: 43
Joined: Thu Jan 10, 2008 11:55 am

a different coding style

Post by fuzzylogic »

Code: Select all

var aElements=my_div.getElementsByTagName('a');
for (var i=0; i<aElements.length; i++) {
   if (aElements[i].className=='some_claassname') {
       some code
   } else {
      other code 
   }
}

I used to write my code like that (above) and a lot of people still do. But after writing *a lot* of code and experimenting a bit, and looking at how some other "php gurus" format their code. I eventually switched to a different style which I find to be much more readable and helps to avoid mistakes of mismatched brackets. Here is how I do it now.

Code: Select all

var aElements=my_div.getElementsByTagName('a');

for (var i=0; i<aElements.length; i++) 
{
  if (aElements[i].className=='some_claassname') 
  {
    some code
  }
  else
  {  
    more code here....   notice that it is a lot more readable.   
    who cares if it makes the program a little bit longer, 
    I never print them anyway.  the days of paper are fading.
  }
}
I only use two spaces for tabs because some of my code gets pretty deeply indented. It's a compromise between delineation of indents and having lines so long you have to scroll to read them.
Laisvunas
Posts: 15
Joined: Sat Jan 19, 2008 4:12 pm

Post by Laisvunas »

I agree that the coding style in fuzzylogic example is better than in my example. The issue in this thread seems to be neutral in respect to different coding styles. Whatever the coding style it is quite handy to be able to type symbols such as ", ', (, ), {, }, [, ] in pairs.

To the list of these symbols I would like to add yet another pair of symbols: < , >. It would be handy if coding html these symbols would be typed in pairs and cursor placed between them.
multifarious
Posts: 32
Joined: Tue Feb 05, 2008 4:40 pm
Location: Amsterdam
Contact:

Post by multifarious »

maybe something like a configurable option where you can add and remove pairs at will?
like: start - end - trigger
sortof like an autoreplace-library-snippet hybrid..
since I'd imagine depending on your coding environment you could need different sets of those.. (didn't HomeSite offer such an option..?)

And really, please please pwetty please, if you DO decide to implement this behaviour: allow me to turn it off!! *begs*

;)
Patrick Kanne - webmaniac
- as we fail to imagine, we are punished with reality
racmaster
Posts: 5
Joined: Sat Mar 29, 2008 4:25 am
Contact:

Auto-skip second bracket and auto-surround selection

Post by racmaster »

It would be cool if you typed the left bracket or quote and the other one just popped in there, and the next time you typed that closing [whatever] the cursor just jumped over it (for those of you who type faster than you think...).

I would also really dig selecting some text and then maybe hitting the closing [whatever] and it automatically surrounds the selection in [whatever's], like the <b>bold</b> shortcut...
Matthew N.
Power Tie Marketing
MasterDee
Posts: 6
Joined: Sat Apr 12, 2008 9:09 pm

Post by MasterDee »

yes, we need this for sure in php and HTMLPad. its I MUST function.

In PHP we need this too: [] and in htmlPad this: <>
llbbl
Posts: 50
Joined: Thu Mar 27, 2008 9:19 pm

Post by llbbl »

I would also like to see this feature.
User avatar
EvilBMP
Posts: 120
Joined: Thu Jan 04, 2007 1:57 am
Location: Germany

Re:

Post by EvilBMP »

Gatis wrote:If we see there is demand, we will certainly add some more items later in some update.
There is a demand, especially for PHP programming - already mentioned over one year ago ;)

http://forums.blumentals.net/viewtopic.php?f=1&t=2127
.
Post Reply