[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/interfaces/ktexteditor
From:       Christoph Cullmann <cullmann () kde ! org>
Date:       2010-04-15 16:10:09
Message-ID: 20100415161009.3BCB2AC898 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1115204 by cullmann:

jowenn:
If a selection exists it is replaced if a template string is being
inserted. If there is a "selection" placeholder, kate sets the initial
value for this placeholder to the text of the removed selection


 M  +4 -1      templateinterface.cpp  
 M  +2 -1      templateinterface.h  


--- trunk/KDE/kdelibs/interfaces/ktexteditor/templateinterface.cpp #1115203:1115204
@@ -106,6 +106,9 @@
       {
         map[ placeholder ] = '|';
       }
+      else if (placeholder== "selection" ) {
+        //DO NOTHING, THE IMPLEMENTATION WILL HANDLE THIS
+      }
       else map[ placeholder ] = placeholder;
     }
   }
@@ -115,7 +118,7 @@
 bool TemplateInterface::insertTemplateText ( const Cursor& insertPosition, const \
QString &templateString, const QMap<QString, QString> &initialValues)  {
   QMap<QString, QString> enhancedInitValues( initialValues );
-
+  
   QRegExp rx( "[$%]\\{([^}\\r\\n]+)\\}" );
   rx.setMinimal( true );
   int pos = 0;
--- trunk/KDE/kdelibs/interfaces/ktexteditor/templateinterface.h #1115203:1115204
@@ -65,7 +65,7 @@
      * "for( int ${index}=0;${index}<10;${index}++) { ${cursor} };"
      * or "%{date}"
      *
-     * This syntax is somewhat similar to the one found in the Eclipse editor.
+     * This syntax is somewhat similar to the one found in the Eclipse editor or \
                textmate.
      *
      * There are certain common placeholders (macros), which get assigned a
      * default initialValue, If the second parameter does not a given value.
@@ -112,6 +112,7 @@
      * - month: current month
      * - day: current day
      * - hostname: hostname of the computer
+     * - selection: The implementation should set this to the selected text, if any
      * - cursor: at this position the cursor will be after editing of the
      *   template has finished, this has to be taken care of by the actual
      *   implementation. The placeholder gets a value of "|" assigned.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic