Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
581321d4
Commit
581321d4
authored
Dec 04, 2006
by
Lei Zhang
Committed by
Alexandre Julliard
Dec 05, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Move EM_EXSETSEL fix into ME_SetSelection.
parent
03fa9106
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
67 deletions
+54
-67
caret.c
dlls/riched20/caret.c
+50
-10
editor.c
dlls/riched20/editor.c
+3
-56
editor.h
dlls/riched20/editor.h
+1
-1
No files found.
dlls/riched20/caret.c
View file @
581321d4
...
@@ -78,8 +78,18 @@ int ME_GetTextLengthEx(ME_TextEditor *editor, GETTEXTLENGTHEX *how)
...
@@ -78,8 +78,18 @@ int ME_GetTextLengthEx(ME_TextEditor *editor, GETTEXTLENGTHEX *how)
}
}
void
ME_SetSelection
(
ME_TextEditor
*
editor
,
int
from
,
int
to
)
int
ME_SetSelection
(
ME_TextEditor
*
editor
,
int
from
,
int
to
)
{
{
int
selectionEnd
=
0
;
const
int
len
=
ME_GetTextLength
(
editor
);
/* all negative values are effectively the same */
if
(
from
<
0
)
from
=
-
1
;
if
(
to
<
0
)
to
=
-
1
;
/* select all */
if
(
from
==
0
&&
to
==
-
1
)
if
(
from
==
0
&&
to
==
-
1
)
{
{
editor
->
pCursors
[
1
].
pRun
=
ME_FindItemFwd
(
editor
->
pBuffer
->
pFirst
,
diRun
);
editor
->
pCursors
[
1
].
pRun
=
ME_FindItemFwd
(
editor
->
pBuffer
->
pFirst
,
diRun
);
...
@@ -88,31 +98,61 @@ void ME_SetSelection(ME_TextEditor *editor, int from, int to)
...
@@ -88,31 +98,61 @@ void ME_SetSelection(ME_TextEditor *editor, int from, int to)
editor
->
pCursors
[
0
].
nOffset
=
0
;
editor
->
pCursors
[
0
].
nOffset
=
0
;
ME_InvalidateSelection
(
editor
);
ME_InvalidateSelection
(
editor
);
ME_ClearTempStyle
(
editor
);
ME_ClearTempStyle
(
editor
);
return
;
return
len
+
1
;
}
}
if
(
from
==
-
1
&&
to
==
-
1
)
/*-1,-1 means put the selection at the end of the text */
/* if both values are equal and also out of bound, that means to */
/* put the selection at the end of the text */
if
((
from
==
to
)
&&
(
to
<
0
||
to
>
len
))
{
{
editor
->
pCursors
[
1
].
pRun
=
editor
->
pCursors
[
0
].
pRun
=
ME_FindItemBack
(
editor
->
pBuffer
->
pLast
,
diRun
);
selectionEnd
=
1
;
editor
->
pCursors
[
1
].
nOffset
=
editor
->
pCursors
[
0
].
nOffset
=
0
;
ME_InvalidateSelection
(
editor
);
ME_ClearTempStyle
(
editor
);
return
;
}
}
if
(
from
==
-
1
)
else
{
/* if from is negative and to is positive then selection is */
/* deselected and caret moved to end of the current selection */
if
(
from
<
0
)
{
{
int
start
,
end
;
ME_GetSelection
(
editor
,
&
start
,
&
end
);
editor
->
pCursors
[
1
]
=
editor
->
pCursors
[
0
];
editor
->
pCursors
[
1
]
=
editor
->
pCursors
[
0
];
ME_Repaint
(
editor
);
ME_Repaint
(
editor
);
ME_ClearTempStyle
(
editor
);
ME_ClearTempStyle
(
editor
);
return
;
return
end
;
}
}
/* adjust to if it's a negative value */
if
(
to
<
0
)
to
=
len
+
1
;
/* flip from and to if they are reversed */
if
(
from
>
to
)
if
(
from
>
to
)
{
{
int
tmp
=
from
;
int
tmp
=
from
;
from
=
to
;
from
=
to
;
to
=
tmp
;
to
=
tmp
;
}
}
/* after fiddling with the values, we find from > len && to > len */
if
(
from
>
len
)
selectionEnd
=
1
;
/* special case with to too big */
else
if
(
to
>
len
)
to
=
len
+
1
;
}
if
(
selectionEnd
)
{
editor
->
pCursors
[
1
].
pRun
=
editor
->
pCursors
[
0
].
pRun
=
ME_FindItemBack
(
editor
->
pBuffer
->
pLast
,
diRun
);
editor
->
pCursors
[
1
].
nOffset
=
editor
->
pCursors
[
0
].
nOffset
=
0
;
ME_InvalidateSelection
(
editor
);
ME_ClearTempStyle
(
editor
);
return
len
;
}
ME_RunOfsFromCharOfs
(
editor
,
from
,
&
editor
->
pCursors
[
1
].
pRun
,
&
editor
->
pCursors
[
1
].
nOffset
);
ME_RunOfsFromCharOfs
(
editor
,
from
,
&
editor
->
pCursors
[
1
].
pRun
,
&
editor
->
pCursors
[
1
].
nOffset
);
ME_RunOfsFromCharOfs
(
editor
,
to
,
&
editor
->
pCursors
[
0
].
pRun
,
&
editor
->
pCursors
[
0
].
nOffset
);
ME_RunOfsFromCharOfs
(
editor
,
to
,
&
editor
->
pCursors
[
0
].
pRun
,
&
editor
->
pCursors
[
0
].
nOffset
);
return
to
;
}
}
...
...
dlls/riched20/editor.c
View file @
581321d4
...
@@ -1615,70 +1615,17 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
...
@@ -1615,70 +1615,17 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
}
}
case
EM_EXSETSEL
:
case
EM_EXSETSEL
:
{
{
int
start
,
end
;
int
end
;
int
swap
;
CHARRANGE
range
=
*
(
CHARRANGE
*
)
lParam
;
CHARRANGE
range
=
*
(
CHARRANGE
*
)
lParam
;
TRACE
(
"EM_EXSETSEL (%d,%d)
\n
"
,
range
.
cpMin
,
range
.
cpMax
);
TRACE
(
"EM_EXSETSEL (%d,%d)
\n
"
,
range
.
cpMin
,
range
.
cpMax
);
/* all negative values are effectively the same */
if
(
range
.
cpMin
<
0
)
range
.
cpMin
=
-
1
;
if
(
range
.
cpMax
<
0
)
range
.
cpMax
=
-
1
;
if
(
range
.
cpMin
!=
range
.
cpMax
)
{
/* if cpMin is negative and cpMax is positive then selection is */
/* deselected and caret moved to end of the current selection */
if
(
range
.
cpMin
<
0
)
{
ME_GetSelection
(
editor
,
&
start
,
&
end
);
range
.
cpMin
=
end
;
range
.
cpMax
=
end
;
}
else
{
/* adjust cpMax if it's a negative value */
if
(
range
.
cpMax
<
0
)
range
.
cpMax
=
ME_GetTextLength
(
editor
)
+
1
;
/* flip cpMin and cpMax if they are reversed */
if
(
range
.
cpMin
>
range
.
cpMax
)
{
swap
=
range
.
cpMin
;
range
.
cpMin
=
range
.
cpMax
;
range
.
cpMax
=
swap
;
}
/* special case with cpMin too big */
if
(
range
.
cpMin
>
ME_GetTextLength
(
editor
))
{
range
.
cpMin
=
ME_GetTextLength
(
editor
);
range
.
cpMax
=
ME_GetTextLength
(
editor
);
}
/* special case with cpMax too big */
else
if
(
range
.
cpMax
>
ME_GetTextLength
(
editor
))
range
.
cpMax
=
ME_GetTextLength
(
editor
)
+
1
;
}
}
else
{
/* special case with cpMin == cpMax */
/* make sure both values are within bounds */
if
(
range
.
cpMax
<
0
||
range
.
cpMax
>
ME_GetTextLength
(
editor
))
{
range
.
cpMin
=
ME_GetTextLength
(
editor
);
range
.
cpMax
=
range
.
cpMin
;
}
}
ME_InvalidateSelection
(
editor
);
ME_InvalidateSelection
(
editor
);
ME_SetSelection
(
editor
,
range
.
cpMin
,
range
.
cpMax
);
end
=
ME_SetSelection
(
editor
,
range
.
cpMin
,
range
.
cpMax
);
ME_InvalidateSelection
(
editor
);
ME_InvalidateSelection
(
editor
);
ME_SendSelChange
(
editor
);
ME_SendSelChange
(
editor
);
return
range
.
cpMax
;
return
end
;
}
}
case
EM_SHOWSCROLLBAR
:
case
EM_SHOWSCROLLBAR
:
{
{
...
...
dlls/riched20/editor.h
View file @
581321d4
...
@@ -178,7 +178,7 @@ void ME_GetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt);
...
@@ -178,7 +178,7 @@ void ME_GetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt);
void
ME_SetDefaultCharFormat
(
ME_TextEditor
*
editor
,
CHARFORMAT2W
*
mod
);
void
ME_SetDefaultCharFormat
(
ME_TextEditor
*
editor
,
CHARFORMAT2W
*
mod
);
/* caret.c */
/* caret.c */
void
ME_SetSelection
(
ME_TextEditor
*
editor
,
int
from
,
int
to
);
int
ME_SetSelection
(
ME_TextEditor
*
editor
,
int
from
,
int
to
);
void
ME_SelectWord
(
ME_TextEditor
*
editor
);
void
ME_SelectWord
(
ME_TextEditor
*
editor
);
void
ME_HideCaret
(
ME_TextEditor
*
ed
);
void
ME_HideCaret
(
ME_TextEditor
*
ed
);
void
ME_ShowCaret
(
ME_TextEditor
*
ed
);
void
ME_ShowCaret
(
ME_TextEditor
*
ed
);
...
...
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