本文整理汇总了C++中KateView::killLine方法的典型用法代码示例。如果您正苦于以下问题:C++ KateView::killLine方法的具体用法?C++ KateView::killLine怎么用?C++ KateView::killLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KateView
的用法示例。
在下文中一共展示了KateView::killLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: args
bool KateCommands::CoreCommands::exec(Kate::View *view,
const QString &_cmd,
QString &errorMsg)
{
#define KCC_ERR(s) { errorMsg=s; return false; }
// cast it hardcore, we know that it is really a kateview :)
KateView *v = (KateView*) view;
if ( ! v )
KCC_ERR( i18n("Could not access view") );
//create a list of args
QStringList args( QStringList::split( QRegExp("\\s+"), _cmd ) );
QString cmd ( args.first() );
args.remove( args.first() );
// ALL commands that takes no arguments.
if ( cmd == "indent" )
{
v->indent();
return true;
}
else if ( cmd == "run-myself" )
{
#ifndef Q_WS_WIN //todo
return KateFactory::self()->jscript()->execute(v, v->doc()->text(), errorMsg);
#else
return 0;
#endif
}
else if ( cmd == "unindent" )
{
v->unIndent();
return true;
}
else if ( cmd == "cleanindent" )
{
v->cleanIndent();
return true;
}
else if ( cmd == "comment" )
{
v->comment();
return true;
}
else if ( cmd == "uncomment" )
{
v->uncomment();
return true;
}
else if ( cmd == "kill-line" )
{
v->killLine();
return true;
}
else if ( cmd == "set-indent-mode" )
{
bool ok(false);
int val ( args.first().toInt( &ok ) );
if ( ok )
{
if ( val < 0 )
KCC_ERR( i18n("Mode must be at least 0.") );
v->doc()->config()->setIndentationMode( val );
}
else
v->doc()->config()->setIndentationMode( KateAutoIndent::modeNumber( args.first() ) );
return true;
}
else if ( cmd == "set-highlight" )
{
QString val = _cmd.section( ' ', 1 ).lower();
for ( uint i=0; i < v->doc()->hlModeCount(); i++ )
{
if ( v->doc()->hlModeName( i ).lower() == val )
{
v->doc()->setHlMode( i );
return true;
}
}
KCC_ERR( i18n("No such highlight '%1'").arg( args.first() ) );
}
// ALL commands that takes exactly one integer argument.
else if ( cmd == "set-tab-width" ||
cmd == "set-indent-width" ||
cmd == "set-word-wrap-column" ||
cmd == "goto" )
{
// find a integer value > 0
if ( ! args.count() )
KCC_ERR( i18n("Missing argument. Usage: %1 <value>").arg( cmd ) );
bool ok;
int val ( args.first().toInt( &ok ) );
if ( !ok )
KCC_ERR( i18n("Failed to convert argument '%1' to integer.")
.arg( args.first() ) );
if ( cmd == "set-tab-width" )
{
//.........这里部分代码省略.........
示例2: args
bool KateCommands::CoreCommands::exec(KTextEditor::View *view,
const QString &_cmd,
QString &errorMsg,
const KTextEditor::Range& range)
{
#define KCC_ERR(s) { errorMsg=s; return false; }
// cast it hardcore, we know that it is really a kateview :)
KateView *v = static_cast<KateView*>(view);
if ( ! v )
KCC_ERR( i18n("Could not access view") );
//create a list of args
QStringList args(_cmd.split( QRegExp("\\s+"), QString::SkipEmptyParts)) ;
QString cmd ( args.takeFirst() );
// ALL commands that takes no arguments.
if ( cmd == "indent" )
{
if ( range.isValid() ) {
v->doc()->editStart();
for ( int line = range.start().line(); line <= range.end().line(); line++ ) {
v->doc()->indent( KTextEditor::Range(line, 0, line, 0), 1 );
}
v->doc()->editEnd();
} else {
v->indent();
}
return true;
}
else if ( cmd == "unindent" )
{
if ( range.isValid() ) {
v->doc()->editStart();
for ( int line = range.start().line(); line <= range.end().line(); line++ ) {
v->doc()->indent( KTextEditor::Range(line, 0, line, 0), -1 );
}
v->doc()->editEnd();
} else {
v->unIndent();
}
return true;
}
else if ( cmd == "cleanindent" )
{
if ( range.isValid() ) {
v->doc()->editStart();
for ( int line = range.start().line(); line <= range.end().line(); line++ ) {
v->doc()->indent( KTextEditor::Range(line, 0, line, 0), 0 );
}
v->doc()->editEnd();
} else {
v->cleanIndent();
}
return true;
}
else if ( cmd == "comment" )
{
if ( range.isValid() ) {
v->doc()->editStart();
for ( int line = range.start().line(); line <= range.end().line(); line++ ) {
v->doc()->comment( v, line, 0, 1 );
}
v->doc()->editEnd();
} else {
v->comment();
}
return true;
}
else if ( cmd == "uncomment" )
{
if ( range.isValid() ) {
v->doc()->editStart();
for ( int line = range.start().line(); line <= range.end().line(); line++ ) {
v->doc()->comment( v, line, 0, -1 );
}
v->doc()->editEnd();
} else {
v->uncomment();
}
return true;
}
else if ( cmd == "kill-line" )
{
if ( range.isValid() ) {
v->doc()->editStart();
for ( int line = range.start().line(); line <= range.end().line(); line++ ) {
v->doc()->removeLine( range.start().line() );
}
v->doc()->editEnd();
} else {
v->killLine();
}
return true;
}
else if ( cmd == "print" )
{
v->doc()->printDialog();
return true;
}
//.........这里部分代码省略.........