Additionally always put a space between number and unit which is
required by the norms.
It is important to note that really small buffers have to be bigger than it
appears because they store bytes and non-Latin scripts need more than one byte
with UTF-8 to encode them, e.g., the string "1023 МиБ" in Russian requires
11 bytes + null terminator.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
size_trunc() has been aligned to properly use either IEC or SI prefixes with
the unit B (byte). Additionally always put a space between number and unit
which is required by the norms.
Obsolete gettext message ids have been removed and some cleaned up for
duplicate words or leading spaces.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
(widget_replace): if new widget cannot take focus, move focus to other widget
before widget replacement.
In our case, the focused file panel is replaced by Info one. Info panel
a) isn't selectable (it never takes focus) and b) uses CWD of current
panel. Therefore focus must be moved to other file panel to make it
current and correctly set up it's CWD before first draw of Info panel.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This got broken in the following commit for mc-4.8.16:
a5ebb7d619
As `g_strlcpy` got replaced with `g_strndup`, the meaning of the last
argument has changed: it is no longer the destination size in bytes, but
the maximum number of bytes to copy, and so it had to be decremented by
one accordingly, hence the bug.
Signed-off-by: Roman Mikhayloff <rimf@inbox.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
* 2919_widget_focus_refactoring:
Reimplement widget focus/selection.
(dlg_set_bottom_widget): rename to widget_set_bottom.
(dlg_select_widget): rename to widget_select.
Rename WDialog APIs:
Refactoring of change of current widget.
WMenuBar: remove WMenuBar::is_active. Use WST_FOCUSED instead.
WInput: avoid double draw on resize.
Menu: avoid double draw on resize.
(widget_set_size): send MSG_DRAW after MSG_RESIZE.
Refactoring of widget drawing to avoid multiple widget redraw.
WView: remove WView::active. Use WST_FOCUSED instead.
WTree: remove WTree:active. Use WST_FOCUSED instead.
WButton: remove WButton::selected. Use WST_FOCUSED instead.
WListbox: remove WListbox::focused. Use WST_FOCUSED instead.
WST_FOCUSED: add new state and handle it.
(menubar_callback): refactoring of menu draw after get focus and resize.
(widget_set_state): return cb_ret_t instead of gboolean.
Don't focus widget that doesn't have the WOP_SELECTABLE option.
Use WOP_SELECTABLE option in menu.
Ticket #2919: refactoring of focus/unfocus of widgets.
Add new WDialog APIs:
* dlg_set_current_widget_next
* dlg_set_current_widget_prev
* dlg_get_widget_next_of
* dlg_get_widget_prev_of
and use them:
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Send MSG_DRAW message immediately after MSG_FOCUS/MSG_UNFOCUS.
Thus, the MSG_DRAW message handler is the only place where widget
should be drawn. Widget should not draw itself in other message
handlers.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
If menu is not active, it is not selectable also in order to disallow
select and focus the inactive menu.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Based on existing cxx.syntax file with some extra keywords added.
Colors could be tweaked a bit still, and perhaps list of keywords
and built-in types could be extended further, but it should be a
good starting point already.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
* 3641_cleanup:
lib/mcconfig/paths.c: reduce scope of 'homedir' var.
lib/mcconfig/paths.c: cleanup.
doc/man/mc.1.in: fix substitution markers.
src/vfs/fish/fish.c: apply coding guidelines.
More use link_isdir().
Get rid of #define const_cast().
Fix typos.
Define NCURSES_CONST if curses library doesn't define it.
(ftpfs_open_data_connection): fix enable/disable interrupt key.
(ftpfs_open_data_connection): fix socket leak in case of unsuccessful ftp connection.
(dlg_adjust_position): refactoring.
Ticket #3641: code cleanup before 4.8.18 release.
To ensure that nobody uses the 'homedir' variable in the future without
initializing it first, we make it private to the function, thereby effectively
removing it.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
We can conclude, by reading their GLib source[1], by their documentation,
and by looking at how popular programs use them[2], that the functions
g_get_user_{config,cache,data}_dir() don't return a NULL or empty string.
So the handling of this case can go.
[1] https://git.gnome.org/browse/glib/tree/glib/gutils.c
[2] E.g., google "g_get_user_data_dir".
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>