Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
b3cbb849
Commit
b3cbb849
authored
Jan 23, 2009
by
dt
Browse files
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
parents
e8e2e4f4
8b3136f8
Changes
25
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/basefilewizard.cpp
View file @
b3cbb849
...
...
@@ -32,12 +32,13 @@
***************************************************************************/
#include
"basefilewizard.h"
#include
"coreconstants.h"
#include
"icore.h"
#include
"ifilewizardextension.h"
#include
"mimedatabase.h"
#include
"editormanager/editormanager.h"
#include
<coreplugin/editormanager/editormanager.h>
#include
<coreplugin/icore.h>
#include
<coreplugin/coreconstants.h>
#include
<coreplugin/ifilewizardextension.h>
#include
<extensionsystem/pluginmanager.h>
#include
<utils/filewizarddialog.h>
...
...
src/plugins/coreplugin/coreplugin.pro
View file @
b3cbb849
...
...
@@ -167,3 +167,10 @@ RESOURCES += core.qrc \
contains
(
QT_CONFIG
,
webkit
)
{
QT
+=
webkit
}
linux
-*
{
images
.
files
=
images
/
qtcreator_logo_
*.
png
images
.
path
=
/
share
/
pixmaps
INSTALLS
+=
images
}
src/plugins/coreplugin/editormanager/editorsplitter.cpp
View file @
b3cbb849
...
...
@@ -33,15 +33,14 @@
#include
"editorsplitter.h"
#include
"coreconstants.h"
#include
"editormanager.h"
#include
"icore.h"
#include
"minisplitter.h"
#include
"openeditorswindow.h"
#include
"stackededitorgroup.h"
#include
<coreplugin/icore.h>
#include
<coreplugin/coreconstants.h>
#include
<coreplugin/uniqueidmanager.h>
#include
<coreplugin/actionmanager/actionmanager.h>
#include
"uniqueidmanager.h"
#include
"actionmanager/actionmanager.h"
#include
<utils/qtcassert.h>
...
...
src/plugins/coreplugin/filemanager.cpp
View file @
b3cbb849
...
...
@@ -33,13 +33,14 @@
#include
"filemanager.h"
#include
"editormanager.h"
#include
"icore.h"
#include
"ifile.h"
#include
"iversioncontrol.h"
#include
"mainwindow.h"
#include
"mimedatabase.h"
#include
"saveitemsdialog.h"
#include
"vcsmanager.h"
#include
"editormanager.h"
#include
"mimedatabase.h"
#include
"iversioncontrol.h"
#include
<utils/qtcassert.h>
...
...
src/plugins/coreplugin/mainwindow.cpp
View file @
b3cbb849
...
...
@@ -380,7 +380,7 @@ void MainWindow::registerDefaultContainers()
menubar
->
appendGroup
(
Constants
::
G_WINDOW
);
menubar
->
appendGroup
(
Constants
::
G_HELP
);
//File Menu
//
File Menu
ActionContainer
*
filemenu
=
am
->
createMenu
(
Constants
::
M_FILE
);
menubar
->
addMenu
(
filemenu
,
Constants
::
G_FILE
);
filemenu
->
menu
()
->
setTitle
(
tr
(
"&File"
));
...
...
@@ -394,7 +394,7 @@ void MainWindow::registerDefaultContainers()
connect
(
filemenu
->
menu
(),
SIGNAL
(
aboutToShow
()),
this
,
SLOT
(
aboutToShowRecentFiles
()));
//Edit Menu
//
Edit Menu
ActionContainer
*
medit
=
am
->
createMenu
(
Constants
::
M_EDIT
);
menubar
->
addMenu
(
medit
,
Constants
::
G_EDIT
);
medit
->
menu
()
->
setTitle
(
tr
(
"&Edit"
));
...
...
@@ -405,12 +405,12 @@ void MainWindow::registerDefaultContainers()
medit
->
appendGroup
(
Constants
::
G_EDIT_FIND
);
medit
->
appendGroup
(
Constants
::
G_EDIT_OTHER
);
//Tools Menu
//
Tools Menu
ActionContainer
*
ac
=
am
->
createMenu
(
Constants
::
M_TOOLS
);
menubar
->
addMenu
(
ac
,
Constants
::
G_TOOLS
);
ac
->
menu
()
->
setTitle
(
tr
(
"&Tools"
));
//Window Menu
//
Window Menu
ActionContainer
*
mwindow
=
am
->
createMenu
(
Constants
::
M_WINDOW
);
menubar
->
addMenu
(
mwindow
,
Constants
::
G_WINDOW
);
mwindow
->
menu
()
->
setTitle
(
tr
(
"&Window"
));
...
...
@@ -423,7 +423,7 @@ void MainWindow::registerDefaultContainers()
mwindow
->
appendGroup
(
Constants
::
G_WINDOW_OTHER
);
mwindow
->
appendGroup
(
Constants
::
G_WINDOW_LIST
);
//Help Menu
//
Help Menu
ac
=
am
->
createMenu
(
Constants
::
M_HELP
);
menubar
->
addMenu
(
ac
,
Constants
::
G_HELP
);
ac
->
menu
()
->
setTitle
(
tr
(
"&Help"
));
...
...
src/plugins/coreplugin/mainwindow.h
View file @
b3cbb849
...
...
@@ -34,7 +34,7 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include
"
i
core.h"
#include
"core
_global
.h"
#include
<QtGui/QMainWindow>
#include
<QtCore/QMap>
...
...
@@ -61,6 +61,7 @@ class BaseView;
class
EditorManager
;
class
FileManager
;
class
IContext
;
class
IWizard
;
class
MessageManager
;
class
MimeDatabase
;
class
ModeManager
;
...
...
@@ -103,7 +104,6 @@ public:
void
openFiles
(
const
QStringList
&
fileNames
);
//ICore
inline
ExtensionSystem
::
PluginManager
*
pluginManager
()
{
return
m_pluginManager
;
}
Core
::
ActionManager
*
actionManager
()
const
;
Core
::
FileManager
*
fileManager
()
const
;
...
...
src/plugins/coreplugin/modemanager.cpp
View file @
b3cbb849
...
...
@@ -35,6 +35,7 @@
#include
"fancytabwidget.h"
#include
"fancyactionbar.h"
#include
"icore.h"
#include
"mainwindow.h"
#include
<aggregation/aggregate.h>
...
...
src/plugins/coreplugin/navigationwidget.cpp
View file @
b3cbb849
...
...
@@ -33,12 +33,13 @@
#include
"navigationwidget.h"
#include
<coreplugin/icore.h>
#include
<coreplugin/coreconstants.h>
#include
<coreplugin/inavigationwidgetfactory.h>
#include
<coreplugin/modemanager.h>
#include
<coreplugin/uniqueidmanager.h>
#include
<coreplugin/actionmanager/actionmanager.h>
#include
"icore.h"
#include
"coreconstants.h"
#include
"inavigationwidgetfactory.h"
#include
"modemanager.h"
#include
"uniqueidmanager.h"
#include
"actionmanager/actionmanager.h"
#include
<extensionsystem/pluginmanager.h>
#include
<QtCore/QDebug>
...
...
src/plugins/coreplugin/outputpane.cpp
View file @
b3cbb849
...
...
@@ -33,6 +33,7 @@
#include
"outputpane.h"
#include
"coreconstants.h"
#include
"icore.h"
#include
"ioutputpane.h"
#include
"mainwindow.h"
#include
"modemanager.h"
...
...
@@ -55,7 +56,6 @@
#include
<QtGui/QToolBar>
#include
<QtGui/QToolButton>
#include
<QtGui/QStackedWidget>
#include
<QDebug>
using
namespace
Core
;
using
namespace
Core
::
Internal
;
...
...
src/plugins/coreplugin/scriptmanager/scriptmanager_p.h
View file @
b3cbb849
...
...
@@ -35,13 +35,15 @@
#define SCRIPTMANAGER_P_H
#include
<coreplugin/scriptmanager/scriptmanager.h>
#include
<coreplugin/icore.h>
#include
<QtCore/QObject>
#include
<QtCore/QList>
#include
<QtScript/QScriptEngine>
namespace
Core
{
class
ICore
;
namespace
Internal
{
class
ScriptManagerPrivate
:
public
Core
::
ScriptManager
...
...
src/plugins/cppeditor/cppeditor.cpp
View file @
b3cbb849
...
...
@@ -440,9 +440,9 @@ void CPPEditor::switchDeclarationDefinition()
return
;
Function
*
f
=
lastSymbol
->
asFunction
();
if
(
!
f
)
{
if
(
!
f
)
{
Scope
*
fs
=
lastSymbol
->
scope
();
if
(
!
fs
->
isFunctionScope
())
if
(
!
fs
->
isFunctionScope
())
fs
=
fs
->
enclosingFunctionScope
();
if
(
fs
)
f
=
fs
->
owner
()
->
asFunction
();
...
...
src/plugins/designer/formeditorw.cpp
View file @
b3cbb849
...
...
@@ -40,6 +40,7 @@
#include
"workbenchintegration.h"
#include
<coreplugin/coreconstants.h>
#include
<coreplugin/icore.h>
#include
<coreplugin/uniqueidmanager.h>
#include
<coreplugin/actionmanager/actionmanager.h>
#include
<coreplugin/editormanager/editormanager.h>
...
...
src/plugins/designer/settingspage.h
View file @
b3cbb849
...
...
@@ -34,7 +34,6 @@
#ifndef DESIGNER_SETTINGSPAGE_H
#define DESIGNER_SETTINGSPAGE_H
#include
<coreplugin/icore.h>
#include
<coreplugin/dialogs/ioptionspage.h>
QT_BEGIN_NAMESPACE
...
...
src/plugins/fakevim/fakevimhandler.cpp
View file @
b3cbb849
...
...
@@ -45,6 +45,7 @@
#include
<QtCore/QDebug>
#include
<QtCore/QFile>
#include
<QtCore/QObject>
#include
<QtCore/QPointer>
#include
<QtCore/QProcess>
#include
<QtCore/QRegExp>
#include
<QtCore/QTextStream>
...
...
@@ -157,6 +158,13 @@ QDebug &operator<<(QDebug &ts, const EditOperation &op)
return
ts
;
}
QDebug
&
operator
<<
(
QDebug
&
ts
,
const
QList
<
QTextEdit
::
ExtraSelection
>
&
sels
)
{
foreach
(
QTextEdit
::
ExtraSelection
sel
,
sels
)
ts
<<
"SEL: "
<<
sel
.
cursor
.
anchor
()
<<
sel
.
cursor
.
position
();
return
ts
;
}
int
lineCount
(
const
QString
&
text
)
{
//return text.count(QChar(ParagraphSeparator));
...
...
@@ -166,11 +174,14 @@ int lineCount(const QString &text)
class
FakeVimHandler
::
Private
{
public:
Private
(
FakeVimHandler
*
parent
);
Private
(
FakeVimHandler
*
parent
,
QWidget
*
widget
);
bool
handleEvent
(
QKeyEvent
*
ev
);
void
handleExCommand
(
const
QString
&
cmd
);
void
setupWidget
();
void
restoreWidget
();
private:
friend
class
FakeVimHandler
;
static
int
shift
(
int
key
)
{
return
key
+
32
;
}
...
...
@@ -238,7 +249,6 @@ private:
int
readLineCode
(
QString
&
cmd
);
void
selectRange
(
int
beginLine
,
int
endLine
);
void
setWidget
(
QWidget
*
ob
);
void
enterInsertMode
();
void
enterCommandMode
();
void
showRedMessage
(
const
QString
&
msg
);
...
...
@@ -328,12 +338,17 @@ public:
// for restoring cursor position
int
m_savedYankPosition
;
int
m_desiredColumn
;
QPointer
<
QObject
>
m_extraData
;
};
FakeVimHandler
::
Private
::
Private
(
FakeVimHandler
*
parent
)
FakeVimHandler
::
Private
::
Private
(
FakeVimHandler
*
parent
,
QWidget
*
widget
)
{
q
=
parent
;
m_textedit
=
qobject_cast
<
QTextEdit
*>
(
widget
);
m_plaintextedit
=
qobject_cast
<
QPlainTextEdit
*>
(
widget
);
m_mode
=
CommandMode
;
m_submode
=
NoSubMode
;
m_subsubmode
=
NoSubSubMode
;
...
...
@@ -341,8 +356,6 @@ FakeVimHandler::Private::Private(FakeVimHandler *parent)
m_lastSearchForward
=
true
;
m_register
=
'"'
;
m_gflag
=
false
;
m_textedit
=
0
;
m_plaintextedit
=
0
;
m_visualMode
=
NoVisualMode
;
m_desiredColumn
=
0
;
m_moveType
=
MoveInclusive
;
...
...
@@ -403,6 +416,37 @@ bool FakeVimHandler::Private::handleEvent(QKeyEvent *ev)
return
handled
;
}
void
FakeVimHandler
::
Private
::
setupWidget
()
{
enterCommandMode
();
if
(
m_textedit
)
{
m_textedit
->
installEventFilter
(
q
);
//m_textedit->setCursorWidth(QFontMetrics(ed->font()).width(QChar('x')));
m_textedit
->
setLineWrapMode
(
QTextEdit
::
NoWrap
);
m_wasReadOnly
=
m_textedit
->
isReadOnly
();
}
else
if
(
m_plaintextedit
)
{
m_plaintextedit
->
installEventFilter
(
q
);
//plaintextedit->setCursorWidth(QFontMetrics(ed->font()).width(QChar('x')));
m_plaintextedit
->
setLineWrapMode
(
QPlainTextEdit
::
NoWrap
);
m_wasReadOnly
=
m_plaintextedit
->
isReadOnly
();
}
showBlackMessage
(
"vi emulation mode."
);
updateMiniBuffer
();
}
void
FakeVimHandler
::
Private
::
restoreWidget
()
{
//showBlackMessage(QString());
//updateMiniBuffer();
if
(
m_textedit
)
{
m_textedit
->
removeEventFilter
(
q
);
m_textedit
->
setReadOnly
(
m_wasReadOnly
);
}
else
if
(
m_plaintextedit
)
{
m_plaintextedit
->
removeEventFilter
(
q
);
m_plaintextedit
->
setReadOnly
(
m_wasReadOnly
);
}
}
bool
FakeVimHandler
::
Private
::
handleKey
(
int
key
,
int
unmodified
,
const
QString
&
text
)
{
//qDebug() << "KEY: " << key << text << "POS: " << m_tc.position();
...
...
@@ -419,6 +463,7 @@ bool FakeVimHandler::Private::handleKey(int key, int unmodified, const QString &
void
FakeVimHandler
::
Private
::
finishMovement
(
const
QString
&
dotCommand
)
{
//qDebug() << "ANCHOR: " << m_anchor;
if
(
m_submode
==
FilterSubMode
)
{
int
beginLine
=
lineForPosition
(
anchor
());
int
endLine
=
lineForPosition
(
position
());
...
...
@@ -443,6 +488,8 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
m_mode
=
InsertMode
;
m_submode
=
NoSubMode
;
}
else
if
(
m_submode
==
DeleteSubMode
)
{
if
(
m_moveType
==
MoveInclusive
)
moveRight
();
// correct
if
(
!
dotCommand
.
isEmpty
())
m_dotCommand
=
"d"
+
dotCommand
;
m_registers
[
m_register
]
=
recordRemoveSelectedText
();
...
...
@@ -467,10 +514,8 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
m_tc
.
setPosition
(
startBlock
.
position
());
moveToFirstNonBlankOnLine
();
m_submode
=
NoSubMode
;
}
else
if
(
m_moveType
==
MoveExclusive
)
{
moveLeft
();
// correct
m_moveType
=
MoveInclusive
;
}
m_moveType
=
MoveInclusive
;
m_mvcount
.
clear
();
m_opcount
.
clear
();
m_gflag
=
false
;
...
...
@@ -489,10 +534,13 @@ void FakeVimHandler::Private::updateSelection()
QTextEdit
::
ExtraSelection
sel
;
sel
.
cursor
=
m_tc
;
sel
.
format
=
m_tc
.
blockCharFormat
();
//sel.format.setFontWeight(QFont::Bold);
//sel.format.setFontUnderline(true);
#if 0
sel.format.setFontWeight(QFont::Bold);
sel.format.setFontUnderline(true);
#else
sel
.
format
.
setForeground
(
Qt
::
white
);
sel
.
format
.
setBackground
(
Qt
::
black
);
#endif
int
cursorPos
=
m_tc
.
position
();
int
anchorPos
=
m_marks
[
'<'
];
//qDebug() << "POS: " << cursorPos << " ANCHOR: " << anchorPos;
...
...
@@ -529,7 +577,8 @@ void FakeVimHandler::Private::updateSelection()
}
}
}
emit
q
->
selectionChanged
(
editor
(),
selections
);
//qDebug() << "SELECTION: " << selections;
emit
q
->
selectionChanged
(
selections
);
}
void
FakeVimHandler
::
Private
::
updateMiniBuffer
()
...
...
@@ -770,9 +819,11 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
recordBeginGroup
();
m_lastInsertion
.
clear
();
}
else
if
(
key
==
'b'
)
{
m_moveType
=
MoveExclusive
;
moveToWordBoundary
(
false
,
false
);
finishMovement
();
}
else
if
(
key
==
'B'
)
{
m_moveType
=
MoveExclusive
;
moveToWordBoundary
(
true
,
false
);
finishMovement
();
}
else
if
(
key
==
'c'
)
{
...
...
@@ -795,7 +846,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
m_mvcount
.
clear
();
m_submode
=
DeleteSubMode
;
}
else
if
(
key
==
'd'
)
{
setAnchor
();
//
setAnchor();
leaveVisualMode
();
int
beginLine
=
lineForPosition
(
m_marks
[
'<'
]);
int
endLine
=
lineForPosition
(
m_marks
[
'>'
]);
...
...
@@ -809,10 +860,11 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
moveRight
(
rightDist
());
finishMovement
();
}
else
if
(
key
==
'e'
)
{
m_moveType
=
MoveInclusive
;
moveToWordBoundary
(
false
,
true
);
m_moveType
=
MoveExclusive
;
finishMovement
();
}
else
if
(
key
==
'E'
)
{
m_moveType
=
MoveInclusive
;
moveToWordBoundary
(
true
,
true
);
finishMovement
();
}
else
if
(
key
==
'f'
||
key
==
'F'
)
{
...
...
@@ -1036,6 +1088,20 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
}
recordInsertText
(
str
);
recordEndGroup
();
}
else
if
(
key
==
control
(
'd'
))
{
int
sline
=
cursorLineOnScreen
();
// FIXME: this should use the "scroll" option, and "count"
moveDown
(
linesOnScreen
()
/
2
);
moveToFirstNonBlankOnLine
();
scrollToLineInDocument
(
cursorLineInDocument
()
-
sline
);
finishMovement
();
}
else
if
(
key
==
control
(
'u'
))
{
int
sline
=
cursorLineOnScreen
();
// FIXME: this should use the "scroll" option, and "count"
moveUp
(
linesOnScreen
()
/
2
);
moveToFirstNonBlankOnLine
();
scrollToLineInDocument
(
cursorLineInDocument
()
-
sline
);
finishMovement
();
}
else
if
(
key
==
Key_PageDown
||
key
==
control
(
'f'
))
{
moveDown
(
count
()
*
(
linesOnScreen
()
-
2
));
finishMovement
();
...
...
@@ -1271,12 +1337,12 @@ int FakeVimHandler::Private::readLineCode(QString &cmd)
void
FakeVimHandler
::
Private
::
selectRange
(
int
beginLine
,
int
endLine
)
{
m_
tc
.
setPosition
(
positionForLine
(
beginLine
)
,
MoveAnchor
)
;
m_
anchor
=
positionForLine
(
beginLine
);
if
(
endLine
==
linesInDocument
())
{
m_tc
.
setPosition
(
positionForLine
(
endLine
),
Keep
Anchor
);
m_tc
.
movePosition
(
EndOfLine
,
Keep
Anchor
);
m_tc
.
setPosition
(
positionForLine
(
endLine
),
Move
Anchor
);
m_tc
.
movePosition
(
EndOfLine
,
Move
Anchor
);
}
else
{
m_tc
.
setPosition
(
positionForLine
(
endLine
+
1
),
Keep
Anchor
);
m_tc
.
setPosition
(
positionForLine
(
endLine
+
1
),
Move
Anchor
);
}
}
...
...
@@ -1329,21 +1395,38 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
beginLine
=
0
;
if
(
endLine
==
-
1
)
endLine
=
linesInDocument
();
//
qDebug() << "LINES: " << beginLine << endLine;
qDebug
()
<<
"LINES: "
<<
beginLine
<<
endLine
;
bool
forced
=
cmd
.
startsWith
(
"w!"
);
QString
fileName
=
reWrite
.
cap
(
2
);
if
(
fileName
.
isEmpty
())
fileName
=
m_currentFileName
;
QFile
file
(
fileName
);
bool
exists
=
file
.
exists
();
QFile
file
1
(
fileName
);
bool
exists
=
file
1
.
exists
();
if
(
exists
&&
!
forced
&&
!
noArgs
)
{
showRedMessage
(
tr
(
"File '%1' exists (add ! to override)"
).
arg
(
fileName
));
}
else
if
(
file
.
open
(
QIODevice
::
ReadWrite
))
{
}
else
if
(
file1
.
open
(
QIODevice
::
ReadWrite
))
{
file1
.
close
();
selectRange
(
beginLine
,
endLine
);
emit
q
->
writeFile
(
fileName
,
selectedText
());
// check by reading back
file
.
open
(
QIODevice
::
ReadOnly
);
QByteArray
ba
=
file
.
readAll
();
QString
contents
=
selectedText
();
qDebug
()
<<
"LINES: "
<<
beginLine
<<
endLine
;
bool
handled
=
false
;
emit
q
->
writeFileRequested
(
&
handled
,
fileName
,
contents
);
// nobody cared, so act ourselves
if
(
!
handled
)
{
//qDebug() << "HANDLING MANUAL SAVE TO " << fileName;
QFile
::
remove
(
fileName
);
QFile
file2
(
fileName
);
if
(
file2
.
open
(
QIODevice
::
ReadWrite
))
{
QTextStream
ts
(
&
file2
);
ts
<<
contents
;
}
else
{
showRedMessage
(
tr
(
"Cannot open file '%1' for writing"
).
arg
(
fileName
));
}
}
// check result by reading back
QFile
file3
(
fileName
);
file3
.
open
(
QIODevice
::
ReadOnly
);
QByteArray
ba
=
file3
.
readAll
();
showBlackMessage
(
tr
(
"
\"
%1
\"
%2 %3L, %4C written"
)
.
arg
(
fileName
).
arg
(
exists
?
" "
:
" [New] "
)
.
arg
(
ba
.
count
(
'\n'
)).
arg
(
ba
.
size
()));
...
...
@@ -1401,7 +1484,7 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
QString
info
;
foreach
(
const
QString
&
key
,
m_config
.
keys
())
info
+=
key
+
": "
+
m_config
.
value
(
key
)
+
"
\n
"
;
emit
q
->
extraInformationChanged
(
editor
(),
info
);
emit
q
->
extraInformationChanged
(
info
);
}
else
{
notImplementedYet
();
}
...
...
@@ -1417,7 +1500,7 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
++
i
;
info
+=
QString
(
"%1 %2
\n
"
).
arg
(
i
,
-
8
).
arg
(
item
);
}
emit
q
->
extraInformationChanged
(
editor
(),
info
);
emit
q
->
extraInformationChanged
(
info
);
}
else
{
notImplementedYet
();
}
...
...
@@ -1566,8 +1649,7 @@ void FakeVimHandler::Private::moveToWordBoundary(bool simple, bool forward)
int
n
=
forward
?
lastPositionInDocument
()
-
1
:
0
;
int
lastClass
=
-
1
;
while
(
true
)
{
forward
?
moveRight
()
:
moveLeft
();
QChar
c
=
doc
->
characterAt
(
m_tc
.
position
());
QChar
c
=
doc
->
characterAt
(
m_tc
.
position
()
+
(
forward
?
1
:
-
1
));
int
thisClass
=
charClass
(
c
,
simple
);
if
(
thisClass
!=
lastClass
&&
lastClass
!=
0
)
--
repeat
;
...
...
@@ -1576,6 +1658,7 @@ void FakeVimHandler::Private::moveToWordBoundary(bool simple, bool forward)
lastClass
=
thisClass
;
if
(
m_tc
.
position
()
==
n
)
break
;
forward
?
moveRight
()
:
moveLeft
();
}
}
...
...
@@ -1752,6 +1835,7 @@ int FakeVimHandler::Private::lineForPosition(int pos) const
void
FakeVimHandler
::
Private
::
enterVisualMode
(
VisualMode
visualMode
)
{
setAnchor
();
m_visualMode
=
visualMode
;
m_marks
[
'<'
]
=
m_tc
.
position
();
m_marks
[
'>'
]
=
m_tc
.
position
();
...
...
@@ -1942,16 +2026,10 @@ void FakeVimHandler::Private::enterCommandMode()
void
FakeVimHandler
::
Private
::
quit
()
{
showBlackMessage
(
QString
());
EDITOR
(
setOverwriteMode
(
false
));
q
->
quitRequested
(
editor
()
);
q
->
quitRequested
();
}
void
FakeVimHandler
::
Private
::
setWidget
(
QWidget
*
ob
)
{
m_textedit
=
qobject_cast
<
QTextEdit
*>
(
ob
);
m_plaintextedit
=
qobject_cast
<
QPlainTextEdit
*>
(
ob
);
}
///////////////////////////////////////////////////////////////////////
//
...
...
@@ -1959,12 +2037,13 @@ void FakeVimHandler::Private::setWidget(QWidget *ob)
//
///////////////////////////////////////////////////////////////////////
FakeVimHandler
::
FakeVimHandler
(
QObject
*
parent
)
:
QObject
(
parent
),
d
(
new
Private
(
this
))
FakeVimHandler
::
FakeVimHandler
(
QWidget
*
widget
,
QObject
*
parent
)
:
QObject
(
parent
),
d
(
new
Private
(
this
,
widget
))
{}
FakeVimHandler
::~
FakeVimHandler
()
{
qDebug
()
<<
"DELETING HANDLER"
<<
this
;
delete
d
;
}
...
...
@@ -1993,40 +2072,18 @@ bool FakeVimHandler::eventFilter(QObject *ob, QEvent *ev)
return
QObject
::
eventFilter
(
ob
,
ev
);
}
void
FakeVimHandler
::
addWidget
(
QWidget
*
widget
)
void
FakeVimHandler
::
setupWidget
(
)
{
widget
->
installEventFilter
(
this
);
d
->
setWidget
(
widget
);
d
->
enterCommandMode
();
if
(
QTextEdit
*
ed
=
qobject_cast
<
QTextEdit
*>
(
widget
))
{
//ed->setCursorWidth(QFontMetrics(ed->font()).width(QChar('x')));
ed
->
setLineWrapMode
(
QTextEdit
::
NoWrap
);
d
->
m_wasReadOnly
=
ed
->
isReadOnly
();
}
else
if
(
QPlainTextEdit
*
ed
=
qobject_cast
<
QPlainTextEdit
*>
(
widget
))
{
//ed->setCursorWidth(QFontMetrics(ed->font()).width(QChar('x')));
ed
->
setLineWrapMode
(
QPlainTextEdit
::
NoWrap
);
d
->
m_wasReadOnly
=
ed
->
isReadOnly
();
}
d
->
showBlackMessage
(
"vi emulation mode."
);
d
->
updateMiniBuffer
();
d
->
setupWidget
();
}
void
FakeVimHandler
::
re
mov
eWidget
(
QWidget
*
widget
)