* This file contains function to handle input editing, parsing of called ex
* commands from inputbox and the ex commands.
*/
-#include <ctype.h>
#include <sys/wait.h>
#include "config.h"
#include "main.h"
g_string_truncate(arg->rhs, 0);
/* remove leading whitespace and : */
- while (**input && (**input == ':' || **input == ' ')) {
+ while (**input && (**input == ':' || VB_IS_SPACE(**input))) {
(*input)++;
}
parse_count(input, arg);
*/
static gboolean parse_count(const char **input, ExArg *arg)
{
- if (!*input || !isdigit(**input)) {
+ if (!*input || !VB_IS_DIGIT(**input)) {
arg->count = 0;
} else {
do {
arg->count = arg->count * 10 + (**input - '0');
(*input)++;
- } while (isdigit(**input));
+ } while (VB_IS_DIGIT(**input));
}
return true;
}
}
}
(*input)++;
- } while (matches > 0 && **input && **input != ' ' && **input != '!');
+ } while (matches > 0 && **input && !VB_IS_SPACE(**input) && **input != '!');
if (!matches) {
/* read until next whitespace or end of input to get command name for
* error message - vim uses the whole rest of the input string - but
* the first word seems to bee enough for the error message */
- for (; len < LENGTH(cmd) && *input && **input != ' '; (*input)++) {
+ for (; len < LENGTH(cmd) && *input && !VB_IS_SPACE(**input); (*input)++) {
cmd[len++] = **input;
}
cmd[len] = '\0';
/* get the char until the next none escaped whitespace and save it into
* the lhs */
- while (**input && **input != ' ') {
+ while (**input && !VB_IS_SPACE(**input)) {
/* if we find a backslash this escapes the next whitespace */
if (**input == quote) {
/* move pointer to the next char */
static void skip_whitespace(const char **input)
{
- /* TODO should \t also be skipped here? */
- while (**input && **input == ' ') {
+ while (**input && VB_IS_SPACE(**input)) {
(*input)++;
}
}
* if tha command name parsing fails */
before_cmdname = in;
- if (parse_command_name(&in, arg) && *in == ' ') {
+ if (parse_command_name(&in, arg) && VB_IS_SPACE(*in)) {
const char *token;
/* get only the last word of input string for the completion for
* bookmark tag completion */
/* find the end of the input and search for the next
* whitespace toward the beginning */
token = strrchr(in, '\0');
- while (token >= in && *token != ' ') {
+ while (token >= in && !VB_IS_SPACE(*token)) {
token--;
}
} else {
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
-#include <ctype.h>
#include "config.h"
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkkeysyms-compat.h>
if (call_hints_function("update", 1, arguments)) {
return RESULT_COMPLETE;
}
- } else if (isdigit(key)) {
+ } else if (VB_IS_DIGIT(key)) {
arguments[0] = JSValueMakeNumber(hints.ctx, key - '0');
if (call_hints_function("update", 1, arguments)) {
return RESULT_COMPLETE;
*/
#include <gdk/gdkkeysyms.h>
-#include <ctype.h>
#include "config.h"
#include "mode.h"
#include "main.h"
} else if (info.phase == PHASE_KEY3) {
info.key3 = key;
info.phase = PHASE_COMPLETE;
- } else if (info.phase == PHASE_START && isdigit(key)) {
+ } else if (info.phase == PHASE_START && VB_IS_DIGIT(key)) {
info.count = info.count * 10 + key - '0';
} else if (strchr(";zg[]'m", (char)key)) {
/* handle commands that needs additional char */
setting = webkit_web_view_get_settings(view);
g_object_get(G_OBJECT(setting), "zoom-step", &step, NULL);
- webkit_web_view_set_full_content_zoom(view, isupper(info->key2));
+ webkit_web_view_set_full_content_zoom(view, VB_IS_UPPER(info->key2));
/* calculate the new zoom level */
if (info->key2 == 'i' || info->key2 == 'I') {