View unanswered posts | View active topics



Reply to topic  [ 8 posts ] 
Snippet Instructions to alter Sellected word case. 
Author Message
Member

Joined: Sun Aug 19, 2007 4:56 pm
Posts: 210
Location: Germany (TEMP)
Reply with quote
These are added :

$(CurWordFirstUpper) - First letter uppercase word at cursor position
$(CurWordFirstLower) - First letter lowercase word at cursor position
$(CurWordFullUpper) - Uppercase word at cursor position
$(CurWordFullLower) - Lowercase word at cursor position



Code:
Index: FlashDevelop/Resources/SnippetVars.de_DE.txt
===================================================================
--- FlashDevelop/Resources/SnippetVars.de_DE.txt   (revision 2213)
+++ FlashDevelop/Resources/SnippetVars.de_DE.txt   (working copy)
@@ -8,6 +8,10 @@
 - TEXT -------------------------------------------------------------------------
 $(SelText) - Markierter Text
 $(CurWord) - Das Wort bei der Zeigerposition
+$(CurWordFirstUpper) - First letter uppercase  word at cursor position
+$(CurWordFirstLower) - First letter lowercased  word at cursor position
+$(CurWordFullUpper) - Uppercase  word at cursor position
+$(CurWordFullLower) - Lowercase  word at cursor position
 $(CurSyntax) - Momentan aktive Syntax
 $(Clipboard) - Inhalt der Zwischenablage
 - DATEI -------------------------------------------------------------------------
Index: FlashDevelop/Resources/SnippetVars.en_US.txt
===================================================================
--- FlashDevelop/Resources/SnippetVars.en_US.txt   (revision 2213)
+++ FlashDevelop/Resources/SnippetVars.en_US.txt   (working copy)
@@ -8,6 +8,10 @@
 - TEXT -------------------------------------------------------------------------
 $(SelText) - Selected text
 $(CurWord) - Word at cursor position
+$(CurWordFirstUpper) - First letter uppercase  word at cursor position
+$(CurWordFirstLower) - First letter lowercased  word at cursor position
+$(CurWordFullUpper) - Uppercase  word at cursor position
+$(CurWordFullLower) - Lowercase  word at cursor position
 $(CurSyntax) - Currently active syntax
 $(Clipboard) - Clipboard content
 - FILE -------------------------------------------------------------------------
Index: FlashDevelop/Resources/SnippetVars.eu_ES.txt
===================================================================
--- FlashDevelop/Resources/SnippetVars.eu_ES.txt   (revision 2213)
+++ FlashDevelop/Resources/SnippetVars.eu_ES.txt   (working copy)
@@ -8,6 +8,10 @@
 - TEXT -------------------------------------------------------------------------
 $(SelText) - Hautatutako testua
 $(CurWord) - Kursorearen posizioko hitza
+$(CurWordFirstUpper) - First letter uppercase  word at cursor position
+$(CurWordFirstLower) - First letter lowercased  word at cursor position
+$(CurWordFullUpper) - Uppercase  word at cursor position
+$(CurWordFullLower) - Lowercase  word at cursor position
 $(CurSyntax) - Unean aktibatutako sintaxia
 $(Clipboard) - Arbelaren edukia
 - FILE -------------------------------------------------------------------------
Index: FlashDevelop/Resources/SnippetVars.ja_JP.txt
===================================================================
--- FlashDevelop/Resources/SnippetVars.ja_JP.txt   (revision 2213)
+++ FlashDevelop/Resources/SnippetVars.ja_JP.txt   (working copy)
@@ -8,6 +8,10 @@
 - テキスト ---------------------------------------------------------------------
 $(SelText) - 選択範囲のテキスト
 $(CurWord) - カーソル位置の単語
+$(CurWordFirstUpper) - First letter uppercase  word at cursor position
+$(CurWordFirstLower) - First letter lowercased  word at cursor position
+$(CurWordFullUpper) - Uppercase  word at cursor position
+$(CurWordFullLower) - Lowercase  word at cursor position
 $(CurSyntax) - 現在アクティブなシンタックスモード
 $(Clipboard) - クリップボード
 - ファイル ---------------------------------------------------------------------
Index: FlashDevelop/Utilities/ArgsProcessor.cs
===================================================================
--- FlashDevelop/Utilities/ArgsProcessor.cs   (revision 2213)
+++ FlashDevelop/Utilities/ArgsProcessor.cs   (working copy)
@@ -88,6 +88,32 @@
             else return String.Empty;
         }
 
