Untersuchungsergebnis.bsh Download desAbap {Abap[94] [0] [0]}zum Wurzelverzeichnis wechseln
/*
* Greedy_Backspace.bsh - If buffer is using soft tabs,
* this macro will backspace to the previous tab stop,
* if all characters between the caret and the tab stop
* are spaces. In all other cases a single character is
* removed.
*
* Copyright (C) 2002-2004 Ollie Rutherfurd <[email protected]>
*
* $Id: Greedy_Backspace.bsh 23971 2015-08-08 19:37:35Z daleanson $
*/
/**
* @param onlyFullTabs if true, multiple spaces are only
* removed if they would constitute
* a 'complete' tab.
*/
void greedyBackspace(View view, boolean onlyFullTabs)
{
JEditTextArea textArea = view.getTextArea();
JEditBuffer buffer = textArea.getBuffer();
int caret = textArea.getCaretPosition();
int caretLine = textArea.getCaretLine();
int lineStart = textArea.getLineStartOffset(caretLine);
if(buffer.getBooleanProperty("noTabs") == true)
{
// if anything is selected, use standard
if(textArea.getSelection().length != 0)
{
textArea.backspace();
}
// if at the start of the line, use standard
else if(caret == lineStart)
{
textArea.backspace();
}
else
{
int col = caret - lineStart;
int tabSize = buffer.getIntegerProperty("tabSize",8);
// unlikely, but just in case
if(tabSize <= 0)
{
buffer.remove(caret-1,1);
}
else
{
int toTabStop = ((col-1) % tabSize) + 1;
int count = 0;
String chunk = buffer.getText(caret-toTabStop,toTabStop);
for(int i=0; i < toTabStop; i++)
{
if(' ' != chunk.charAt(i))
break;
count += 1;
}
// if onlyFullTabs must be only spaces to
// the tabStop and must have tabSize number
// of spaces to remove them all.
if(onlyFullTabs == false || count == tabSize){
buffer.remove(caret-count,count);
}
else{
buffer.remove(caret-1,1);
}
}
}
}
else
textArea.backspace();
}
greedyBackspace(view,true);
[ zur Elbe Produktseite wechseln0.115Quellennavigators
]