[Gambas-user] Cutn Paste Feature Request in IDE

richard terry rterry at ...1946...
Sat Feb 14 22:41:00 CET 2009


Hi There,

Probably like most of us I do a staggering amount of cutn paste, and not 
infrequently use the Paste Special, and within that the paste as string and 
paste as comment.

Two things.

Firstnly, now that the user configurable buttons can be dropped on the toolbar 
(thanks for explaining that Benoit - I'd missed that one could do that), I 
wondered if you could include a button for paste as string and paste as 
comment to avoid having to use the popup dialog.

Secondly:

I'm using quite a few html templates. sometimes its quicker for me to prepare 
these in Nvu or Open office, and then just drop them as a single string into 
my gambase file, (though at other times I just have functions that return the 
html in a format needed a row etc)


E.g For readability and maintainablity purposes, I want to end up with 
something like this:

MyTemplate = ""
" <html>"
" <head>"
"   <meta content='text/html; charset=ISO-8859-1'"
"  http-equiv='content-type'>"
"   <title></title>"
" </head>"
" <body>"
" <table style='text-align: left; width: 100%;' border='1'"
"  cellpadding='2' cellspacing='2'>"
"   <tbody>"
"     <tr>"
"       <td style='width: 298px;'>col1</td>"
"       <td style='width: 295px;'>col2</td>"
"       <td style='width: 358px;'>col3</td>"
"     </tr>"
"   </tbody>"
" </table>"
" <br>"
" </body>"
" </html>"

 But using any of the three options, I end up with these, none of which work 
well, so I usually just paste as comments into a sub, do a couple of string 
replaces and then re-paste where I want it to be.

1) Straight Paste: mucked up html
======================

< Html >
< head >
  < meta content = "text/html; charset=ISO-8859-1"
 http - equiv = "content-type" >
  < title > < / title >
< / head >
< body >
< table style = "text-align: left; width: 100%;" border = "1"
 cellpadding = "2" cellspacing = "2" >
  < tbody >
    < Tr >
      < td style = "width: 298px;" > col1 < / td >
      < td style = "width: 295px;" > col2 < / td >
      < td style = "width: 358px;" > col3 < / td >
    < / Tr >
  < / tbody >
< / table >
< br >
< / body >
< / Html >

2) Paste as string: - works -but all on the same line and visually hard to 
follow
===============================
"<html>\n<head>\n  <meta content=\"text/html; charset=ISO-8859-1\"\n 
http-equiv=\"content-type\">\n  <title></title>\n</head>\n<body>\n<table 
style=\"text-align: left; width: 100%;\" border=\"1\"\n cellpadding=\"2\" 
cellspacing=\"2\">\n  <tbody>\n    <tr>\n      <td style=\"width: 298px;
\">col1</td>\n      <td style=\"width: 295px;\">col2</td>\n      <td 
style=\"width: 358px;\">col3</td>\n    </tr>\n  
</tbody>\n</table>\n<br>\n</body>\n</html>\n"

3) Paste as comment - formatted visually, but not quoted and needs 
manipulating
==================================
' <html>
' <head>
'   <meta content="text/html; charset=ISO-8859-1"
'  http-equiv="content-type">
'   <title></title>
' </head>
' <body>
' <table style="text-align: left; width: 100%;" border="1"
'  cellpadding="2" cellspacing="2">
'   <tbody>
'     <tr>
'       <td style="width: 298px;">col1</td>
'       <td style="width: 295px;">col2</td>
'       <td style="width: 358px;">col3</td>
'     </tr>
'   </tbody>
' </table>
' <br>
' </body>
' </html>


So my question is would it be possible to have an option in the paste special 
to retain the line formatting, replace the double quotes around things 
like 'text/html' with single quotes and then past  it as a quoted string.

regards

Richard





More information about the User mailing list