+        /// <summary>
+        /// Gets the current word with altered case.
+        /// fullWord - forses whole word to change case(true), or only first letter(false)
+        /// upperCase - alters word to uppercase(true), or to lower case(false).
+        /// </summary>
+        public static String GetAlteredCaseCurWord(bool fullWord, bool upperCase)
+        {
+            if (!Globals.CurrentDocument.IsEditable) return String.Empty;
+            String curWord = Globals.SciControl.GetWordFromPosition(Globals.SciControl.CurrentPos);
+            if (PrevSelWord.Length > 0)  curWord = PrevSelWord;
+            if (!String.IsNullOrEmpty(curWord))
+            {
+                if (fullWord)
+                {
+                    if (upperCase) return curWord.ToUpper();
+                    else return curWord.ToLower();
+                }
+                else
+                {
+                    if (upperCase) return char.ToUpper(curWord[0]) + curWord.Substring(1);
+                    else return char.ToLower(curWord[0]) + curWord.Substring(1);
+                }
+            }
+            else return String.Empty;
+        }
+
       /// <summary>
       /// Gets the current file
       /// </summary>
@@ -348,6 +374,10 @@
                     case "CurFile" : return GetCurFile();
                     case "CurDir" : return GetCurDir();
                     case "CurWord" : return GetCurWord();
+                    case "CurWordFirstUpper": return GetAlteredCaseCurWord(false, true);
+                    case "CurWordFirstLower": return GetAlteredCaseCurWord(false, false);
+                    case "CurWordFullUpper": return GetAlteredCaseCurWord(true, true);
+                    case "CurWordFullLower": return GetAlteredCaseCurWord(true, false);
                     case "CurSyntax": return GetCurSyntax();
                     case "Timestamp" : return GetTimestamp();
                     case "OpenFile" : return GetOpenFile();



Wed Feb 22, 2012 1:15 am
Profile WWW
Member

Joined: Sun Aug 19, 2007 4:56 pm
Posts: 210
Location: Germany (TEMP)
Reply with quote
ok...

Shouldn't you at least reply something to contributions...?

something like... "badly written...", or "it's not how I imagine I would have done it...",or... "create a plugin for that... and be happy...", or "have no time for this now, we will look into this next year...", or "we don't care about AS3 that much at the moment... we do haxe/mobile dev now... get lost!",

something?

I would strongly conciser contributing... (I am not that good with C# but still..), but current lack of communication kills the motivation.

Have a nice day.


Thu May 24, 2012 10:23 am
Profile WWW
Admin

Joined: Tue Aug 30, 2005 6:14 pm
Posts: 3046
Location: Finland
Reply with quote
Sorry, we are highly busy folks and we sometimes don't spot these posts. I'll check these soon.


Thu May 24, 2012 10:25 am
Profile WWW
Member

Joined: Sun Aug 19, 2007 4:56 pm
Posts: 210
Location: Germany (TEMP)
Reply with quote
Maybe I can help somehow...?

write it better... more clearly... maybe something is missing?

Is there any other reason except 'time' why this is not in release...?
If 30 new lines... takes 4 months to get reviewed.. what kind of bigger change can be handled...?

or... maybe you don't think this change is needed?

If something as simple as this can't get in during 3 release cycles... it complacently removes the motivation to contribute.

It's sad...


Wed Jun 20, 2012 10:07 am
Profile WWW
Admin

Joined: Tue Aug 30, 2005 6:14 pm
Posts: 3046
Location: Finland
Reply with quote
We did only minor fixes to FD4. This or similar (we might have an overlap here with one another addition) will get into 4.1, not added yet.

Remember, we do this only part time and we have been fairly busy the start of the year. Also sometimes we just accidently overlook these requests.


Wed Jun 20, 2012 10:12 am
Profile WWW
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
The problem that I see with this patch is that it only solves casing for $(CurWord) - a correct solution would be to make it available to any property so I think it should be an extension to the argument system like $(SomeArgument:FirstUpper)


Thu Jun 21, 2012 9:56 am
Profile WWW
Member

Joined: Sun Aug 19, 2007 4:56 pm
Posts: 210
Location: Germany (TEMP)
Reply with quote
Great idea!
I will try to do this then I get some free time.

Until then... why not put this patch as simple quick solution?


Sun Jun 24, 2012 7:56 pm
Profile WWW
Admin

Joined: Tue Aug 30, 2005 6:14 pm
Posts: 3046
Location: Finland
Reply with quote
I don't want to add a temporary patch so when and if you get this suggested thing done i will add it to trunk.


Mon Aug 27, 2012 6:01 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.