mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
core: check for newline characters in string_is_whitespace_char
This fixes a bug where if you had multiple lines in the input and pressed ctrl-w when the cursor was after the first word of any line but the first, it would delete both the word before the cursor and the last word on the preceding line.
This commit is contained in:
committed by
Sébastien Helleu
parent
4c9fd4a625
commit
b551d6f247
@@ -23,6 +23,7 @@ Bug fixes::
|
||||
|
||||
* core: force key "return" to command "/input return" when migrating legacy keys
|
||||
* core: display actual key name and command with key kbd:[Alt+k], remove key kbd:[Alt+K] (grab raw key) and associated commands `/input grab_raw_key` and `/input grab_raw_key_command`
|
||||
* core: check for newline characters in string_is_whitespace_char (issue #1968)
|
||||
* api: do not convert option name to lower case in API functions config_set_plugin and config_set_desc_plugin
|
||||
* irc: reply to a CTCP request sent to self nick (issue #1966)
|
||||
* irc: sent "QUIT" message to servers connected with TLS on `/upgrade`
|
||||
|
||||
@@ -1312,7 +1312,7 @@ string_convert_escaped_chars (const char *string)
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if first char of string is a whitespace (space or tab).
|
||||
* Checks if first char of string is a whitespace (space, tab, newline or carriage return).
|
||||
*
|
||||
* Returns:
|
||||
* 1: first char is whitespace
|
||||
@@ -1322,7 +1322,11 @@ string_convert_escaped_chars (const char *string)
|
||||
int
|
||||
string_is_whitespace_char (const char *string)
|
||||
{
|
||||
return (string && ((string[0] == ' ') || string[0] == '\t')) ? 1 : 0;
|
||||
return (string && (
|
||||
(string[0] == ' ')
|
||||
|| (string[0] == '\t')
|
||||
|| (string[0] == '\n')
|
||||
|| (string[0] == '\r'))) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1090,6 +1090,8 @@ TEST(CoreString, IsWhitespaceChar)
|
||||
|
||||
LONGS_EQUAL(1, string_is_whitespace_char (" abc def"));
|
||||
LONGS_EQUAL(1, string_is_whitespace_char ("\tabc def"));
|
||||
LONGS_EQUAL(1, string_is_whitespace_char ("\nabc def"));
|
||||
LONGS_EQUAL(1, string_is_whitespace_char ("\rabc def"));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user