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
a387eed4
Commit
a387eed4
authored
Jan 06, 2009
by
hjk
Browse files
visual feedback for block selection. othewise block selection still does
not work..
parent
8c23bb3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/fakevim/handler.cpp
View file @
a387eed4
...
...
@@ -355,25 +355,40 @@ void FakeVimHandler::Private::updateSelection()
sel
.
format
=
m_tc
.
blockCharFormat
();
sel
.
format
.
setFontWeight
(
QFont
::
Bold
);
sel
.
format
.
setFontUnderline
(
true
);
int
p
os
=
m_tc
.
position
();
int
anchor
=
m_marks
[
'<'
];
//qDebug() << "POS: " <<
p
os << " ANCHOR: " << anchor;
int
cursorP
os
=
m_tc
.
position
();
int
anchor
Pos
=
m_marks
[
'<'
];
//qDebug() << "POS: " <<
cursorP
os << " ANCHOR: " << anchor
Pos
;
if
(
m_visualMode
==
VisualCharMode
)
{
sel
.
cursor
.
setPosition
(
anchor
,
KeepAnchor
);
sel
.
cursor
.
setPosition
(
anchor
Pos
,
KeepAnchor
);
selections
.
append
(
sel
);
}
else
if
(
m_visualMode
==
VisualLineMode
)
{
sel
.
cursor
.
setPosition
(
qMin
(
p
os
,
anchor
),
MoveAnchor
);
sel
.
cursor
.
setPosition
(
qMin
(
cursorP
os
,
anchor
Pos
),
MoveAnchor
);
sel
.
cursor
.
movePosition
(
StartOfLine
,
MoveAnchor
);
sel
.
cursor
.
setPosition
(
qMax
(
p
os
,
anchor
),
KeepAnchor
);
sel
.
cursor
.
setPosition
(
qMax
(
cursorP
os
,
anchor
Pos
),
KeepAnchor
);
sel
.
cursor
.
movePosition
(
EndOfLine
,
KeepAnchor
);
selections
.
append
(
sel
);
}
else
if
(
m_visualMode
==
VisualBlockMode
)
{
// FIXME: This shows lines right now...
sel
.
cursor
.
setPosition
(
qMin
(
pos
,
anchor
),
MoveAnchor
);
sel
.
cursor
.
movePosition
(
StartOfLine
,
MoveAnchor
);
sel
.
cursor
.
setPosition
(
qMax
(
pos
,
anchor
),
KeepAnchor
);
sel
.
cursor
.
movePosition
(
EndOfLine
,
KeepAnchor
);
selections
.
append
(
sel
);
QTextCursor
tc
=
m_tc
;
tc
.
setPosition
(
anchorPos
);
tc
.
movePosition
(
StartOfLine
,
MoveAnchor
);
QTextBlock
anchorBlock
=
tc
.
block
();
QTextBlock
cursorBlock
=
m_tc
.
block
();
int
anchorColumn
=
anchorPos
-
anchorBlock
.
position
();
int
cursorColumn
=
cursorPos
-
cursorBlock
.
position
();
int
startColumn
=
qMin
(
anchorColumn
,
cursorColumn
);
int
endColumn
=
qMax
(
anchorColumn
,
cursorColumn
);
int
endPos
=
cursorBlock
.
position
();
while
(
tc
.
position
()
<=
endPos
)
{
if
(
startColumn
<
tc
.
block
().
length
()
-
1
)
{
int
last
=
qMin
(
tc
.
block
().
length
()
-
1
,
endColumn
);
int
len
=
last
-
startColumn
+
1
;
sel
.
cursor
=
tc
;
sel
.
cursor
.
movePosition
(
Right
,
MoveAnchor
,
startColumn
);
sel
.
cursor
.
movePosition
(
Right
,
KeepAnchor
,
len
);
selections
.
append
(
sel
);
}
tc
.
movePosition
(
Down
,
MoveAnchor
,
1
);
}
}
}
EDITOR
(
setExtraSelections
(
selections
));
...
...
@@ -1196,6 +1211,7 @@ void FakeVimHandler::Private::enterVisualMode(VisualMode visualMode)
m_visualMode
=
visualMode
;
m_marks
[
'<'
]
=
m_tc
.
position
();
updateMiniBuffer
();
updateSelection
();
}
void
FakeVimHandler
::
Private
::
leaveVisualMode
()
...
...
@@ -1203,6 +1219,7 @@ void FakeVimHandler::Private::leaveVisualMode()
m_visualMode
=
NoVisualMode
;
m_marks
[
'>'
]
=
m_tc
.
position
();
updateMiniBuffer
();
updateSelection
();
}
QWidget
*
FakeVimHandler
::
Private
::
editor
()
const
...
...
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