Compare commits

...

24 Commits
v4.1 ... v4.2

Author SHA1 Message Date
Benno Schulenberg
e92c3110a1 po: update translations and regenerate POT file and PO files 2019-04-24 11:08:23 +02:00
Benno Schulenberg
1ca9241eaa bump version numbers and add a news item for the 4.2 release 2019-04-24 10:55:23 +02:00
Benno Schulenberg
0b6889cbd8 tweaks: rename another function, to be distinct and fitting 2019-04-24 10:52:49 +02:00
Benno Schulenberg
00410d83fc tweaks: rename a function, to be distinct and fitting
It was hard to remember that the "pt" stood for "plus tabs", and the
"len" seemed to say it was about number of bytes instead of columns.
2019-04-24 10:52:35 +02:00
Benno Schulenberg
fcad442d80 tweaks: declare a function as const and let its allocated string leak
Avoiding this leak is more trouble than it's worth: invocation_error()
will be called seldomly, and when it is called, the user will probably
quickly exit from nano to fix things.

Also declare the speller functions as const again, so they don't give
the impression that their result can be freed.

Suggested-by: Brand Huntsman <alpha@qzx.com>
2019-04-23 12:07:56 +02:00
Benno Schulenberg
34d22d3f00 wrapping: improve the persistence of the prepending behavior
Now you can have a look elsewhere in the buffer (and even delete
or paste stuff there) and when you return to the original line
and continue typing, any spillover from automatic hard-wrapping
will spill over onto the same line it spilled over to before.

You can even switch to a different buffer and return and continue
typing, and stuff will still spill over to the same line.

In the bargain, this gets rid of a bit of flag-resetting code
that was run for many keystrokes, in most cases needlessly.

This addresses https://savannah.gnu.org/bugs/?56189.
2019-04-23 10:20:12 +02:00
Benno Schulenberg
1326af7eae tweaks: drop an unneeded saving and restoring of a variable
Since commit aa1ae0a1, from three years ago, do_next_word() no longer
changes 'placewewant'.
2019-04-23 10:18:46 +02:00
Benno Schulenberg
11aa191bdc tweaks: rename a variable, to distinguish it from a browser function 2019-04-22 19:58:43 +02:00
Benno Schulenberg
ea844d28fe tweaks: exclude a bit more code from a single-buffer build 2019-04-22 19:38:19 +02:00
Benno Schulenberg
7668bfe6f2 tweaks: remove a redundant, enclosed #ifdef 2019-04-22 19:18:29 +02:00
Benno Schulenberg
493f215513 speller: do not crash by trying to free something that cannot be freed
Most of the returned error messages are fixed strings, not allocated
strings.

This fixes https://savannah.gnu.org/bugs/?56188.
Reported-by: Aliaksei Sakovets <alexeysakovets@gmail.com>

Bug existed since version 4.1, commit f645009a.
2019-04-22 11:32:03 +02:00
Benno Schulenberg
723451a5ce tweaks: adjust a few comments and some indentation 2019-04-21 11:58:08 +02:00
Benno Schulenberg
326e41d799 tweaks: elide an unneeded intermediate variable 2019-04-21 11:41:54 +02:00
Benno Schulenberg
3ce74eb8fe wrapping: compute the width of a succeeding line in the correct manner
Its number of columns needs to be computed, not its number of bytes.
2019-04-21 11:39:06 +02:00
Benno Schulenberg
ec4883b6a9 tweaks: remove an unneeded condition
The 'prepend_wrap' flag gets set to TRUE only when there is a next line,
and it can remain TRUE only when the cursor stays on the current line.
2019-04-21 11:26:00 +02:00
Benno Schulenberg
e8f69e40d1 wrapping: add a missing space only when the remainder will be prepended
When automatic hard-wrapping causes some piece of a line to be pushed
to the next line, then a separating space needs to be added at the tail
of this piece only when this piece actually gets prepended.

This fixes https://savannah.gnu.org/bugs/?56185.

Bug existed since version 2.9.2, commit 29f7654a.
2019-04-21 10:35:11 +02:00
Benno Schulenberg
297fb013cb wrapping: trim any trailing blanks when cursor goes to next line
When typing a space causes both the succeeding word and the cursor to
be pushed to the next line, then this space (and any contiguous ones)
does need to be snipped (when --trimblanks is in effect).

This fixes https://savannah.gnu.org/bugs/?56180.

Bug existed since version 2.9.3, commit 91073be4.
2019-04-21 09:31:18 +02:00
Benno Schulenberg
4e52c75568 options: make --breaklonglines work also when --ignorercfiles is used
This fixes https://savannah.gnu.org/bugs/?56179.

Bug existed since version 4.1, commit 167a8e5c.
2019-04-20 14:04:07 +02:00
Benno Schulenberg
192a303e40 tweaks: condense and improve a handful of comments 2019-04-20 14:00:07 +02:00
Benno Schulenberg
dcec8a4112 tweaks: rename a variable, for a little more meaning 2019-04-19 10:10:14 +02:00
Benno Schulenberg
5316f5078f tweaks: elide an unneeded variable
After a line break, the preceding line is readily available through
the 'prev' element.
2019-04-19 10:06:57 +02:00
Benno Schulenberg
286c877853 tweaks: elide an unneeded parameter, as the function already assumes it
The do_wrap() function always gets 'openfile->current' as parameter,
and, internally, it assumes that it is handling the current line.
2019-04-19 09:47:21 +02:00
Benno Schulenberg
8613285321 build: be more specific and avoid committing accidentally changed files 2019-04-16 10:23:16 +02:00
Benno Schulenberg
8a4639cdd6 docs: put the 'set guidestripe' option into its alphabetical position 2019-04-16 10:05:35 +02:00
59 changed files with 15767 additions and 15763 deletions

View File

