Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
a532a534
Commit
a532a534
authored
19 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Rename make_string() to make_strings() and have it return an array containing
the text and the attributes.
parent
a38b3d3e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/fseditor.js
+20
-7
20 additions, 7 deletions
exec/fseditor.js
with
20 additions
and
7 deletions
exec/fseditor.js
+
20
−
7
View file @
a532a534
...
...
@@ -686,20 +686,25 @@ function redraw_screen()
}
/*
* Converts the current lines to a single string and returns it...
* soft and colour are bools indicating that soft CRs should become hard, and
* Converts the current lines to a single string and returns and array.
* the array contains two strings... the first string is the text string and the
* second string is the attribute string. If embed_colour is true, the second
* string is blank.
*
* soft and embed_colour are bools indicating that soft CRs should become hard, and
* colour codes should be added
*/
function
make_string
(
soft
,
colour
)
function
make_string
s
(
soft
,
embed_
colour
)
{
var
i
;
var
str
=
''
;
var
attrs
=
''
;
/* ToDo: Do we want to explicitly init the attr if it's normal? */
var
lastattr
=
7
;
var
thisattr
;
for
(
i
=
0
;
i
<
line
.
length
;
i
++
)
{
if
(
colour
)
{
if
(
embed_
colour
)
{
for
(
j
=
0
;
j
<
line
[
i
].
length
;
j
++
)
{
if
((
thisattr
=
ascii
(
line
[
i
].
substr
(
j
,
1
)))
!=
lastattr
)
{
/* Disable HIGH and BLINK if required */
...
...
@@ -773,15 +778,23 @@ function make_string(soft,colour)
}
}
else
{
str
.
=
line
[
i
].
text
;
str
+=
line
[
i
].
text
;
attrs
+=
line
[
i
].
attr
;
}
if
(
soft
||
line
[
i
].
hardcr
)
{
/* Trim whitespace */
str
=
str
.
replace
(
/
\s
*$/
,
''
);
str
=
str
.
replace
(
/
(\s
*
)
$/
,
function
(
str
,
spaces
,
offset
,
s
)
{
if
(
!
embed_colour
)
{
/* Remove attributes for trimmed spaces */
attrs
=
attrs
.
substr
(
0
,
attrs
.
length
-
spaces
.
length
);
}
return
(
''
);
});
str
+=
'
\n
'
;
attrs
+=
attrs
.
substr
(
-
1
);
}
}
return
(
str
);
return
(
[
str
,
attrs
]
);
}
/* ToDo: Optimize movement... */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment