in titlebar(), make sure that the (mv)?waddnstr() calls take the proper
number of bytes when using multibyte characters, so that multibyte strings aren't prematurely cut off; also allow the "View" state to be displayed when a filename is passed in, in case we're in multibuffer mode and inside the file browser git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2424 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
cb4f14b8ce
commit
297851a647
|
@ -40,6 +40,14 @@ CVS code -
|
||||||
regexec_safe()
|
regexec_safe()
|
||||||
- Rename to safe_regexec() for consistency. (DLR)
|
- Rename to safe_regexec() for consistency. (DLR)
|
||||||
- winio.c:
|
- winio.c:
|
||||||
|
titlebar()
|
||||||
|
- Make sure that the (mv)?waddnstr() calls take the proper
|
||||||
|
number of bytes when using multibyte characters, so that
|
||||||
|
multibyte strings aren't prematurely cut off. (DLR, found by
|
||||||
|
Jordi)
|
||||||
|
- Allow the "View" state to be displayed when a filename is
|
||||||
|
passed in, in case we're in multibuffer mode and inside the
|
||||||
|
file browser. (DLR)
|
||||||
help_line_len()
|
help_line_len()
|
||||||
- Make the text display more flexible, and closer to what nano
|
- Make the text display more flexible, and closer to what nano
|
||||||
1.2.x does. (DLR)
|
1.2.x does. (DLR)
|
||||||
|
|
15
src/winio.c
15
src/winio.c
|
@ -2730,7 +2730,6 @@ void titlebar(const char *path)
|
||||||
assert(COLS >= 0);
|
assert(COLS >= 0);
|
||||||
|
|
||||||
wattron(topwin, A_REVERSE);
|
wattron(topwin, A_REVERSE);
|
||||||
|
|
||||||
blank_titlebar();
|
blank_titlebar();
|
||||||
|
|
||||||
if (COLS <= 5 || COLS - 5 < verlen)
|
if (COLS <= 5 || COLS - 5 < verlen)
|
||||||
|
@ -2752,7 +2751,7 @@ void titlebar(const char *path)
|
||||||
|
|
||||||
if (ISSET(MODIFIED))
|
if (ISSET(MODIFIED))
|
||||||
state = _("Modified");
|
state = _("Modified");
|
||||||
else if (path == NULL && ISSET(VIEW_MODE))
|
else if (ISSET(VIEW_MODE))
|
||||||
state = _("View");
|
state = _("View");
|
||||||
else {
|
else {
|
||||||
if (space > 0)
|
if (space > 0)
|
||||||
|
@ -2760,6 +2759,7 @@ void titlebar(const char *path)
|
||||||
state = &hblank[COLS - statelen];
|
state = &hblank[COLS - statelen];
|
||||||
}
|
}
|
||||||
statelen = strnlenpt(state, COLS);
|
statelen = strnlenpt(state, COLS);
|
||||||
|
|
||||||
/* We need a space before state. */
|
/* We need a space before state. */
|
||||||
if ((ISSET(MODIFIED) || ISSET(VIEW_MODE)) && statelen < COLS)
|
if ((ISSET(MODIFIED) || ISSET(VIEW_MODE)) && statelen < COLS)
|
||||||
statelen++;
|
statelen++;
|
||||||
|
@ -2783,6 +2783,7 @@ void titlebar(const char *path)
|
||||||
assert(statelen < space);
|
assert(statelen < space);
|
||||||
|
|
||||||
prefixlen = strnlenpt(prefix, space - statelen);
|
prefixlen = strnlenpt(prefix, space - statelen);
|
||||||
|
|
||||||
/* If newfie is FALSE, we need a space after prefix. */
|
/* If newfie is FALSE, we need a space after prefix. */
|
||||||
if (!newfie && prefixlen + statelen < space)
|
if (!newfie && prefixlen + statelen < space)
|
||||||
prefixlen++;
|
prefixlen++;
|
||||||
|
@ -2794,6 +2795,7 @@ void titlebar(const char *path)
|
||||||
else
|
else
|
||||||
space = 0;
|
space = 0;
|
||||||
/* space is now the room we have for the file name. */
|
/* space is now the room we have for the file name. */
|
||||||
|
|
||||||
if (!newfie) {
|
if (!newfie) {
|
||||||
size_t lenpt = strlenpt(path), start_col;
|
size_t lenpt = strlenpt(path), start_col;
|
||||||
|
|
||||||
|
@ -2814,7 +2816,7 @@ void titlebar(const char *path)
|
||||||
|
|
||||||
/* There is room for the whole filename, so we center it. */
|
/* There is room for the whole filename, so we center it. */
|
||||||
waddnstr(topwin, hblank, (space - exppathlen) / 3);
|
waddnstr(topwin, hblank, (space - exppathlen) / 3);
|
||||||
waddnstr(topwin, prefix, prefixlen);
|
waddnstr(topwin, prefix, actual_x(prefix, prefixlen));
|
||||||
if (!newfie) {
|
if (!newfie) {
|
||||||
assert(strlenpt(prefix) + 1 == prefixlen);
|
assert(strlenpt(prefix) + 1 == prefixlen);
|
||||||
|
|
||||||
|
@ -2823,7 +2825,7 @@ void titlebar(const char *path)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* We will say something like "File: ...ename". */
|
/* We will say something like "File: ...ename". */
|
||||||
waddnstr(topwin, prefix, prefixlen);
|
waddnstr(topwin, prefix, actual_x(prefix, prefixlen));
|
||||||
if (space <= -3 || newfie)
|
if (space <= -3 || newfie)
|
||||||
goto the_end;
|
goto the_end;
|
||||||
waddch(topwin, ' ');
|
waddch(topwin, ' ');
|
||||||
|
@ -2837,12 +2839,13 @@ void titlebar(const char *path)
|
||||||
free(exppath);
|
free(exppath);
|
||||||
|
|
||||||
if (COLS <= 1 || statelen >= COLS - 1)
|
if (COLS <= 1 || statelen >= COLS - 1)
|
||||||
mvwaddnstr(topwin, 0, 0, state, COLS);
|
mvwaddnstr(topwin, 0, 0, state, actual_x(state, COLS));
|
||||||
else {
|
else {
|
||||||
assert(COLS - statelen - 2 >= 0);
|
assert(COLS - statelen - 2 >= 0);
|
||||||
|
|
||||||
mvwaddch(topwin, 0, COLS - statelen - 2, ' ');
|
mvwaddch(topwin, 0, COLS - statelen - 2, ' ');
|
||||||
mvwaddnstr(topwin, 0, COLS - statelen - 1, state, statelen);
|
mvwaddnstr(topwin, 0, COLS - statelen - 1, state,
|
||||||
|
actual_x(state, statelen));
|
||||||
}
|
}
|
||||||
|
|
||||||
wattroff(topwin, A_REVERSE);
|
wattroff(topwin, A_REVERSE);
|
||||||
|
|
Loading…
Reference in New Issue