@@ -1,3 +1,32 @@
Changes between v4.1 and v4.2:
------------------------------
Benno Schulenberg (23):
build: be more specific and avoid committing accidentally changed files
bump version numbers and add a news item for the 4.2 release
docs: put the 'set guidestripe' option into its alphabetical position
options: make --breaklonglines work also when --ignorercfiles is used
speller: do not crash by trying to free something that cannot be freed
tweaks: adjust a few comments and some indentation
tweaks: condense and improve a handful of comments
tweaks: declare a function as const and let its allocated string leak
tweaks: drop an unneeded saving and restoring of a variable
tweaks: elide an unneeded intermediate variable
tweaks: elide an unneeded parameter, as the function already assumes it
tweaks: elide an unneeded variable
tweaks: exclude a bit more code from a single-buffer build
tweaks: remove an unneeded condition
tweaks: remove a redundant, enclosed #ifdef
tweaks: rename a function, to be distinct and fitting
tweaks: rename another function, to be distinct and fitting
tweaks: rename a variable, for a little more meaning
tweaks: rename a variable, to distinguish it from a browser function
wrapping: add a missing space only when the remainder will be prepended
wrapping: compute the width of a succeeding line in the correct manner
wrapping: improve the persistence of the prepending behavior
wrapping: trim any trailing blanks when cursor goes to next line
Changes between v4.0 and v4.1:
------------------------------

8
NEWS
View File

@@ -1,3 +1,9 @@
2019.04.24 - GNU nano 4.2 "Tax the rich, pay the teachers"
• The integrated spell checker does not crash when 'spell' is missing.
• Option --breaklonglines works also when --ignorercfiles is used.
• Automatic hard-wrapping is more persistent in pushing words to the
same overflow line.
2019.04.15 - GNU nano 4.1 "Qué corchos será eso?"
• By default, a newline character is again automatically added at the
end of a buffer, to produce valid POSIX text files by default, but
@@ -27,7 +33,7 @@
• Option --guidestripe=<number> draws a vertical bar at the given column.
• Option --fill=<number> no longer turns on automatic hard-wrapping.
• When a line continues offscreen, it now ends with a highlighted ">".
• The halfs of a split two-column character are shown as "[" and "]".
• The halves of a split two-column character are shown as "[" and "]".
• A line now scrolls horizontally one column earlier.
• The bindable functions 'cutwordleft' and 'cutwordright' were renamed
to 'chopwordleft' and 'chopwordright' as they don't use the cutbuffer.

View File

@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see https://www.gnu.org/licenses/.
AC_INIT([GNU nano], [4.1], [nano-devel@gnu.org], [nano])
AC_INIT([GNU nano], [4.2], [nano-devel@gnu.org], [nano])
AC_CONFIG_SRCDIR([src/nano.c])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([1.14])

View File

@@ -85,7 +85,7 @@
<h3><a name="1.3"></a>1.3. Why the name change from TIP?</h3>
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program &quot;establishes a full duplex terminal connection to a remote host&quot;, and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
<h3><a name="1.4"></a>1.4. What is the current version of nano?</h3>
<blockquote><p>The current version of nano <i>should</i> be <b>4.1</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
<blockquote><p>The current version of nano <i>should</i> be <b>4.2</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
<h3><a name="1.5"></a>1.5. I want to read the man page without having to download the program!</h3>
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="https://nano-editor.org/dist/latest/nano.1.html">here</a>.</p></blockquote>
<hr width="100%">

View File

@@ -16,7 +16,7 @@
.\" Documentation License along with this program. If not, see
.\" <https://www.gnu.org/licenses/>.
.\"
.TH NANO 1 "version 4.1" "April 2019"
.TH NANO 1 "version 4.2" "April 2019"
.SH NAME
nano \- Nano's ANOther editor, inspired by Pico

View File

@@ -8,7 +8,7 @@
@smallbook
@set EDITION 0.5
@set VERSION 4.1
@set VERSION 4.2
@set UPDATED April 2019
@dircategory Editors
@@ -23,7 +23,7 @@
@titlepage
@title GNU @command{nano}
@subtitle a small and friendly text editor
@subtitle version 4.1
@subtitle version 4.2
@author Chris Allegretta
@page
@@ -63,7 +63,7 @@ e-mail: @email{chrisa@@asty.org}@*
@node Top
@top
This manual documents the GNU @command{nano} editor, version 4.1.
This manual documents the GNU @command{nano} editor, version 4.2.
@menu
* Introduction::
@@ -785,6 +785,10 @@ Valid names for foreground and background color are:
The name of the foreground color may be prefixed with @code{bright}.
And either @var{fgcolor} or ,@var{bgcolor} may be left out.
@item set guidestripe @var{number}
Draw a vertical stripe at the given column, to help judge the width of the
text. (The color of the stripe can be changed with @code{set stripecolor}.)
@item set historylog
Save the last hundred search strings and replacement strings and
executed commands, so they can be easily reused in later sessions.
@@ -803,10 +807,6 @@ Display line numbers to the left of the text area.
@item set locking
Enable vim-style lock-files for when editing files.
@item set guidestripe @var{number}
Draw a vertical stripe at the given column, to help judge the width of the
text. (The color of the stripe can be changed with @code{set stripecolor}.)
@item set matchbrackets "@var{string}"
Set the opening and closing brackets that can be found by bracket
searches. This may not include blank characters. The opening set must

View File

@@ -16,7 +16,7 @@
.\" Documentation License along with this program. If not, see
.\" <https://www.gnu.org/licenses/>.
.\"
.TH NANORC 5 "version 4.1" "April 2019"
.TH NANORC 5 "version 4.2" "April 2019"
.SH NAME
nanorc \- GNU nano's configuration file
@@ -132,6 +132,10 @@ Specify the color combination to use for the function descriptions
in the two help lines at the bottom of the screen.
See \fBset titlecolor\fR for more details.
.TP
.B set guidestripe \fInumber
Draw a vertical stripe at the given column, to help judge the width of the
text. (The color of the stripe can be changed with \fBset stripecolor\fR.)
.TP
.B set historylog
Save the last hundred search strings and replacement strings and
executed commands, so they can be easily reused in later sessions.
@@ -150,10 +154,6 @@ Display line numbers to the left of the text area.
.B set locking
Enable vim-style lock-files for when editing files.
.TP
.B set guidestripe \fInumber
Draw a vertical stripe at the given column, to help judge the width of the
text. (The color of the stripe can be changed with \fBset stripecolor\fR.)
.TP
.B set matchbrackets "\fIstring\fP"
Set the opening and closing brackets that can be found by bracket
searches. This may not include blank characters. The opening set must

View File

@@ -16,7 +16,7 @@
.\" Documentation License along with this program. If not, see
.\" <https://www.gnu.org/licenses/>.
.\"
.TH RNANO 1 "version 4.1" "April 2019"
.TH RNANO 1 "version 4.2" "April 2019"
.SH NAME
rnano \- a restricted nano

