1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'master' into osx-functional

This commit is contained in:
James Booth 2015-12-19 23:36:12 +00:00
commit d118ce7902
4 changed files with 35 additions and 1 deletions

View File

@ -945,6 +945,18 @@ static struct cmd_t command_defs[] =
CMD_NOEXAMPLES CMD_NOEXAMPLES
}, },
{ "/charset",
cmd_charset, parse_args, 0, 0, NULL,
CMD_TAGS(
CMD_TAG_UI)
CMD_SYN(
"/beep")
CMD_DESC(
"Display information about the current character set supported by the terminal. ")
CMD_NOARGS
CMD_NOEXAMPLES
},
{ "/beep", { "/beep",
cmd_beep, parse_args, 1, 1, &cons_beep_setting, cmd_beep, parse_args, 1, 1, &cons_beep_setting,
CMD_TAGS( CMD_TAGS(

View File

@ -43,6 +43,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <langinfo.h>
#include "chat_session.h" #include "chat_session.h"
#include "command/commands.h" #include "command/commands.h"
@ -4007,6 +4008,26 @@ cmd_privileges(ProfWin *window, const char *const command, gchar **args)
return result; return result;
} }
gboolean
cmd_charset(ProfWin *window, const char *const command, gchar **args)
{
char *codeset = nl_langinfo(CODESET);
char *lang = getenv("LANG");
cons_show("Charset information:");
if (lang) {
cons_show(" LANG: %s", lang);
}
if (codeset) {
cons_show(" CODESET: %s", codeset);
}
cons_show(" MB_CUR_MAX: %d", MB_CUR_MAX);
cons_show(" MB_LEN_MAX: %d", MB_LEN_MAX);
return TRUE;
}
gboolean gboolean
cmd_beep(ProfWin *window, const char *const command, gchar **args) cmd_beep(ProfWin *window, const char *const command, gchar **args)
{ {

View File

@ -151,6 +151,7 @@ gboolean cmd_inpblock(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_encwarn(ProfWin *window, const char *const command, gchar **args); gboolean cmd_encwarn(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_script(ProfWin *window, const char *const command, gchar **args); gboolean cmd_script(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_export(ProfWin *window, const char *const command, gchar **args); gboolean cmd_export(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_charset(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_form_field(ProfWin *window, char *tag, gchar **args); gboolean cmd_form_field(ProfWin *window, char *tag, gchar **args);

View File

@ -311,7 +311,7 @@ _inp_offset_to_col(char *str, int offset)
while (i < offset && str[i] != '\0') { while (i < offset && str[i] != '\0') {
gunichar uni = g_utf8_get_char(&str[i]); gunichar uni = g_utf8_get_char(&str[i]);
size_t ch_len = mbrlen(&str[i], 4, NULL); size_t ch_len = mbrlen(&str[i], MB_CUR_MAX, NULL);
i += ch_len; i += ch_len;
col++; col++;
if (g_unichar_iswide(uni)) { if (g_unichar_iswide(uni)) {