Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
68acc1df
Commit
68acc1df
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tabs: compute the number of required spaces without iterating
parent
1a4ec6c2
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/text.c
+7
-14
src/text.c
with
7 additions
and
14 deletions
+7
-14
src/text.c
View file @
68acc1df
...
...
@@ -247,25 +247,18 @@ void do_tab(void)
{
#ifndef NANO_TINY
if
(
ISSET
(
TABS_TO_SPACES
))
{
char
*
output
;
size_t
output_len
=
0
,
new_pww
=
xplustabs
(
);
char
*
spaces
=
charalloc
(
tabsize
+
1
)
;
size_t
length
=
tabsize
-
(
xplustabs
()
%
tabsize
);
do
{
new_pww
++
;
output_len
++
;
}
while
(
new_pww
%
tabsize
!=
0
);
charset
(
spaces
,
' '
,
length
);
spaces
[
length
]
=
'\0'
;
output
=
charalloc
(
output_len
+
1
);
do_
output
(
spaces
,
length
,
TRUE
);
charset
(
output
,
' '
,
output_len
);
output
[
output_len
]
=
'\0'
;
do_output
(
output
,
output_len
,
TRUE
);
free
(
output
);
free
(
spaces
);
}
else
#endif
do_output
((
char
*
)
"
\t
"
,
1
,
TRUE
);
do_output
((
char
*
)
"
\t
"
,
1
,
TRUE
);
}
#ifndef NANO_TINY
...
...
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
Menu
Projects
Groups
Snippets
Help