870
po/bg.po

File diff suppressed because it is too large Load Diff

940
po/ca.po

File diff suppressed because it is too large Load Diff

844
po/cs.po

File diff suppressed because it is too large Load Diff

844
po/da.po

File diff suppressed because it is too large Load Diff

844
po/de.po

File diff suppressed because it is too large Load Diff

844
po/eo.po

File diff suppressed because it is too large Load Diff

844
po/es.po

File diff suppressed because it is too large Load Diff

870
po/eu.po

File diff suppressed because it is too large Load Diff

844
po/fi.po

File diff suppressed because it is too large Load Diff

844
po/fr.po

File diff suppressed because it is too large Load Diff

844
po/ga.po

File diff suppressed because it is too large Load Diff

844
po/gl.po

File diff suppressed because it is too large Load Diff

844
po/hr.po

File diff suppressed because it is too large Load Diff

844
po/hu.po

File diff suppressed because it is too large Load Diff

870
po/id.po

File diff suppressed because it is too large Load Diff

844
po/it.po

File diff suppressed because it is too large Load Diff

844
po/ja.po

File diff suppressed because it is too large Load Diff

844
po/ko.po

File diff suppressed because it is too large Load Diff

870
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

844
po/nb.po

File diff suppressed because it is too large Load Diff

844
po/nl.po

File diff suppressed because it is too large Load Diff

870
po/nn.po

File diff suppressed because it is too large Load Diff

1162
po/pl.po

File diff suppressed because it is too large Load Diff

844
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1003
po/ro.po

File diff suppressed because it is too large Load Diff

856
po/ru.po

File diff suppressed because it is too large Load Diff

856
po/sl.po

File diff suppressed because it is too large Load Diff

844
po/sr.po

File diff suppressed because it is too large Load Diff

844
po/sv.po

File diff suppressed because it is too large Load Diff

844
po/tr.po

File diff suppressed because it is too large Load Diff

844
po/uk.po

File diff suppressed because it is too large Load Diff

844
po/vi.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
#!/bin/bash
VERSION="4.1"
VERSION="4.2"
./configure -C --enable-tiny && make && ./configure -C &&
@@ -12,8 +12,8 @@ po/update_linguas.sh &&
make distcheck && make dist-xz &&
git add po/*.po &&
git commit -a -m "$(git log -1 --grep 'po: up' | grep o: | sed 's/^ //')" &&
git add po/*.po po/nano.pot &&
git commit -m "$(git log -1 --grep 'po: up' | grep o: | sed 's/^ //')" &&
gpg -a -b nano-$VERSION.tar.gz &&
gpg -a -b nano-$VERSION.tar.xz &&

View File

@@ -400,7 +400,7 @@ void read_the_list(const char *path, DIR *dir)
/* Find the length of the longest filename in the current folder. */
while ((nextdir = readdir(dir)) != NULL) {
size_t name_len = strlenpt(nextdir->d_name);
size_t name_len = breadth(nextdir->d_name);
if (name_len > longest)
longest = name_len;
@@ -518,7 +518,7 @@ void browser_refresh(void)
struct stat st;
const char *thename = tail(filelist[i]);
/* The filename we display, minus the path. */
size_t namelen = strlenpt(thename);
size_t namelen = breadth(thename);
/* The length of the filename in columns. */
size_t infolen;
/* The length of the file information in columns. */
@@ -598,7 +598,7 @@ void browser_refresh(void)
}
/* Make sure info takes up no more than infomaxlen columns. */
infolen = strlenpt(info);
infolen = breadth(info);
if (infolen > infomaxlen) {
info[actual_x(info, infomaxlen)] = '\0';
infolen = infomaxlen;
@@ -672,7 +672,7 @@ int filesearch_init(bool forwards)
thedefault = charalloc(strlen(disp) + 7);
/* We use (COLS / 3) here because we need to see more on the line. */
sprintf(thedefault, " [%s%s]", disp,
(strlenpt(last_search) > COLS / 3) ? "..." : "");
(breadth(last_search) > COLS / 3) ? "..." : "");
free(disp);
} else
thedefault = mallocstrcpy(NULL, "");

View File

