Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Alchemy Viewer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
62
Issues
62
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alchemy
Alchemy Viewer
Commits
0080301c
Commit
0080301c
authored
Aug 27, 2014
by
Drake Arconis
Browse files
Options
Browse Files
Download
Plain Diff
Merge Lirusaito/alchemy-dire
parents
4f9b0c4e
a00c530b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
2 deletions
+81
-2
indra/llui/lllineeditor.cpp
indra/llui/lllineeditor.cpp
+38
-1
indra/llui/lllineeditor.h
indra/llui/lllineeditor.h
+1
-0
indra/llui/lltexteditor.cpp
indra/llui/lltexteditor.cpp
+41
-1
indra/llui/lltexteditor.h
indra/llui/lltexteditor.h
+1
-0
No files found.
indra/llui/lllineeditor.cpp
View file @
0080301c
...
...
@@ -929,6 +929,32 @@ void LLLineEditor::removeChar()
}
}
// Remove a word (set of characters up to next space/punctuation) from the text
void
LLLineEditor
::
removeWord
(
bool
prev
)
{
const
U32
pos
(
getCursor
());
if
(
prev
?
pos
>
0
:
static_cast
<
S32
>
(
pos
)
<
getLength
())
{
U32
new_pos
(
prev
?
prevWordPos
(
pos
)
:
nextWordPos
(
pos
));
if
(
new_pos
==
pos
)
// Other character we don't jump over
new_pos
=
prev
?
prevWordPos
(
new_pos
-
1
)
:
nextWordPos
(
new_pos
+
1
);
const
U32
diff
(
labs
(
pos
-
new_pos
));
if
(
prev
)
{
mText
.
erase
(
new_pos
,
diff
);
setCursor
(
new_pos
);
}
else
{
mText
.
erase
(
pos
,
diff
);
}
}
else
{
LLUI
::
reportBadKeystroke
();
}
}
void
LLLineEditor
::
addChar
(
const
llwchar
uni_char
)
{
...
...
@@ -1356,7 +1382,10 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
else
if
(
0
<
getCursor
()
)
{
removeChar
();
if
(
mask
==
MASK_CONTROL
)
removeWord
(
true
);
else
removeChar
();
}
else
{
...
...
@@ -1366,6 +1395,14 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
handled
=
TRUE
;
break
;
case
KEY_DELETE
:
if
(
!
mReadOnly
&&
mask
==
MASK_CONTROL
)
{
removeWord
(
false
);
handled
=
true
;
}
break
;
case
KEY_PAGE_UP
:
case
KEY_HOME
:
if
(
!
mIgnoreArrowKeys
)
...
...
indra/llui/lllineeditor.h
View file @
0080301c
...
...
@@ -279,6 +279,7 @@ private:
void
pasteHelper
(
bool
is_primary
);
void
removeChar
();
void
removeWord
(
bool
prev
);
void
addChar
(
const
llwchar
c
);
void
setCursorAtLocalPos
(
S32
local_mouse_x
);
S32
findPixelNearestPos
(
S32
cursor_offset
=
0
)
const
;
...
...
indra/llui/lltexteditor.cpp
View file @
0080301c
...
...
@@ -1090,6 +1090,33 @@ void LLTextEditor::removeChar()
}
}
// Remove a word (set of characters up to next space/punctuation) from the text
void
LLTextEditor
::
removeWord
(
bool
prev
)
{
const
U32
pos
(
mCursorPos
);
if
(
prev
?
pos
>
0
:
static_cast
<
S32
>
(
pos
)
<
getLength
())
{
U32
new_pos
(
prev
?
prevWordPos
(
pos
)
:
nextWordPos
(
pos
));
if
(
new_pos
==
pos
)
// Other character we don't jump over
new_pos
=
prev
?
prevWordPos
(
new_pos
-
1
)
:
nextWordPos
(
new_pos
+
1
);
const
U32
diff
(
labs
(
pos
-
new_pos
));
if
(
prev
)
{
remove
(
new_pos
,
diff
,
false
);
setCursorPos
(
new_pos
);
}
else
{
remove
(
pos
,
diff
,
false
);
}
}
else
{
LLUI
::
reportBadKeystroke
();
}
}
// Add a single character to the text
S32
LLTextEditor
::
addChar
(
S32
pos
,
llwchar
wc
)
{
...
...
@@ -1676,7 +1703,10 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
else
if
(
0
<
mCursorPos
)
{
removeCharOrTab
();
if
(
mask
==
MASK_CONTROL
)
removeWord
(
true
);
else
removeCharOrTab
();
}
else
{
...
...
@@ -1684,6 +1714,16 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
}
break
;
case
KEY_DELETE
:
if
(
getEnabled
()
&&
mask
==
MASK_CONTROL
)
{
removeWord
(
false
);
}
else
{
handled
=
false
;
}
break
;
case
KEY_RETURN
:
if
(
mask
==
MASK_NONE
)
...
...
indra/llui/lltexteditor.h
View file @
0080301c
...
...
@@ -246,6 +246,7 @@ protected:
S32
overwriteChar
(
S32
pos
,
llwchar
wc
);
void
removeChar
();
S32
removeChar
(
S32
pos
);
void
removeWord
(
bool
prev
);
S32
insert
(
S32
pos
,
const
LLWString
&
wstr
,
bool
group_with_next_op
,
LLTextSegmentPtr
segment
);
S32
remove
(
S32
pos
,
S32
length
,
bool
group_with_next_op
);
...
...
Write
Preview
Markdown
is supported
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