mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Don't apply emphasis on _foo_^ if it's a nick (Bug 52)
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3720 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
8ec7c164d6
commit
bfb951d3be
@ -39,6 +39,10 @@
|
|||||||
#include "printtext.h"
|
#include "printtext.h"
|
||||||
|
|
||||||
#define ishighalnum(c) ((unsigned char) (c) >= 128 || i_isalnum(c))
|
#define ishighalnum(c) ((unsigned char) (c) >= 128 || i_isalnum(c))
|
||||||
|
#define isnickchar(a) \
|
||||||
|
(i_isalnum(a) || (a) == '`' || (a) == '-' || (a) == '_' || \
|
||||||
|
(a) == '[' || (a) == ']' || (a) == '{' || (a) == '}' || \
|
||||||
|
(a) == '|' || (a) == '\\' || (a) == '^')
|
||||||
|
|
||||||
GHashTable *printnicks;
|
GHashTable *printnicks;
|
||||||
|
|
||||||
@ -81,12 +85,25 @@ char *expand_emphasis(WI_ITEM_REC *item, const char *text)
|
|||||||
use emphasis on them. */
|
use emphasis on them. */
|
||||||
int found;
|
int found;
|
||||||
char c;
|
char c;
|
||||||
|
char *end2;
|
||||||
|
|
||||||
|
/* check if _foo_ is a nick */
|
||||||
c = end[1];
|
c = end[1];
|
||||||
end[1] = '\0';
|
end[1] = '\0';
|
||||||
found = nicklist_find(CHANNEL(item), bgn) != NULL;
|
found = nicklist_find(CHANNEL(item), bgn) != NULL;
|
||||||
end[1] = c;
|
end[1] = c;
|
||||||
if (found) continue;
|
if (found) continue;
|
||||||
|
|
||||||
|
/* check if the whole 'word' (e.g. "_foo_^") is a nick
|
||||||
|
in "_foo_^ ", end will be the second _, end2 the ^ */
|
||||||
|
end2 = end;
|
||||||
|
while (isnickchar(end2[1]))
|
||||||
|
end2++;
|
||||||
|
c = end2[1];
|
||||||
|
end2[1] = '\0';
|
||||||
|
found = nicklist_find(CHANNEL(item), bgn) != NULL;
|
||||||
|
end2[1] = c;
|
||||||
|
if (found) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allow only *word* emphasis, not *multiple words* */
|
/* allow only *word* emphasis, not *multiple words* */
|
||||||
|
Loading…
Reference in New Issue
Block a user