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
3ac37642
Commit
3ac37642
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
screen: check for the most frequent character first: a space
parent
b42887fe
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/winio.c
+13
-14
src/winio.c
with
13 additions
and
14 deletions
+13
-14
src/winio.c
View file @
3ac37642
...
...
@@ -1837,8 +1837,20 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
converted
=
charealloc
(
converted
,
alloc_len
);
}
if
(
*
buf_mb
==
' '
)
{
/* Show a space as a visible character, or as a space. */
#ifndef NANO_TINY
if
(
ISSET
(
WHITESPACE_DISPLAY
))
{
int
i
=
whitespace_len
[
0
];
while
(
i
<
whitespace_len
[
0
]
+
whitespace_len
[
1
])
converted
[
index
++
]
=
whitespace
[
i
++
];
}
else
#endif
converted
[
index
++
]
=
' '
;
start_col
++
;
/* If buf contains a tab character, interpret it. */
if
(
*
buf_mb
==
'\t'
)
{
}
else
if
(
*
buf_mb
==
'\t'
)
{
#ifndef NANO_TINY
if
(
ISSET
(
WHITESPACE_DISPLAY
))
{
int
i
;
...
...
@@ -1869,19 +1881,6 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
start_col
+=
mbwidth
(
ctrl_buf_mb
);
free
(
ctrl_buf_mb
);
/* If buf contains a space character, interpret it. */
}
else
if
(
*
buf_mb
==
' '
)
{
#ifndef NANO_TINY
if
(
ISSET
(
WHITESPACE_DISPLAY
))
{
int
i
;
for
(
i
=
whitespace_len
[
0
];
i
<
whitespace_len
[
0
]
+
whitespace_len
[
1
];
i
++
)
converted
[
index
++
]
=
whitespace
[
i
];
}
else
#endif
converted
[
index
++
]
=
' '
;
start_col
++
;
/* If buf contains a non-control character, interpret it. If buf
* contains an invalid multibyte sequence, display it as such. */
}
else
{
...
...
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