# Copyright (C) 2000 - Martin Strauss - under terms of GPL
##############################################################
# umlaut routine
# 
proc umlaut LIST {
 global FocusEditorFlag
 global FocusEditor
 if $FocusEditorFlag then {
  focus $FocusEditor.te.edit1
  foreach {FIND REPLACE} $LIST {
    set FIND_L [string length "$FIND"]
    if {$FIND != ""} then { 
     set modifiedflag 0
     undo_switch $FocusEditor.te.edit1 Save
     set startindex [$FocusEditor.te.edit1 index insert]
     set nowindex 1.0
     while {$nowindex != ""} {
      $FocusEditor.te.edit1 mark set insert $nowindex
      set NOW [$FocusEditor.te.edit1 get insert "insert + $FIND_L chars"]
      if ![string compare $NOW $FIND] then {
       # Ersetzt
       $FocusEditor.te.edit1 delete insert "insert + $FIND_L chars"
       $FocusEditor.te.edit1 insert insert $REPLACE
       set modifiedflag 1
      }
      # Sucht
      set nowindex [$FocusEditor.te.edit1 search -- $FIND insert end]
     }
     $FocusEditor.te.edit1 mark set insert $startindex
     if $modifiedflag {
      event generate $FocusEditor.te.edit1 <<Modified>>
     }
     event generate $FocusEditor.te.edit1 <<Position_tail>> -when tail
    }
   }
 }
}
