Hello,
For the scripting, "selText" method speed problem, here a function to simulate
the issue:
Sub TrimTrailingSpaces
If (editorsCount = 0) Then
Exit Sub
End If
Set editor = newEditor()
editor.assignActiveEditor
myCaretX = editor.caretX()
myCaretY = editor.caretY()
x1 = editor.blockBeginX()
y1 = editor.blockBeginY()
x2 = editor.blockEndX()
y2 = editor.blockEndY()
x1 = 1 'steeds vanaf pos.1
bBlockBegin = editor.setBlockBegin (x1, y1)
bBlockEnd = editor.setBlockEnd (x2, y2)
If (x2 > 1) Then
text = editor.Text()
EOL = ""
If InStr(text, Chr(13)) Then
EOL = EOL & Chr(13)
End If
If InStr(text, Chr(10)) Then
EOL = EOL & Chr(10)
End If
lines = Split(text, EOL)
x2 = Len(lines(y2 - 1)) + 1
bBlockEnd = editor.setBlockEnd (x2, y2)
End If
text = editor.selText()
EOL = ""
If InStr(text, Chr(13)) Then
EOL = EOL & Chr(13)
End If
If InStr(text, Chr(10)) Then
EOL = EOL & Chr(10)
End If
lines = Split(text, EOL)
i = -1
For Each line in lines
i = i + 1
lines(i) = RTrim(line)
Next
text = Join(lines, EOL)
editor.selText (text) 'this causes the delay
editor.caretX myCaretX
editor.caretY myCaretY
End Sub
This script simply takes each line and strips the trailing spaces.
To simulate, select some 2000 lines in a text file and apply the script. It will
take some half a minute...
--
<https://forum.pspad.com/read.php?6,76202,76214>
PSPad freeware editor https://www.pspad.com