Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions liteidex/src/plugins/golangpackage/gotool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ GoTool::GoTool(LiteApi::IApplication *app, QObject *parent) :
m_process = new Process(this);
connect(m_process,SIGNAL(readyReadStandardError()),this,SLOT(readError()));
connect(m_process,SIGNAL(readyReadStandardOutput()),this,SLOT(readOutput()));
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
connect(m_process, &QProcess::errorOccurred, this, &GoTool::error);
connect(m_process, &QProcess::finished, this, &GoTool::finished);
#else
connect(m_process,SIGNAL(errorOccurred(QProcess::ProcessError)),this,SIGNAL(error(QProcess::ProcessError)));
connect(m_process,SIGNAL(finished(int,QProcess::ExitStatus)),this,SIGNAL(finished(int,QProcess::ExitStatus)));
#endif
}

GoTool::~GoTool()
Expand Down
4 changes: 4 additions & 0 deletions liteidex/src/plugins/golangpackage/packagebrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ PackageBrowser::PackageBrowser(LiteApi::IApplication *app, QObject *parent) :
m_toolWindowAct = m_liteApp->toolWindowManager()->addToolWindow(Qt::LeftDockWidgetArea,m_widget,"GoPackageBrowser",tr("Go Package Browser"),true);
connect(m_toolWindowAct,SIGNAL(triggered(bool)),this,SLOT(toggledToolWindow(bool)));
connect(m_goTool,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(finished(int,QProcess::ExitStatus)));
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
connect(m_goTool, &GoTool::error, this, &PackageBrowser::error);
#else
connect(m_goTool,SIGNAL(error(QProcess::ProcessError)),this,SLOT(error(QProcess::ProcessError)));
#endif
connect(m_treeView,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(customContextMenuRequested(QPoint)));
connect(m_treeView,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(doubleClicked()));
connect(m_treeView,SIGNAL(enterKeyPressed(QModelIndex)),this,SLOT(enterKeyPressed(QModelIndex)));
Expand Down
11 changes: 11 additions & 0 deletions liteidex/src/utils/vterm/vtermwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,16 @@ void VTermWidget::keyPressEvent(QKeyEvent *e)
return;
}
if ((e->modifiers() & TermControlModifier) ) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
// Qt key codes for special keys (arrows, function keys, ...) are
// outside the UTF-16 range and must not be converted to QChar.
const int key = e->key();
if (key >= Qt::Key_A && key <= Qt::Key_Underscore) {
QByteArray array(1, char(key - Qt::Key_A + 1));
m_process->write(array);
return;
}
#else
QChar c(e->key());
char asciiVal = c.toUpper().toLatin1();
QByteArray array;
Expand All @@ -191,6 +201,7 @@ void VTermWidget::keyPressEvent(QKeyEvent *e)
m_process->write(array);
return;
}
#endif
}
VTermWidgetBase::keyPressEvent(e);
}
Expand Down
35 changes: 35 additions & 0 deletions liteidex/src/utils/vterm/vtermwidgetbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ bool attrs_is_equal(VTermScreenCellAttrs *a, VTermScreenCellAttrs *b)
return a->bold == b->bold && a->italic == b->italic && a->strike == b->strike && a->underline == b->underline;
}

#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
static bool is_valid_cell_char(const VTermScreenCell &cell)
{
if (cell.chars[0] == 0 || cell.chars[0] == static_cast<uint32_t>(-1)) {
return false;
}
for (int i = 0; i < VTERM_MAX_CHARS_PER_CELL && cell.chars[i]; ++i) {
if (cell.chars[i] == static_cast<uint32_t>(-1) || cell.chars[i] > 0x10ffff) {
return false;
}
}
return true;
}
#endif


int vterm_damage(VTermRect rect, void *user)
{
Expand Down Expand Up @@ -889,18 +904,30 @@ void VTermWidgetBase::setSelectionUnderWord(int row, int col)
}
VTermScreenCell cell;
this->adjustFetchCell(row,&col,&cell);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (!is_valid_cell_char(cell)) {
#else
if (!cell.chars[0]) {
#endif
int ncol = col+1;
for (; ncol < m_cols; ++ncol) {
this->fetchCell(row,ncol,&cell);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (is_valid_cell_char(cell)) {
#else
if (cell.chars[0]) {
#endif
break;
}
}
int pcol = col-1;
for (;pcol >= 0;--pcol) {
this->fetchCell(row,pcol,&cell);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (is_valid_cell_char(cell)) {
#else
if (cell.chars[0]) {
#endif
break;
}
}
Expand All @@ -911,7 +938,11 @@ void VTermWidgetBase::setSelectionUnderWord(int row, int col)
int ncol = col+width;
for (; ncol < m_cols;) {
this->fetchCell(row,ncol,&cell);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (!is_valid_cell_char(cell)) {
#else
if (!cell.chars[0]) {
#endif
break;
}
QChar c = QString::fromUcs4(cell.chars)[0];
Expand All @@ -925,7 +956,11 @@ void VTermWidgetBase::setSelectionUnderWord(int row, int col)
int pcol = col-1;
for (; pcol >= 0;--pcol) {
this->adjustFetchCell(row,&pcol,&cell);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (!is_valid_cell_char(cell)) {
#else
if (!cell.chars[0]) {
#endif
break;
}
QChar c = QString::fromUcs4(cell.chars)[0];
Expand Down
Loading