Skip to content
GitLab
Menu
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
034ee0a9
Commit
034ee0a9
authored
May 10, 2010
by
hjk
Browse files
fakevim: add option to show positions of marks in the main text editor
parent
719907a5
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/plugins/fakevim/fakevimactions.cpp
View file @
034ee0a9
...
...
@@ -214,6 +214,14 @@ FakeVimSettings *theFakeVimSettings()
"FakeVim properties..."
));
instance
->
insertItem
(
SettingsDialog
,
item
);
// Invented here.
item
=
new
SavedAction
(
instance
);
item
->
setDefaultValue
(
false
);
item
->
setValue
(
false
);
item
->
setSettingsKey
(
group
,
_
(
"ShowMarks"
));
item
->
setCheckable
(
true
);
instance
->
insertItem
(
ConfigShowMarks
,
item
,
_
(
"showmarks"
),
_
(
"sm"
));
return
instance
;
}
...
...
src/plugins/fakevim/fakevimactions.h
View file @
034ee0a9
...
...
@@ -65,6 +65,7 @@ enum FakeVimSettingsCode
// other actions
SettingsDialog
,
ConfigShowMarks
,
};
class
FakeVimSettings
:
public
QObject
...
...
src/plugins/fakevim/fakevimhandler.cpp
View file @
034ee0a9
...
...
@@ -103,8 +103,6 @@
# define UNDO_DEBUG(s)
#endif
//#define DEBUG_MARKS 1
using
namespace
Utils
;
namespace
FakeVim
{
...
...
@@ -978,9 +976,10 @@ EventResult FakeVimHandler::Private::handleEvent(QKeyEvent *ev)
EDITOR
(
setTextCursor
(
m_tc
));
m_oldPosition
=
m_tc
.
position
();
}
#ifdef DEBUG_MARKS
updateSelection
();
#endif
if
(
hasConfig
(
ConfigShowMarks
))
updateSelection
();
return
result
;
}
...
...
@@ -1425,19 +1424,19 @@ void FakeVimHandler::Private::updateSelection()
}
}
//qDebug() << "SELECTION: " << selections;
#ifdef DEBUG_MARKS
for
(
QHashIterator
<
int
,
int
>
it
(
m_marks
);
it
.
hasNext
();
)
{
it
.
next
();
QTextEdit
::
ExtraSelection
sel
;
sel
.
cursor
=
m_tc
;
sel
.
cursor
.
setPosition
(
it
.
value
(),
MoveAnchor
);
sel
.
cursor
.
setPosition
(
it
.
value
()
+
1
,
KeepAnchor
);
sel
.
format
=
m_tc
.
blockCharFormat
();
sel
.
format
.
setForeground
(
Qt
::
blue
);
sel
.
format
.
setBackground
(
Qt
::
green
);
selections
.
append
(
sel
);
if
(
hasConfig
(
ConfigShowMarks
))
{
for
(
QHashIterator
<
int
,
int
>
it
(
m_marks
);
it
.
hasNext
();
)
{
it
.
next
();
QTextEdit
::
ExtraSelection
sel
;
sel
.
cursor
=
m_tc
;
sel
.
cursor
.
setPosition
(
it
.
value
(),
MoveAnchor
);
sel
.
cursor
.
setPosition
(
it
.
value
()
+
1
,
KeepAnchor
);
sel
.
format
=
m_tc
.
blockCharFormat
();
sel
.
format
.
setForeground
(
Qt
::
blue
);
sel
.
format
.
setBackground
(
Qt
::
green
);
selections
.
append
(
sel
);
}
}
#endif
emit
q
->
selectionChanged
(
selections
);
}
...
...
src/plugins/fakevim/fakevimoptions.ui
View file @
034ee0a9
...
...
@@ -66,6 +66,13 @@
</property>
</widget>
</item>
<item
row=
"2"
column=
"2"
>
<widget
class=
"QCheckBox"
name=
"checkBoxShowMarks"
>
<property
name=
"text"
>
<string>
Show position of text marks
</string>
</property>
</widget>
</item>
<item
row=
"3"
column=
"0"
colspan=
"2"
>
<widget
class=
"QCheckBox"
name=
"checkBoxSmartTab"
>
<property
name=
"text"
>
...
...
src/plugins/fakevim/fakevimplugin.cpp
View file @
034ee0a9
...
...
@@ -167,6 +167,8 @@ QWidget *FakeVimOptionPage::createPage(QWidget *parent)
m_ui
.
checkBoxHlSearch
);
m_group
.
insert
(
theFakeVimSetting
(
ConfigShiftWidth
),
m_ui
.
spinBoxShiftWidth
);
m_group
.
insert
(
theFakeVimSetting
(
ConfigShowMarks
),
m_ui
.
checkBoxShowMarks
);
m_group
.
insert
(
theFakeVimSetting
(
ConfigSmartTab
),
m_ui
.
checkBoxSmartTab
);
...
...
@@ -198,8 +200,8 @@ QWidget *FakeVimOptionPage::createPage(QWidget *parent)
QTextStream
(
&
m_searchKeywords
)
<<
' '
<<
m_ui
.
checkBoxAutoIndent
->
text
()
<<
' '
<<
m_ui
.
checkBoxExpandTab
->
text
()
<<
' '
<<
m_ui
.
checkBoxShowMarks
->
text
()
<<
' '
<<
m_ui
.
checkBoxSmartIndent
->
text
()
<<
' '
<<
m_ui
.
checkBoxExpandTab
->
text
()
<<
' '
<<
m_ui
.
checkBoxHlSearch
->
text
()
<<
' '
<<
m_ui
.
checkBoxIncSearch
->
text
()
<<
' '
<<
m_ui
.
checkBoxSmartTab
->
text
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment