work save
This commit is contained in:
parent
3e4f6b6548
commit
f59d67e5f0
|
@ -783,6 +783,30 @@ QChar SynEdit::charAtNormalizedBufferPos(const NormalizedBufferCoord &p) const
|
|||
return s[p.Char-1];
|
||||
}
|
||||
|
||||
QStringList SynEdit::getContents(const NormalizedBufferCoord &pStart, const NormalizedBufferCoord &pEnd)
|
||||
{
|
||||
QStringList result;
|
||||
if (mLines->count()==0)
|
||||
return result;
|
||||
if (pStart.Line>0) {
|
||||
QString s = mLines->getString(pStart.Line-1);
|
||||
result += s.mid(pStart.Char-1);
|
||||
}
|
||||
int endLine = std::min(pEnd.Line,mLines->count());
|
||||
for (int i=pStart.Line;i<endLine-1;i++) {
|
||||
result += mLines->getString(i);
|
||||
}
|
||||
if (pEnd.Line<=mLines->count()) {
|
||||
result += mLines->getString(pEnd.Line-1).mid(0,pEnd.Char-1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QString SynEdit::getJoinedContents(const NormalizedBufferCoord &pStart, const NormalizedBufferCoord &pEnd, const QString &joinStr)
|
||||
{
|
||||
return getContents(pStart,pEnd).join(joinStr);
|
||||
}
|
||||
|
||||
int SynEdit::leftSpaces(const QString &line) const
|
||||
{
|
||||
int result = 0;
|
||||
|
|
|
@ -166,12 +166,14 @@ public:
|
|||
DisplayCoord bufferToDisplayPos(const BufferCoord& p) const;
|
||||
BufferCoord displayToBufferPos(const DisplayCoord& p) const;
|
||||
|
||||
|
||||
//normalized buffer coord operations
|
||||
NormalizedBufferCoord moveBufferPos(const BufferCoord&p, int delta) const;
|
||||
NormalizedBufferCoord moveBufferPos(const NormalizedBufferCoord &p, int delta) const;
|
||||
NormalizedBufferCoord normalizeBufferPos(const BufferCoord& p) const;
|
||||
NormalizedBufferCoord normalizeBufferPos(int aChar, int aLine) const;
|
||||
QChar charAtNormalizedBufferPos(const NormalizedBufferCoord& p) const;
|
||||
QStringList getContents(const NormalizedBufferCoord& pStart,const NormalizedBufferCoord& pEnd);
|
||||
QString getJoinedContents(const NormalizedBufferCoord& pStart,const NormalizedBufferCoord& pEnd, const QString& joinStr);
|
||||
|
||||
int leftSpaces(const QString& line) const;
|
||||
QString GetLeftSpacing(int charCount,bool wantTabs) const;
|
||||
|
|
Loading…
Reference in New Issue