@@ -64,26 +64,25 @@ void make_new_buffer(void)
{
openfilestruct *newnode = nmalloc(sizeof(openfilestruct));
#ifdef ENABLE_MULTIBUFFER
if (openfile == NULL) {
/* Make the first open file the only element in the list. */
#ifdef ENABLE_MULTIBUFFER
newnode->prev = newnode;
newnode->next = newnode;
#endif
firstfile = newnode;
startfile = newnode;
} else {
/* Add the new open file after the current one in the list. */
#ifdef ENABLE_MULTIBUFFER
newnode->prev = openfile;
newnode->next = openfile->next;
openfile->next->prev = newnode;
openfile->next = newnode;
#endif
/* There is more than one file open: show "Close" in help lines. */
exitfunc->desc = close_tag;
more_than_one = !inhelp || more_than_one;
}
#endif
/* Make the new buffer the current one, and start initializing it. */
openfile = newnode;
@@ -95,6 +94,9 @@ void make_new_buffer(void)
openfile->current_y = 0;
openfile->modified = FALSE;
#ifdef ENABLE_WRAPPING
openfile->spillage_line = NULL;
#endif
#ifndef NANO_TINY
openfile->mark = NULL;
@@ -353,13 +355,13 @@ int do_lockfile(const char *filename)
/* TRANSLATORS: The second %s is the name of the user, the third that of the editor. */
question = _("File %s is being edited (by %s with %s, PID %s); continue?");
room = COLS - strlenpt(question) + 7 - strlenpt(lockuser) -
strlenpt(lockprog) - strlenpt(pidstring);
room = COLS - breadth(question) + 7 - breadth(lockuser) -
breadth(lockprog) - breadth(pidstring);
if (room < 4)
postedname = mallocstrcpy(NULL, "_");
else if (room < strlenpt(filename)) {
else if (room < breadth(filename)) {
char *fragment = display_string(filename,
strlenpt(filename) - room + 3, room, FALSE, FALSE);
breadth(filename) - room + 3, room, FALSE, FALSE);
postedname = charalloc(strlen(fragment) + 4);
strcpy(postedname, "...");
strcat(postedname, fragment);
@@ -2264,7 +2266,7 @@ int do_writeout(bool exiting, bool withprompt)
if (name_exists) {
char *question = _("File \"%s\" exists; OVERWRITE? ");
char *name = display_string(answer, 0,
COLS - strlenpt(question) + 1, FALSE, FALSE);
COLS - breadth(question) + 1, FALSE, FALSE);
char *message = charalloc(strlen(question) +
strlen(name) + 1);
@@ -2681,7 +2683,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
/* Find the length of the longest among the choices. */
for (match = 0; match < num_matches; match++) {
size_t namelen = strlenpt(matches[match]);
size_t namelen = breadth(matches[match]);
if (namelen > longest_name)
longest_name = namelen;

View File

@@ -127,8 +127,10 @@ partition *filepart = NULL;
/* The "partition" where we store a portion of the current file. */
openfilestruct *openfile = NULL;
/* The list of all open file buffers. */
openfilestruct *firstfile = NULL;
#ifdef ENABLE_MULTIBUFFER
openfilestruct *startfile = NULL;
/* The first open buffer. */
#endif
#ifndef NANO_TINY
char *matchbrackets = NULL;

View File

@@ -610,7 +610,7 @@ size_t help_line_len(const char *ptr)
length = move_mbright(ptr, length);
/* If the entire line will just fit the screen, don't wrap it. */
if (strnlenpt(ptr, length) <= wrapping_point + 1)
if (wideness(ptr, length) <= wrapping_point + 1)
return length;
else if (wrap_location > 0)
return wrap_location;

View File

@@ -75,7 +75,7 @@ size_t proper_x(linestruct *line, size_t *leftedge, bool forward,
#ifndef NANO_TINY
if (ISSET(SOFTWRAP) && line->data[index] == '\t' &&
((forward && strnlenpt(line->data, index) < *leftedge) ||
((forward && wideness(line->data, index) < *leftedge) ||
(!forward && column / tabsize == (*leftedge - 1) / tabsize &&
column / tabsize < (*leftedge + editwincols - 1) / tabsize))) {
index++;
@@ -85,7 +85,7 @@ size_t proper_x(linestruct *line, size_t *leftedge, bool forward,
}
if (ISSET(SOFTWRAP))
*leftedge = leftedge_for(strnlenpt(line->data, index), line);
*leftedge = leftedge_for(wideness(line->data, index), line);
#endif
return index;

View File

@@ -131,6 +131,11 @@ void unlink_node(linestruct *fileptr)
/* Free the data structures in the given node. */
void delete_node(linestruct *fileptr)
{
#ifdef ENABLE_WRAPPING
/* If the spill-over line for hard-wrapping is deleted... */
if (fileptr == openfile->spillage_line)
openfile->spillage_line = NULL;
#endif
free(fileptr->data);
#ifdef ENABLE_COLOR
free(fileptr->multidata);
@@ -493,13 +498,12 @@ void copy_from_buffer(linestruct *somebuffer)
/* Unlink a node from the rest of the circular list, and delete it. */
void unlink_opennode(openfilestruct *fileptr)
{
#ifdef ENABLE_MULTIBUFFER
if (fileptr == firstfile)
firstfile = firstfile->next;
if (fileptr == startfile)
startfile = startfile->next;
fileptr->prev->next = fileptr->next;
fileptr->next->prev = fileptr->prev;
#endif
delete_opennode(fileptr);
}
@@ -516,7 +520,7 @@ void delete_opennode(openfilestruct *fileptr)
#endif
free(fileptr);
}
#endif
#endif /* ENABLE_MULTIBUFFER */
/* Display a warning about a key disabled in view mode. */
void print_view_warning(void)
@@ -737,13 +741,13 @@ void mouse_init(void)
void print_opt(const char *shortflag, const char *longflag, const char *desc)
{
printf(" %s\t", shortflag);
if (strlenpt(shortflag) < 8)
if (breadth(shortflag) < 8)
printf("\t");
printf("%s\t", longflag);
if (strlenpt(longflag) < 8)
if (breadth(longflag) < 8)
printf("\t\t");
else if (strlenpt(longflag) < 16)
else if (breadth(longflag) < 16)
printf("\t");
printf("%s\n", _(desc));
@@ -1781,9 +1785,6 @@ void do_input(void)
} else
#endif
{
#ifdef ENABLE_WRAPPING
linestruct *was_next = openfile->current->next;
#endif
#ifndef NANO_TINY
linestruct *was_current = openfile->current;
size_t was_x = openfile->current_x;
@@ -1813,14 +1814,6 @@ void do_input(void)
also_the_last = FALSE;
}
#endif
#ifdef ENABLE_WRAPPING
/* If the cursor moved to another line and this was not caused
* by adding characters to the buffer, clear the prepend flag. */
if (openfile->current->next != was_next &&
shortcut->func != do_tab &&
shortcut->func != do_verbatim_input)
wrap_reset();
#endif
#ifdef ENABLE_COLOR
if (!refresh_needed && !okay_for_view(shortcut))
check_the_multis(openfile->current);
@@ -1920,7 +1913,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
#ifdef ENABLE_WRAPPING
/* If text gets wrapped, the edit window needs a refresh. */
if (ISSET(BREAK_LONG_LINES) && do_wrap(openfile->current))
if (ISSET(BREAK_LONG_LINES) && do_wrap())
refresh_needed = TRUE;
#endif
}
@@ -2437,14 +2430,14 @@ int main(int argc, char **argv)
/* Simply OR the boolean flags from rcfile and command line. */
for (size_t i = 0; i < sizeof(flags) / sizeof(flags[0]); i++)
flags[i] |= flags_cmdline[i];
if (hardwrap == 0)
UNSET(BREAK_LONG_LINES);
else if (hardwrap == 1)
SET(BREAK_LONG_LINES);
}
#endif /* ENABLE_NANORC */
if (hardwrap == 0)
UNSET(BREAK_LONG_LINES);
else if (hardwrap == 1)
SET(BREAK_LONG_LINES);
/* If the user wants bold instead of reverse video for hilited text... */
if (ISSET(BOLD_TEXT))
hilite_attribute = A_BOLD;

View File

@@ -383,6 +383,10 @@ typedef struct openfilestruct {
/* Whether the file has been modified. */
struct stat *current_stat;
/* The file's current stat information. */
#ifdef ENABLE_WRAPPING
linestruct *spillage_line;
/* The line for prepending stuff to during automatic hard-wrapping. */
#endif
#ifndef NANO_TINY
linestruct *mark;
/* The line in the file where the mark is set; NULL if not set. */

View File

@@ -37,13 +37,13 @@ int do_statusbar_mouse(void)
/* We can click on the statusbar window text to move the cursor. */
if (retval == 0 && wmouse_trafo(bottomwin, &click_row, &click_col, FALSE)) {
size_t start_col = strlenpt(prompt) + 2;
size_t start_col = breadth(prompt) + 2;
/* Move to where the click occurred. */
if (click_row == 0 && click_col >= start_col)
typing_x = actual_x(answer,
get_statusbar_page_start(start_col, start_col +
strnlenpt(answer, typing_x)) + click_col - start_col);
wideness(answer, typing_x)) + click_col - start_col);
}
return retval;
@@ -385,12 +385,12 @@ void put_cursor_at_end_of_answer(void)
/* Redraw the promptbar and place the cursor at the right spot. */
void draw_the_promptbar(void)
{
size_t base = strlenpt(prompt) + 2;
size_t base = breadth(prompt) + 2;
size_t the_page, end_page, column;
char *expanded;
the_page = get_statusbar_page_start(base, base + strnlenpt(answer, typing_x));
end_page = get_statusbar_page_start(base, base + strlenpt(answer) - 1);
the_page = get_statusbar_page_start(base, base + wideness(answer, typing_x));
end_page = get_statusbar_page_start(base, base + breadth(answer) - 1);
/* Color the promptbar over its full width. */
wattron(bottomwin, interface_color_pair[TITLE_BAR]);
@@ -404,7 +404,7 @@ void draw_the_promptbar(void)
waddstr(bottomwin, expanded);
free(expanded);
if (base + strlenpt(answer) != COLS && the_page < end_page)
if (base + breadth(answer) != COLS && the_page < end_page)
mvwaddch(bottomwin, 0, COLS - 1, '>');
wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
@@ -414,7 +414,7 @@ void draw_the_promptbar(void)
wrefresh(bottomwin);
/* Place the cursor at the right spot. */
column = base + strnlenpt(answer, typing_x);
column = base + wideness(answer, typing_x);
wmove(bottomwin, 0, column - get_statusbar_page_start(base, column));
wnoutrefresh(bottomwin);
}

View File

@@ -98,7 +98,9 @@ extern bool keep_cutbuffer;
extern partition *filepart;
extern openfilestruct *openfile;
extern openfilestruct *firstfile;
#ifdef ENABLE_MULTIBUFFER
extern openfilestruct *startfile;
#endif
#ifndef NANO_TINY
extern char *matchbrackets;
@@ -523,8 +525,7 @@ void update_multiline_undo(ssize_t lineno, char *indentation);
void update_undo(undo_type action);
#endif /* !NANO_TINY */
#ifdef ENABLE_WRAPPING
void wrap_reset(void);
bool do_wrap(linestruct *line);
bool do_wrap(void);
#endif
#if defined(ENABLE_HELP) || defined(ENABLED_WRAPORJUSTIFY)
ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl);
@@ -579,8 +580,8 @@ char *free_and_assign(char *dest, char *src);
size_t get_page_start(size_t column);
size_t xplustabs(void);
size_t actual_x(const char *text, size_t column);
size_t strnlenpt(const char *text, size_t maxlen);
size_t strlenpt(const char *text);
size_t wideness(const char *text, size_t maxlen);
size_t breadth(const char *text);
void new_magicline(void);
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
void remove_magicline(void);

View File

@@ -1135,7 +1135,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
} else
matchbrackets = option;
} else if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
if (mbstrlen(option) != 2 || strlenpt(option) != 2) {
if (mbstrlen(option) != 2 || breadth(option) != 2) {
rcfile_error(N_("Two single-column characters required"));
free(option);
} else {

View File

@@ -88,7 +88,7 @@ void search_init(bool replacing, bool keep_the_answer)
thedefault = charalloc(strlen(disp) + 7);
/* We use (COLS / 3) here because we need to see more on the line. */
sprintf(thedefault, " [%s%s]", disp,
(strlenpt(last_search) > COLS / 3) ? "..." : "");
(breadth(last_search) > COLS / 3) ? "..." : "");
free(disp);
} else
thedefault = mallocstrcpy(NULL, "");
@@ -389,7 +389,7 @@ void do_findnext(void)
void not_found_msg(const char *str)
{
char *disp = display_string(str, 0, (COLS / 2) + 1, FALSE, FALSE);
size_t numchars = actual_x(disp, strnlenpt(disp, COLS / 2));
size_t numchars = actual_x(disp, wideness(disp, COLS / 2));
statusline(HUSH, _("\"%.*s%s\" not found"), numchars, disp,
(disp[numchars] == '\0') ? "" : "...");
@@ -577,7 +577,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
if (!replaceall) {
spotlighted = TRUE;
light_from_col = xplustabs();
light_to_col = strnlenpt(openfile->current->data,
light_to_col = wideness(openfile->current->data,
openfile->current_x + match_len);
/* Refresh the edit window, scrolling it if necessary. */
@@ -810,7 +810,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
/* Take a negative column number to mean: from the end of the line. */
if (column < 0)
column = strlenpt(openfile->current->data) + column + 2;
column = breadth(openfile->current->data) + column + 2;
if (column < 1)
column = 1;
@@ -820,8 +820,8 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
#ifndef NANO_TINY
if (ISSET(SOFTWRAP) && openfile->placewewant / editwincols >
strlenpt(openfile->current->data) / editwincols)
openfile->placewewant = strlenpt(openfile->current->data);
breadth(openfile->current->data) / editwincols)
openfile->placewewant = breadth(openfile->current->data);
#endif
/* When the position was manually given, center the target line. */

View File

@@ -35,11 +35,6 @@
static pid_t pid_of_command = -1;
/* The PID of the forked process -- needed when wanting to abort it. */
#endif
#ifdef ENABLE_WRAPPING
static bool prepend_wrap = FALSE;
/* Should we prepend wrapped text to the next line? */
#endif
#ifdef ENABLE_WORDCOMPLETION
static int pletion_x = 0;
/* The x position in pletion_line of the last found completion. */
@@ -65,8 +60,9 @@ void do_mark(void)
#endif /* !NANO_TINY */
#if defined(ENABLE_COLOR) || defined(ENABLE_SPELLER)
/* Return an error message about invoking the given name. */
char *invocation_error(const char *name)
/* Return an error message about invoking the given name. The message
* should not be freed; this leak is not worth the trouble avoiding. */
const char *invocation_error(const char *name)
{
char *message, *invoke_error = _("Error invoking \"%s\"");
@@ -1412,89 +1408,60 @@ void update_undo(undo_type action)
#endif /* !NANO_TINY */
#ifdef ENABLE_WRAPPING
/* Unset the prepend_wrap flag. We need to do this as soon as we do
* something other than type text. */
void wrap_reset(void)
{
prepend_wrap = FALSE;
}
/* Try wrapping the given line. Return TRUE if wrapped, FALSE otherwise. */
bool do_wrap(linestruct *line)
/* When the current line is overlong, hard-wrap it at the furthest possible
* whitespace character, and (if possible) prepend the remainder of the line
* to the next line. Return TRUE if wrapping occurred, and FALSE otherwise. */
bool do_wrap(void)
{
linestruct *line = openfile->current;
/* The line to be wrapped, if needed and possible. */
size_t line_len = strlen(line->data);
/* The length of the line we wrap. */
/* The length of this line. */
size_t cursor_x = openfile->current_x;
/* The current cursor position, for comparison with the wrap point. */
ssize_t wrap_loc;
/* The index of line->data where we wrap. */
/* The position in the line's text where we wrap. */
const char *remainder;
/* The text after the wrap point. */
size_t rest_length;
/* The length of the remainder. */
size_t old_x = openfile->current_x;
linestruct *old_line = openfile->current;
/* There are three steps. First, we decide where to wrap. Then, we
* create the new wrap line. Finally, we clean up. */
/* Step 1, finding where to wrap. We are going to add a new line
* after a blank character. In this step, we call break_line() to
* get the location of the last blank we can break the line at, and
* set wrap_loc to the location of the character after it, so that
* the blank is preserved at the end of the line.
*
* If there is no legal wrap point, or we reach the last character
* of the line while trying to find one, we should return without
* wrapping. Note that if autoindent is turned on, we don't break
* at the end of it! */
/* Find the last blank where we can break the line. */
/* First find the last blank character where we can break the line. */
wrap_loc = break_line(line->data, wrap_at, FALSE);
/* If we couldn't break the line, or we've reached the end of it, we
* don't wrap. */
/* If no wrapping point was found before end-of-line, we don't wrap. */
if (wrap_loc == -1 || line->data[wrap_loc] == '\0')
return FALSE;
/* Otherwise, move forward to the character just after the blank. */
/* Step forward to the character just after the blank. */
wrap_loc += move_mbright(line->data + wrap_loc, 0);
/* If we've reached the end of the line, we don't wrap. */
/* When now at end-of-line, no need to wrap. */
if (line->data[wrap_loc] == '\0')
return FALSE;
#ifndef NANO_TINY
/* If autoindent is turned on, and we're on the character just after
* the indentation, we don't wrap. */
/* When autoindenting, we don't wrap right after the indentation. */
if (ISSET(AUTOINDENT) && wrap_loc == indent_length(line->data))
return FALSE;
add_undo(SPLIT_BEGIN);
#endif
openfile->current = line;
/* Step 2, making the new wrap line. It will consist of indentation
* followed by the text after the wrap point, optionally followed by
* a space (if the text after the wrap point doesn't end in a blank)
* and the text of the next line, if they can fit without wrapping,
* the next line exists, and the prepend_wrap flag is set. */
/* The remainder is the text that will be wrapped to the next line. */
remainder = line->data + wrap_loc;
rest_length = line_len - wrap_loc;
/* We prepend the wrapped text to the next line, if the prepend_wrap
* flag is set, there is a next line, and prepending would not make
* the line too long. */
if (prepend_wrap && line != openfile->filebot) {
const char *tail = remainder + move_mbleft(remainder, rest_length);
/* Go to the end of the line. */
/* When prepending and the remainder of this line will not make the next
* line too long, then join the two lines, so that, after the line wrap,
* the remainder will effectively have been prefixed to the next line. */
if (openfile->spillage_line && openfile->spillage_line == line->next &&
rest_length + breadth(line->next->data) <= wrap_at) {
/* Go to the end of this line. */
openfile->current_x = line_len;
/* If the remainder doesn't end in a blank, add a space. */
if (!is_blank_mbchar(tail)) {
if (!is_blank_mbchar(remainder + move_mbleft(remainder, rest_length))) {
#ifndef NANO_TINY
add_undo(ADD);
#endif
@@ -1509,13 +1476,10 @@ bool do_wrap(linestruct *line)
#endif
}
if (rest_length + strlen(line->next->data) <= wrap_at) {
/* Delete the LF to join the two lines. */
/* Join the next line to this one, and delete any extra blanks. */
do {
do_delete();
/* Delete any leading blanks from the joined-on line. */
while (is_blank_mbchar(&line->data[openfile->current_x]))
do_delete();
}
} while (is_blank_mbchar(&line->data[openfile->current_x]));
}
/* Go to the wrap location. */
@@ -1524,9 +1488,10 @@ bool do_wrap(linestruct *line)
/* When requested, snip trailing blanks off the wrapped line. */
if (ISSET(TRIM_BLANKS)) {
size_t tail_x = move_mbleft(line->data, wrap_loc);
size_t typed_x = move_mbleft(line->data, old_x);
size_t typed_x = move_mbleft(line->data, cursor_x);
while (tail_x != typed_x && is_blank_mbchar(line->data + tail_x)) {
while ((tail_x != typed_x || cursor_x >= wrap_loc) &&
is_blank_mbchar(line->data + tail_x)) {
openfile->current_x = tail_x;
do_delete();
tail_x = move_mbleft(line->data, tail_x);
@@ -1536,14 +1501,13 @@ bool do_wrap(linestruct *line)
/* Now split the line. */
do_enter();
if (old_x < wrap_loc) {
openfile->current_x = old_x;
openfile->current = old_line;
prepend_wrap = TRUE;
} else {
openfile->current_x += (old_x - wrap_loc);
prepend_wrap = FALSE;
}
openfile->spillage_line = openfile->current;
if (cursor_x < wrap_loc) {
openfile->current = openfile->current->prev;
openfile->current_x = cursor_x;
} else
openfile->current_x += (cursor_x - wrap_loc);
openfile->placewewant = xplustabs();
@@ -1872,12 +1836,12 @@ void rewrap_paragraph(linestruct **line, char *lead_string, size_t lead_len)
ssize_t break_pos;
/* The x-coordinate where the current line is to be broken. */
while (strlenpt((*line)->data) > wrap_at) {
while (breadth((*line)->data) > wrap_at) {
size_t line_len = strlen((*line)->data);
/* Find a point in the line where it can be broken. */
break_pos = break_line((*line)->data + lead_len,
wrap_at - strnlenpt((*line)->data, lead_len), FALSE);
wrap_at - wideness((*line)->data, lead_len), FALSE);
/* If we can't break the line, or don't need to, we're done. */
if (break_pos == -1 || break_pos + lead_len == line_len)
@@ -2332,7 +2296,7 @@ bool fix_spello(const char *word)
} else if (result == 1) {
spotlighted = TRUE;
light_from_col = xplustabs();
light_to_col = light_from_col + strlenpt(word);
light_to_col = light_from_col + breadth(word);
#ifndef NANO_TINY
linestruct *saved_mark = openfile->mark;
openfile->mark = NULL;
@@ -2393,7 +2357,7 @@ bool fix_spello(const char *word)
/* Internal (integrated) spell checking using the spell program,
* filtered through the sort and uniq programs. Return NULL for normal
* termination, and the error string otherwise. */
char *do_int_speller(const char *tempfile_name)
const char *do_int_speller(const char *tempfile_name)
{
char *misspellings, *pointer, *oneword;
long pipesize;
@@ -2585,7 +2549,7 @@ char *do_int_speller(const char *tempfile_name)
/* External (alternate) spell checking. Return NULL for normal
* termination, and the error string otherwise. */
char *do_alt_speller(char *tempfile_name)
const char *do_alt_speller(char *tempfile_name)
{
int alt_spell_status;
size_t current_x_save = openfile->current_x;
@@ -2688,7 +2652,7 @@ void do_spell(void)
char *temp;
unsigned stash[sizeof(flags) / sizeof(flags[0])];
/* A storage place for the current flag settings. */
char *result_msg;
const char *result_msg;
if (ISSET(RESTRICTED)) {
show_restricted_warning();
@@ -2742,7 +2706,6 @@ void do_spell(void)
else
statusline(ALERT, _("Spell checking failed: %s: %s"), result_msg,
strerror(errno));
free(result_msg);
} else
statusbar(_("Finished checking spelling"));
}
@@ -2928,10 +2891,7 @@ void do_linter(void)
waitpid(pid_lint, &lint_status, 0);
if (!WIFEXITED(lint_status) || WEXITSTATUS(lint_status) > 2) {
char *result_msg= invocation_error(openfile->syntax->linter);
statusbar(result_msg);
free(result_msg);
statusbar(invocation_error(openfile->syntax->linter));
return;
}
@@ -3104,7 +3064,6 @@ void do_wordlinechar_count(void)
size_t words = 0, chars = 0;
ssize_t nlines = 0;
size_t current_x_save = openfile->current_x;
size_t pww_save = openfile->placewewant;
linestruct *current_save = openfile->current;
linestruct *was_mark = openfile->mark;
linestruct *top, *bot;
@@ -3122,7 +3081,6 @@ void do_wordlinechar_count(void)
/* Start at the top of the file. */
openfile->current = openfile->filetop;
openfile->current_x = 0;
openfile->placewewant = 0;
/* Keep moving to the next word (counting punctuation characters as
* part of a word, as "wc -w" does), without updating the screen,
@@ -3152,7 +3110,6 @@ void do_wordlinechar_count(void)
/* Restore where we were. */
openfile->current = current_save;
openfile->current_x = current_x_save;
openfile->placewewant = pww_save;
/* Display the total word, line, and character counts on the statusbar. */
statusline(HUSH, _("%sWords: %zu Lines: %zd Chars: %zu"), was_mark ?
@@ -3342,7 +3299,7 @@ void complete_a_word(void)
/* If needed, reenable wrapping and wrap the current line. */
if (was_set_wrapping) {
SET(BREAK_LONG_LINES);
do_wrap(openfile->current);
do_wrap();
}
#endif
/* Set the position for a possible next search attempt. */

View File

@@ -368,7 +368,7 @@ size_t get_page_start(size_t column)
* column position of the cursor. */
size_t xplustabs(void)
{
return strnlenpt(openfile->current->data, openfile->current_x);
return wideness(openfile->current->data, openfile->current_x);
}
/* Return the index in text of the character that (when displayed) will
@@ -394,10 +394,9 @@ size_t actual_x(const char *text, size_t column)
/* A strnlen() with tabs and multicolumn characters factored in:
* how many columns wide are the first maxlen bytes of text? */
size_t strnlenpt(const char *text, size_t maxlen)
size_t wideness(const char *text, size_t maxlen)
{
size_t width = 0;
/* The screen display width to text[maxlen]. */
if (maxlen == 0)
return 0;
@@ -416,7 +415,7 @@ size_t strnlenpt(const char *text, size_t maxlen)
}
/* Return the number of columns that the given text occupies. */
size_t strlenpt(const char *text)
size_t breadth(const char *text)
{
size_t span = 0;

View File

@@ -1871,7 +1871,7 @@ char *display_string(const char *buf, size_t column, size_t span,
{
size_t start_index = actual_x(buf, column);
/* The index of the first character that the caller wishes to show. */
size_t start_col = strnlenpt(buf, start_index);
size_t start_col = wideness(buf, start_index);
/* The actual column where that first character starts. */
char *converted;
/* The expanded string we will return. */
@@ -2023,7 +2023,7 @@ int buffer_number(openfilestruct *buffer)
{
int count = 1;
while (buffer != firstfile) {
while (buffer != startfile) {
buffer = buffer->prev;
count++;
}
@@ -2088,7 +2088,7 @@ void titlebar(const char *path)
if (more_than_one) {
indicator = charalloc(24);
sprintf(indicator, "[%i/%i]", buffer_number(openfile),
buffer_number(firstfile->prev));
buffer_number(startfile->prev));
upperleft = indicator;
} else
#endif
@@ -2106,16 +2106,16 @@ void titlebar(const char *path)
else if (ISSET(RESTRICTED))
state = _("Restricted");
pluglen = strlenpt(_("Modified")) + 1;
pluglen = breadth(_("Modified")) + 1;
}
/* Determine the widths of the four elements, including their padding. */
verlen = strlenpt(upperleft) + 3;
prefixlen = strlenpt(prefix);
verlen = breadth(upperleft) + 3;
prefixlen = breadth(prefix);
if (prefixlen > 0)
prefixlen++;
pathlen = strlenpt(path);
statelen = strlenpt(state) + 2;
pathlen = breadth(path);
statelen = breadth(state) + 2;
if (statelen > 2) {
pathlen++;
pluglen = 0;
@@ -2253,7 +2253,7 @@ void statusline(message_type importance, const char *msg, ...)
message = display_string(compound, 0, COLS, FALSE, FALSE);
free(compound);
start_col = (COLS - strlenpt(message)) / 2;
start_col = (COLS - breadth(message)) / 2;
bracketed = (start_col > 1);
wmove(bottomwin, 0, (bracketed ? start_col - 2 : start_col));
@@ -2348,7 +2348,7 @@ void post_one_key(const char *keystroke, const char *tag, int width)
wattroff(bottomwin, interface_color_pair[KEY_COMBO]);
/* If the remaning space is too small, skip the description. */
width -= strlenpt(keystroke);
width -= breadth(keystroke);
if (width < 2)
return;
@@ -2509,12 +2509,12 @@ void edit_draw(linestruct *fileptr, const char *converted,
continue;
start_col = (match.rm_so <= from_x) ?
0 : strnlenpt(fileptr->data,
0 : wideness(fileptr->data,
match.rm_so) - from_col;
thetext = converted + actual_x(converted, start_col);
paintlen = actual_x(thetext, strnlenpt(fileptr->data,
paintlen = actual_x(thetext, wideness(fileptr->data,
match.rm_eo) - from_col - start_col);
mvwaddnstr(edit, row, margin + start_col,
@@ -2613,7 +2613,7 @@ void edit_draw(linestruct *fileptr, const char *converted,
/* Only if it is visible, paint the part to be coloured. */
if (endmatch.rm_eo > from_x) {
paintlen = actual_x(converted, strnlenpt(fileptr->data,
paintlen = actual_x(converted, wideness(fileptr->data,
endmatch.rm_eo) - from_col);
mvwaddnstr(edit, row, margin, converted, paintlen);
}
@@ -2633,7 +2633,7 @@ void edit_draw(linestruct *fileptr, const char *converted,
startmatch.rm_eo += index;
start_col = (startmatch.rm_so <= from_x) ?
0 : strnlenpt(fileptr->data,
0 : wideness(fileptr->data,
startmatch.rm_so) - from_col;
thetext = converted + actual_x(converted, start_col);
@@ -2649,7 +2649,7 @@ void edit_draw(linestruct *fileptr, const char *converted,
* it is more than zero characters long. */
if (endmatch.rm_eo > from_x &&
endmatch.rm_eo > startmatch.rm_so) {
paintlen = actual_x(thetext, strnlenpt(fileptr->data,
paintlen = actual_x(thetext, wideness(fileptr->data,
endmatch.rm_eo) - from_col - start_col);
mvwaddnstr(edit, row, margin + start_col,
@@ -2702,7 +2702,7 @@ void edit_draw(linestruct *fileptr, const char *converted,
if (*(converted + target_x) != '\0') {
charlen = parse_mbchar(converted + target_x, striped_char, NULL);
target_column = strnlenpt(converted, target_x);
target_column = wideness(converted, target_x);
} else if (target_column + 1 == editwincols) {
/* Defeat a VTE bug -- see https://sv.gnu.org/bugs/?55896. */
#ifdef ENABLE_UTF8
@@ -2749,7 +2749,7 @@ void edit_draw(linestruct *fileptr, const char *converted,
/* Only paint if the marked part of the line is on this page. */
if (top_x < till_x && bot_x > from_x) {
/* Compute on which screen column to start painting. */
start_col = strnlenpt(fileptr->data, top_x) - from_col;
start_col = wideness(fileptr->data, top_x) - from_col;
if (start_col < 0)
start_col = 0;
@@ -2759,7 +2759,7 @@ void edit_draw(linestruct *fileptr, const char *converted,
/* If the end of the mark is onscreen, compute how many
* characters to paint. Otherwise, just paint all. */
if (bot_x < till_x) {
size_t end_col = strnlenpt(fileptr->data, bot_x) - from_col;
size_t end_col = wideness(fileptr->data, bot_x) - from_col;
paintlen = actual_x(thetext, end_col - start_col);
}
@@ -2797,7 +2797,7 @@ int update_line(linestruct *fileptr, size_t index)
blank_row(edit, row, 0, COLS);
/* Next, find out from which column to start displaying the line. */
from_col = get_page_start(strnlenpt(fileptr->data, index));
from_col = get_page_start(wideness(fileptr->data, index));
/* Expand the line, replacing tabs with spaces, and control
* characters with their displayed forms. */
@@ -2812,7 +2812,7 @@ int update_line(linestruct *fileptr, size_t index)
mvwaddch(edit, row, margin, '<');
wattroff(edit, hilite_attribute);
}
if (strlenpt(fileptr->data) > from_col + editwincols) {
if (breadth(fileptr->data) > from_col + editwincols) {
wattron(edit, hilite_attribute);
mvwaddch(edit, row, COLS - 1, '>');
wattroff(edit, hilite_attribute);
@@ -3392,7 +3392,7 @@ void do_cursorpos(bool force)
{
char saved_byte;
size_t sum, cur_xpt = xplustabs() + 1;
size_t cur_lenpt = strlenpt(openfile->current->data) + 1;
size_t cur_lenpt = breadth(openfile->current->data) + 1;
int linepct, colpct, charpct;
/* If the showing needs to be suppressed, don't suppress it next time. */
@@ -3652,7 +3652,7 @@ void do_credits(void)
else
what = credits[crpos];
start_col = COLS / 2 - strlenpt(what) / 2 - 1;
start_col = COLS / 2 - breadth(what) / 2 - 1;
mvwaddstr(edit, editwinrows - 1 - (editwinrows % 2),
start_col, what);
}