summaryrefslogtreecommitdiffstats
path: root/konsole
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-12-11 20:21:27 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-12-11 20:21:27 +0000
commit10e41144596fc9ced40fc349d9ecd099b1c2ea19 (patch)
tree88ab04e475ff5a4cd889cb082f5760b6e0bf5e4e /konsole
parent4aed2c8219774f5d797760606b8489a92ddc5163 (diff)
downloadtdebase-10e41144596fc9ced40fc349d9ecd099b1c2ea19.tar.gz
tdebase-10e41144596fc9ced40fc349d9ecd099b1c2ea19.zip
Initial import of Trinity 3.5.11 to kdebase
Extends krandrtray, adds iccconfig kcontrol module, adds run dialog autocomplete and lots of bugfixes Will need to check for commit warnings and repair as encountered Also needs full compile test git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1061475 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konsole')
-rw-r--r--konsole/konsole/TEHistory.cpp90
-rw-r--r--konsole/konsole/TEHistory.h5
-rw-r--r--konsole/konsole/TEPty.h7
-rw-r--r--konsole/konsole/keytrans.cpp6
-rw-r--r--konsole/konsole/konsole.cpp4
-rw-r--r--konsole/konsole/konsole_part.cpp10
-rw-r--r--konsole/konsole/konsole_part.h2
-rw-r--r--konsole/konsole/konsole_wcwidth.cpp31
-rw-r--r--konsole/konsole/konsole_wcwidth.h4
-rw-r--r--konsole/other/su.desktop2
-rw-r--r--konsole/other/sumc.desktop2
11 files changed, 107 insertions, 56 deletions
diff --git a/konsole/konsole/TEHistory.cpp b/konsole/konsole/TEHistory.cpp
index 5a0ee5477..a24635acb 100644
--- a/konsole/konsole/TEHistory.cpp
+++ b/konsole/konsole/TEHistory.cpp
@@ -207,23 +207,24 @@ void HistoryScrollFile::addLine(bool previousWrapped)
// History Scroll Buffer //////////////////////////////////////
HistoryScrollBuffer::HistoryScrollBuffer(unsigned int maxNbLines)
: HistoryScroll(new HistoryTypeBuffer(maxNbLines)),
- m_histBuffer(maxNbLines),
- m_wrappedLine(maxNbLines),
m_maxNbLines(maxNbLines),
m_nbLines(0),
- m_arrayIndex(maxNbLines - 1)
+ m_arrayIndex(0),
+ m_buffFilled(false)
{
+ m_histBuffer.setAutoDelete(true);
+ m_histBuffer.resize(maxNbLines);
+ m_wrappedLine.resize(maxNbLines);
}
HistoryScrollBuffer::~HistoryScrollBuffer()
{
- for(size_t line = 0; line < m_nbLines; ++line) {
- delete m_histBuffer[adjustLineNb(line)];
- }
}
void HistoryScrollBuffer::addCells(ca a[], int count)
{
+ //unsigned int nbLines = countLines(bytes, len);
+
histline* newLine = new histline;
newLine->duplicate(a, count);
@@ -231,15 +232,45 @@ void HistoryScrollBuffer::addCells(ca a[], int count)
++m_arrayIndex;
if (m_arrayIndex >= m_maxNbLines) {
m_arrayIndex = 0;
- }
+ m_buffFilled = true;
+ }
- if (m_nbLines < m_maxNbLines) ++m_nbLines;
+ // FIXME: See BR96605
+ if (m_nbLines < m_maxNbLines - 1) ++m_nbLines;
- delete m_histBuffer[m_arrayIndex];
+ // m_histBuffer.remove(m_arrayIndex); // not necessary
m_histBuffer.insert(m_arrayIndex, newLine);
m_wrappedLine.clearBit(m_arrayIndex);
}
+void HistoryScrollBuffer::normalize()
+{
+ if (!m_buffFilled || !m_arrayIndex) return;
+ QPtrVector<histline> newHistBuffer;
+ newHistBuffer.resize(m_maxNbLines);
+ QBitArray newWrappedLine;
+ newWrappedLine.resize(m_maxNbLines);
+ for(int i = 0; i < (int) m_maxNbLines-2; i++)
+ {
+ int lineno = adjustLineNb(i);
+ newHistBuffer.insert(i+1, m_histBuffer[lineno]);
+ newWrappedLine.setBit(i+1, m_wrappedLine[lineno]);
+ }
+ m_histBuffer.setAutoDelete(false);
+ // Qt 2.3: QVector copy assignment is buggy :-(
+ // m_histBuffer = newHistBuffer;
+ for(int i = 0; i < (int) m_maxNbLines; i++)
+ {
+ m_histBuffer.insert(i, newHistBuffer[i]);
+ m_wrappedLine.setBit(i, newWrappedLine[i]);
+ }
+ m_histBuffer.setAutoDelete(true);
+
+ m_arrayIndex = m_maxNbLines;
+ m_buffFilled = false;
+ m_nbLines = m_maxNbLines-2;
+}
+
void HistoryScrollBuffer::addLine(bool previousWrapped)
{
m_wrappedLine.setBit(m_arrayIndex,previousWrapped);
@@ -284,40 +315,19 @@ void HistoryScrollBuffer::getCells(int lineno, int colno, int count, ca res[])
return;
}
- assert(colno <= (int) l->size() - count);
+ assert((colno < (int) l->size()) || (count == 0));
memcpy(res, l->data() + colno, count * sizeof(ca));
}
void HistoryScrollBuffer::setMaxNbLines(unsigned int nbLines)
{
- QPtrVector<histline> newHistBuffer(nbLines);
- QBitArray newWrappedLine(nbLines);
-
- size_t preservedLines = (nbLines > m_nbLines ? m_nbLines : nbLines); //min
-
- // delete any lines that will be lost
- size_t lineOld;
- for(lineOld = 0; lineOld < m_nbLines - preservedLines; ++lineOld) {
- delete m_histBuffer[adjustLineNb(lineOld)];
- }
-
- // copy the lines to new arrays
- size_t indexNew = 0;
- while(indexNew < preservedLines) {
- newHistBuffer.insert(indexNew, m_histBuffer[adjustLineNb(lineOld)]);
- newWrappedLine.setBit(indexNew, m_wrappedLine[adjustLineNb(lineOld)]);
- ++lineOld;
- ++indexNew;
- }
- m_arrayIndex = preservedLines - 1;
-
- m_histBuffer = newHistBuffer;
- m_wrappedLine = newWrappedLine;
-
+ normalize();
m_maxNbLines = nbLines;
- if (m_nbLines > m_maxNbLines)
- m_nbLines = m_maxNbLines;
+ m_histBuffer.resize(m_maxNbLines);
+ m_wrappedLine.resize(m_maxNbLines);
+ if (m_nbLines > m_maxNbLines - 2)
+ m_nbLines = m_maxNbLines -2;
delete m_histType;
m_histType = new HistoryTypeBuffer(nbLines);
@@ -325,10 +335,10 @@ void HistoryScrollBuffer::setMaxNbLines(unsigned int nbLines)
int HistoryScrollBuffer::adjustLineNb(int lineno)
{
- // lineno = 0: oldest line
- // lineno = getLines() - 1: newest line
-
- return (m_arrayIndex + lineno - (m_nbLines - 1) + m_maxNbLines) % m_maxNbLines;
+ if (m_buffFilled)
+ return (lineno + m_arrayIndex + 2) % m_maxNbLines;
+ else
+ return lineno ? lineno + 1 : 0;
}
diff --git a/konsole/konsole/TEHistory.h b/konsole/konsole/TEHistory.h
index c8fa2f379..446611e0a 100644
--- a/konsole/konsole/TEHistory.h
+++ b/konsole/konsole/TEHistory.h
@@ -142,11 +142,16 @@ public:
private:
int adjustLineNb(int lineno);
+ // Normalize buffer so that the size can be changed.
+ void normalize();
+
+ bool m_hasScroll;
QPtrVector<histline> m_histBuffer;
QBitArray m_wrappedLine;
unsigned int m_maxNbLines;
unsigned int m_nbLines;
unsigned int m_arrayIndex;
+ bool m_buffFilled;
};
diff --git a/konsole/konsole/TEPty.h b/konsole/konsole/TEPty.h
index 294fde8c7..1597d44d8 100644
--- a/konsole/konsole/TEPty.h
+++ b/konsole/konsole/TEPty.h
@@ -39,6 +39,13 @@ Q_OBJECT
~TEPty();
public:
+ bool setPtyFd(int p) {
+ bool res = pty()->setPty(p);
+ setupCommunication((Communication)(Stdin|Stdout));
+ commSetupDoneP();
+ runs = true;
+ return res;
+ };
/*!
* having a `run' separate from the constructor allows to make
diff --git a/konsole/konsole/keytrans.cpp b/konsole/konsole/keytrans.cpp
index 7632520ba..f0c8311a7 100644
--- a/konsole/konsole/keytrans.cpp
+++ b/konsole/konsole/keytrans.cpp
@@ -140,10 +140,10 @@ bool KeyTrans::findEntry(int key, int bits, int* cmd, const char** txt, int* len
if ((*cmd==CMD_send) && it.current()->anymodspecified() && (*len < 16))
{
static char buf[16];
- char *c, mask = '1' + BITS(0, bits&(1<<BITS_Shift)) +
- BITS(1, bits&(1<<BITS_Alt)) + BITS(2, bits&(1<<BITS_Control));
+ char *c;
+ char mask = '1' + BITS(0, bits&(1<<BITS_Shift)) + BITS(1, bits&(1<<BITS_Alt)) + BITS(2, bits&(1<<BITS_Control));
strcpy(buf, it.current()->txt.ascii());
- c = strchr(buf, '*');
+ c = (char*)strchr(buf, '*');
if (c) *c = mask;
*txt = buf;
}
diff --git a/konsole/konsole/konsole.cpp b/konsole/konsole/konsole.cpp
index 2f9abdf52..2b85b6f39 100644
--- a/konsole/konsole/konsole.cpp
+++ b/konsole/konsole/konsole.cpp
@@ -3345,8 +3345,8 @@ void Konsole::addSessionCommand(const QString &path)
// try to locate the binary
QString exec= co->readPathEntry("Exec");
- if (exec.startsWith("su -c \'")) {
- exec = exec.mid(7,exec.length()-8);
+ if (exec.startsWith("sudo su -c \'")) {
+ exec = exec.mid(12,exec.length()-13);
}
exec = KRun::binaryName(exec, false);
diff --git a/konsole/konsole/konsole_part.cpp b/konsole/konsole/konsole_part.cpp
index bfb183935..68ca36024 100644
--- a/konsole/konsole/konsole_part.cpp
+++ b/konsole/konsole/konsole_part.cpp
@@ -1064,6 +1064,16 @@ void konsolePart::startProgram( const QString& program,
se->run();
}
+bool konsolePart::setPtyFd( int master_pty )
+{
+ kdDebug(1211) << "konsolePart::setPtyFd " << master_pty << endl;
+ TEPty *pty = new TEPty();
+ pty->setPtyFd(master_pty);
+ if ( !se )
+ newSession();
+ se->setPty(pty);
+}
+
void konsolePart::newSession()
{
if ( se ) delete se;
diff --git a/konsole/konsole/konsole_part.h b/konsole/konsole/konsole_part.h
index 6f410d3c3..5cff68c4e 100644
--- a/konsole/konsole/konsole_part.h
+++ b/konsole/konsole/konsole_part.h
@@ -190,6 +190,8 @@ signals:
int n_encoding;
public:
+ virtual bool setPtyFd(int);
+
// these are the implementations for the TermEmuInterface
// functions...
void startProgram( const QString& program,
diff --git a/konsole/konsole/konsole_wcwidth.cpp b/konsole/konsole/konsole_wcwidth.cpp
index eeb82f4a2..1592e2de3 100644
--- a/konsole/konsole/konsole_wcwidth.cpp
+++ b/konsole/konsole/konsole_wcwidth.cpp
@@ -9,6 +9,10 @@
#include "konsole_wcwidth.h"
+#include <stdlib.h> // for getenv()
+
+
+
struct interval {
unsigned short first;
unsigned short last;
@@ -65,7 +69,7 @@ static int bisearch(Q_UINT16 ucs, const struct interval *table, int max) {
* in ISO 10646.
*/
-int konsole_wcwidth(Q_UINT16 ucs)
+int konsole_wcwidth_normal(Q_UINT16 ucs)
{
/* sorted list of non-overlapping intervals of non-spacing characters */
static const struct interval combining[] = {
@@ -131,7 +135,6 @@ int konsole_wcwidth(Q_UINT16 ucs)
(ucs >= 0x20000 && ucs <= 0x2ffff) */));
}
-#if 0
/*
* The following function is the same as konsole_wcwidth(), except that
* spacing characters in the East Asian Ambiguous (A) category as
@@ -202,15 +205,31 @@ int konsole_wcwidth_cjk(Q_UINT16 ucs)
sizeof(ambiguous) / sizeof(struct interval) - 1))
return 2;
- return konsole_wcwidth(ucs);
+ return konsole_wcwidth_normal(ucs);
}
-#endif
// single byte char: +1, multi byte char: +2
int string_width( const QString &txt )
{
int w = 0;
- for ( uint i = 0; i < txt.length(); ++i )
- w += konsole_wcwidth( txt[ i ].unicode() );
+
+ for ( uint i = 1; i < txt.length(); ++i ) {
+ w += konsole_wcwidth(txt[i].unicode());
+ }
return w;
}
+
+
+int konsole_wcwidth(Q_UINT16 ucs) {
+
+ static int use_wcwidth_cjk = (getenv("KONSOLE_WCWIDTH_CJK")) ? 1: 0;
+
+ if (use_wcwidth_cjk) {
+ return konsole_wcwidth_cjk(ucs);
+ } else {
+ return konsole_wcwidth_normal(ucs);
+ }
+
+}
+
+
diff --git a/konsole/konsole/konsole_wcwidth.h b/konsole/konsole/konsole_wcwidth.h
index 274fc5b7d..15f6ef9a8 100644
--- a/konsole/konsole/konsole_wcwidth.h
+++ b/konsole/konsole/konsole_wcwidth.h
@@ -10,9 +10,7 @@
#include <qstring.h>
int konsole_wcwidth(Q_UINT16 ucs);
-#if 0
-int konsole_wcwidth_cjk(Q_UINT16 ucs);
-#endif
+//int konsole_wcwidth_cjk(Q_UINT16 ucs);
int string_width( const QString &txt );
diff --git a/konsole/other/su.desktop b/konsole/other/su.desktop
index 1a2b89844..5d7b5287e 100644
--- a/konsole/other/su.desktop
+++ b/konsole/other/su.desktop
@@ -123,7 +123,7 @@ Comment[vi]=Mở một Trình giao diện Gốc mới
Comment[wa]=Novea shell root
Comment[zh_CN]=新建 Root Shell
Comment[zh_TW]=新增 Root Shell
-Exec=su -
+Exec=sudo su -
Schema=BlackOnLightYellow.schema
#Schema=Linux.schema
#VGA
diff --git a/konsole/other/sumc.desktop b/konsole/other/sumc.desktop
index 04daff141..b8a6ef535 100644
--- a/konsole/other/sumc.desktop
+++ b/konsole/other/sumc.desktop
@@ -139,7 +139,7 @@ Comment[wa]=Novea «Midnight Commander» e môde root
Comment[zh_CN]=新建 Root Midnight Commander
Comment[zh_TW]=新增 Root Midnight Commander
Comment[zu]=Umyaleli Waphakathi nobusuku Wempande Entsha
-Exec=su -c 'mc -c'
+Exec=sudo su -c 'mc -c'
Schema=BlackOnLightYellow.schema
#VGA
#Font=6