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
f11fe1c7
Commit
f11fe1c7
authored
Aug 28, 2008
by
Dylan Smith
Committed by
Alexandre Julliard
Aug 29, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
richedit: Prevent typing text at end of table row.
parent
36be7210
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
4 deletions
+78
-4
editor.c
dlls/riched20/editor.c
+70
-1
editor.h
dlls/riched20/editor.h
+1
-0
table.c
dlls/riched20/table.c
+7
-3
No files found.
dlls/riched20/editor.c
View file @
f11fe1c7
...
...
@@ -3685,6 +3685,8 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
if
(((
unsigned
)
wstr
)
>=
' '
||
(
wstr
==
'\r'
&&
(
GetWindowLongW
(
hWnd
,
GWL_STYLE
)
&
ES_MULTILINE
))
||
wstr
==
'\t'
)
{
ME_Cursor
cursor
=
editor
->
pCursors
[
0
];
ME_DisplayItem
*
para
=
ME_GetParagraph
(
cursor
.
pRun
);
int
from
,
to
;
BOOL
ctrl_is_down
=
GetKeyState
(
VK_CONTROL
)
&
0x8000
;
ME_GetSelection
(
editor
,
&
from
,
&
to
);
...
...
@@ -3693,7 +3695,6 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
&&
!
(
ctrl_is_down
&&
!
editor
->
bEmulateVersion10
)
)
{
ME_Cursor
cursor
=
editor
->
pCursors
[
0
];
ME_DisplayItem
*
para
;
BOOL
bSelectedRow
=
FALSE
;
...
...
@@ -3712,6 +3713,74 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
ME_CommitUndo
(
editor
);
return
0
;
}
}
else
if
(
!
editor
->
bEmulateVersion10
)
{
/* v4.1 */
if
(
para
->
member
.
para
.
nFlags
&
MEPF_ROWEND
)
{
if
(
wstr
==
'\r'
)
{
/* FIXME: Add a new table row after this row. */
return
0
;
}
else
if
(
from
==
to
)
{
para
=
para
->
member
.
para
.
next_para
;
if
(
para
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
)
para
=
para
->
member
.
para
.
next_para
;
editor
->
pCursors
[
0
].
pRun
=
ME_FindItemFwd
(
para
,
diRun
);
editor
->
pCursors
[
0
].
nOffset
=
0
;
editor
->
pCursors
[
1
]
=
editor
->
pCursors
[
0
];
}
}
else
if
(
para
==
ME_GetParagraph
(
editor
->
pCursors
[
1
].
pRun
)
&&
cursor
.
nOffset
+
cursor
.
pRun
->
member
.
run
.
nCharOfs
==
0
&&
para
->
member
.
para
.
prev_para
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
&&
!
para
->
member
.
para
.
prev_para
->
member
.
para
.
nCharOfs
)
{
/* FIXME: Insert a newline before the table. */
}
}
else
{
/* v1.0 - 3.0 */
ME_DisplayItem
*
para
=
ME_GetParagraph
(
cursor
.
pRun
);
if
(
ME_IsInTable
(
cursor
.
pRun
))
{
if
(
cursor
.
pRun
->
member
.
run
.
nFlags
&
MERF_ENDPARA
)
{
if
(
from
==
to
)
{
if
(
wstr
==
'\r'
)
{
ME_ContinueCoalescingTransaction
(
editor
);
para
=
ME_AppendTableRow
(
editor
,
para
);
editor
->
pCursors
[
0
].
pRun
=
ME_FindItemFwd
(
para
,
diRun
);
editor
->
pCursors
[
0
].
nOffset
=
0
;
editor
->
pCursors
[
1
]
=
editor
->
pCursors
[
0
];
ME_CommitCoalescingUndo
(
editor
);
ME_UpdateRepaint
(
editor
);
}
else
{
/* Text should not be inserted at the end of the table. */
MessageBeep
(
-
1
);
}
return
0
;
}
}
else
if
(
wstr
==
'\r'
)
{
ME_ContinueCoalescingTransaction
(
editor
);
if
(
cursor
.
pRun
->
member
.
run
.
nCharOfs
+
cursor
.
nOffset
==
0
&&
!
ME_IsInTable
(
para
->
member
.
para
.
prev_para
))
{
/* Insert newline before table */
WCHAR
endl
=
'\r'
;
cursor
.
pRun
=
ME_FindItemBack
(
para
,
diRun
);
if
(
cursor
.
pRun
)
editor
->
pCursors
[
0
].
pRun
=
cursor
.
pRun
;
editor
->
pCursors
[
0
].
nOffset
=
0
;
editor
->
pCursors
[
1
]
=
editor
->
pCursors
[
0
];
ME_InsertTextFromCursor
(
editor
,
0
,
&
endl
,
1
,
editor
->
pCursors
[
0
].
pRun
->
member
.
run
.
style
);
}
else
{
editor
->
pCursors
[
1
]
=
editor
->
pCursors
[
0
];
para
=
ME_AppendTableRow
(
editor
,
para
);
editor
->
pCursors
[
0
].
pRun
=
ME_FindItemFwd
(
para
,
diRun
);
editor
->
pCursors
[
0
].
nOffset
=
0
;
editor
->
pCursors
[
1
]
=
editor
->
pCursors
[
0
];
}
ME_CommitCoalescingUndo
(
editor
);
ME_UpdateRepaint
(
editor
);
return
0
;
}
}
}
/* FIXME maybe it would make sense to call EM_REPLACESEL instead ? */
/* WM_CHAR is restricted to nTextLimit */
...
...
dlls/riched20/editor.h
View file @
f11fe1c7
...
...
@@ -296,6 +296,7 @@ ME_DisplayItem *ME_GetTableRowEnd(ME_DisplayItem *para);
ME_DisplayItem
*
ME_GetTableRowStart
(
ME_DisplayItem
*
para
);
void
ME_CheckTablesForCorruption
(
ME_TextEditor
*
editor
);
void
ME_ProtectPartialTableDeletion
(
ME_TextEditor
*
editor
,
int
nOfs
,
int
*
nChars
);
ME_DisplayItem
*
ME_AppendTableRow
(
ME_TextEditor
*
editor
,
ME_DisplayItem
*
table_row
);
void
ME_TabPressedInTable
(
ME_TextEditor
*
editor
,
BOOL
bSelectedRow
);
struct
RTFTable
*
ME_MakeTableDef
(
ME_TextEditor
*
editor
);
void
ME_InitTableDef
(
ME_TextEditor
*
editor
,
struct
RTFTable
*
tableDef
);
...
...
dlls/riched20/table.c
View file @
f11fe1c7
...
...
@@ -381,8 +381,8 @@ void ME_ProtectPartialTableDeletion(ME_TextEditor *editor, int nOfs,int *nChars)
}
}
static
ME_DisplayItem
*
ME_AppendTableRow
(
ME_TextEditor
*
editor
,
ME_DisplayItem
*
table_row
)
ME_DisplayItem
*
ME_AppendTableRow
(
ME_TextEditor
*
editor
,
ME_DisplayItem
*
table_row
)
{
WCHAR
endl
=
'\r'
,
tab
=
'\t'
;
ME_DisplayItem
*
run
;
...
...
@@ -390,9 +390,13 @@ static ME_DisplayItem* ME_AppendTableRow(ME_TextEditor *editor,
int
i
;
assert
(
table_row
);
assert
(
table_row
->
type
==
diParagraph
);
if
(
!
editor
->
bEmulateVersion10
)
{
/* v4.1 */
ME_DisplayItem
*
insertedCell
,
*
para
,
*
cell
;
cell
=
ME_FindItemFwd
(
table_row
,
diCell
);
if
(
table_row
->
member
.
para
.
nFlags
&
MEPF_ROWEND
)
cell
=
ME_FindItemBack
(
table_row
,
diCell
);
else
cell
=
ME_FindItemFwd
(
table_row
,
diCell
);
run
=
ME_GetTableRowEnd
(
table_row
)
->
member
.
para
.
next_para
;
run
=
ME_FindItemFwd
(
run
,
diRun
);
editor
->
pCursors
[
0
].
pRun
=
run
;
...
...
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