Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
RiscOS
S
Sources
Toolbox
Gadgets
Commits
9e15dd95
Commit
9e15dd95
authored
27 years ago
by
Rob Lougher
Browse files
Options
Download
Email Patches
Plain Diff
Fixed bug in re-composing text after set_font...
parent
bf2d7e5c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
30 deletions
+45
-30
c/TextArea
c/TextArea
+7
-0
c/TextMan
c/TextMan
+38
-30
No files found.
c/TextArea
View file @
9e15dd95
...
...
@@ -922,7 +922,14 @@ textarea_add(TextArea *tdata, int wimpw, ObjectId parent_id,
{
int
f
,
l
,
d
;
#ifdef MemCheck_MEMCHECK
MemCheck_RegisterMiscBlock
(
tdata
->
text
,
strlen
(
tdata
->
text
));
#endif
insert_text
(
tb
->
text
,
tdata
->
text
,
&
f
,
&
l
,
&
d
);
#ifdef MemCheck_MEMCHECK
MemCheck_UnRegisterMiscBlock
(
tdata
->
text
);
#endif
}
*
icons
=
my_icons
;
...
...
This diff is collapsed.
Click to expand it.
c/TextMan
View file @
9e15dd95
...
...
@@ -509,7 +509,7 @@ _kernel_oserror *replace_text(Text *text, int from, int ex_to, const char *s,
{
text
->
insert_gap_end
+=
to
-
insert_pos
+
1
;
text
->
insert_pos
=
insert_pos
=
from
;
text
->
insert_line
=
first_line
;
text
->
insert_line
=
insert_line
=
first_line
;
gap_size
=
text
->
insert_gap_end
-
insert_pos
;
if
((
err
=
extend_block
(
text
->
text_data
,
from
+
gap_size
,
...
...
@@ -562,7 +562,7 @@ _kernel_oserror *replace_text(Text *text, int from, int ex_to, const char *s,
scan
.
split_pos
=
(
char
*
)
1
;
}
end
=
line_end
(
text
,
last_line
)
+
base
+
gap_size
+
delta
;
end
=
last_line
_end
+
base
+
gap_size
+
delta
;
if
((
err
=
scan_text
(
text
,
old_end
+
1
,
end
,
con
,
&
scan
))
!=
NULL
)
return
err
;
}
...
...
@@ -583,6 +583,7 @@ _kernel_oserror *replace_text(Text *text, int from, int ex_to, const char *s,
if
((
err
=
scan_text
(
text
,
start
,
end
,
con
,
&
scan
))
!=
NULL
)
return
err
;
}
if
((
++
last_line
<
text
->
no_of_lines
)
&&
((
*
end
!=
'\n'
)
||
(
start
>
end
)))
{
old_line_no
=
scan
.
line_no
;
...
...
@@ -625,7 +626,7 @@ _kernel_oserror *replace_text(Text *text, int from, int ex_to, const char *s,
ld
++
;
}
if
(
*
end
!=
'\n'
)
if
((
start
>
end
)
||
(
*
end
!=
'\n'
)
)
scan
.
new_lines
[
scan
.
line_no
++
]
=
end
-
con
;
line_delta
=
scan
.
line_no
-
(
last_line
-
first_line
+
1
);
...
...
@@ -652,21 +653,24 @@ _kernel_oserror *replace_text(Text *text, int from, int ex_to, const char *s,
text
->
line_table
[
i
]
+=
delta
;
}
if
(
line_delta
<
0
)
for
(
i
=
last_line
+
1
;
i
<
text
->
no_of_lines
;
i
++
)
{
text
->
line_table
[
i
+
line_delta
]
=
text
->
line_table
[
i
];
text
->
xmax_table
[
i
+
line_delta
]
=
text
->
xmax_table
[
i
];
}
else
if
(
line_delta
!=
0
)
{
int
free
=
text
->
lne_tbl_sze
-
text
->
no_of_lines
-
line_delta
;
if
((
free
<
0
)
&&
((
err
=
grow_lines_by
(
text
,
-
free
))
!=
NULL
))
return
err
;
for
(
i
=
text
->
no_of_lines
-
1
;
i
>
last_line
;
i
--
)
if
(
line_delta
<
0
)
for
(
i
=
last_line
+
1
;
i
<
text
->
no_of_lines
;
i
++
)
{
text
->
line_table
[
i
+
line_delta
]
=
text
->
line_table
[
i
];
text
->
xmax_table
[
i
+
line_delta
]
=
text
->
xmax_table
[
i
];
}
else
{
text
->
line_table
[
i
+
line_delta
]
=
text
->
line_table
[
i
];
text
->
xmax_table
[
i
+
line_delta
]
=
text
->
xmax_table
[
i
];
int
free
=
text
->
lne_tbl_sze
-
text
->
no_of_lines
-
line_delta
;
if
((
free
<
0
)
&&
((
err
=
grow_lines_by
(
text
,
-
free
))
!=
NULL
))
return
err
;
for
(
i
=
text
->
no_of_lines
-
1
;
i
>
last_line
;
i
--
)
{
text
->
line_table
[
i
+
line_delta
]
=
text
->
line_table
[
i
];
text
->
xmax_table
[
i
+
line_delta
]
=
text
->
xmax_table
[
i
];
}
}
}
...
...
@@ -714,6 +718,7 @@ _kernel_oserror *replace_text(Text *text, int from, int ex_to, const char *s,
return
NULL
;
}
_kernel_oserror
*
insert_text
(
Text
*
text
,
char
*
s
,
int
*
first_line_p
,
int
*
last_line_p
,
int
*
line_delta
)
{
...
...
@@ -817,25 +822,28 @@ _kernel_oserror *insert_text(Text *text, char *s,
*
line_delta
=
scan
.
line_no
-
(
last_line
-
first_line
);
*
last_line_p
=
last_line
-
1
;
if
(
*
line_delta
<
0
)
for
(
i
=
last_line
;
i
<
text
->
no_of_lines
;
i
++
)
{
text
->
line_table
[
i
+
*
line_delta
]
=
text
->
line_table
[
i
];
text
->
xmax_table
[
i
+
*
line_delta
]
=
text
->
xmax_table
[
i
];
}
else
if
(
*
line_delta
!=
0
)
{
int
free
=
text
->
lne_tbl_sze
-
text
->
no_of_lines
-
*
line_delta
;
if
((
free
<
0
)
&&
((
err
=
grow_lines_by
(
text
,
-
free
))
!=
NULL
))
return
err
;
for
(
i
=
text
->
no_of_lines
-
1
;
i
>=
last_line
;
i
--
)
if
(
*
line_delta
<
0
)
for
(
i
=
last_line
;
i
<
text
->
no_of_lines
;
i
++
)
{
text
->
line_table
[
i
+
*
line_delta
]
=
text
->
line_table
[
i
];
text
->
xmax_table
[
i
+
*
line_delta
]
=
text
->
xmax_table
[
i
];
}
else
{
text
->
line_table
[
i
+
*
line_delta
]
=
text
->
line_table
[
i
];
text
->
xmax_table
[
i
+
*
line_delta
]
=
text
->
xmax_table
[
i
];
int
free
=
text
->
lne_tbl_sze
-
text
->
no_of_lines
-
*
line_delta
;
if
((
free
<
0
)
&&
((
err
=
grow_lines_by
(
text
,
-
free
))
!=
NULL
))
return
err
;
for
(
i
=
text
->
no_of_lines
-
1
;
i
>=
last_line
;
i
--
)
{
text
->
line_table
[
i
+
*
line_delta
]
=
text
->
line_table
[
i
];
text
->
xmax_table
[
i
+
*
line_delta
]
=
text
->
xmax_table
[
i
];
}
}
}
for
(
i
=
0
;
i
<
scan
.
line_no
;
i
++
)
for
(
i
=
0
;
i
<
scan
.
line_no
;
i
++
)
text
->
line_table
[
first_line
+
i
]
=
scan
.
new_lines
[
i
];
free
(
scan
.
new_lines
);
...
...
This diff is collapsed.
Click to expand it.
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