* Retrieves the oldest entry from queue.
*
* @item_count: will be filled with the number of remaining items in queue.
- * Retruned uri must be freed with g_free.
+ * Returned uri must be freed with g_free.
*/
char *bookmark_queue_pop(int *item_count)
{
found = false;
/* we want to do a prefix match on all bookmark tags - so we check for
- * a match on string beginn - if this fails we move the cursor to the
+ * a match on string begin - if this fails we move the cursor to the
* next space and do the test again */
while (cursor && *cursor) {
/* match was not found at current cursor position */
/* copy search query for later use */
if (arg->s) {
- /* set dearch dir only when the searching is started */
+ /* set search direction only when the searching is started */
dir = arg->i > 0 ? 1 : -1;
query = arg->s;
/* add new search query to history and search register */
newsearch = false;
/* skip first search because this is done during typing in ex
- * mode, else the search wil mark the next match as active */
+ * mode, else the search will mark the next match as active */
if (count) {
count -= 1;
}
/* features */
/* enable cookie support */
#define FEATURE_COOKIE
-/* highlich search reasults */
+/* highlight search results */
#define FEATURE_SEARCH_HIGHLIGHT
/* disable scrollbars */
#define FEATURE_NO_SCROLLBARS
typedef gboolean (*ExFunc)(const ExArg *arg);
typedef struct {
- const char *name; /* full name of the command even if called abreviated */
+ const char *name; /* full name of the command even if called abbreviated */
ExCode code; /* constant id for the command */
ExFunc func;
#define EX_FLAG_NONE 0x000 /* no flags set */
/* The order of following command names is significant. If there exists
* ambiguous commands matching to the users input, the first defined will be
- * the prefered match.
+ * the preferred match.
* Also the sorting and grouping of command names matters, so we give up
* searching for a matching command if the next compared character did not
* match. */
return RESULT_COMPLETE;
}
- /* process the custbuffer */
+ /* process the cutbuffer */
if (info.phase == PHASE_CUTBUF) {
info.cutbuf = (char)key;
info.phase = PHASE_CUTBUF;
break;
case CTRL('U'):
- /* remove everythings between cursor and prompt */
+ /* remove everything between cursor and prompt */
mark = gtk_text_buffer_get_insert(buffer);
gtk_text_buffer_get_iter_at_mark(buffer, &end, mark);
gtk_text_buffer_get_iter_at_offset(buffer, &start, strlen(vb.state.prompt));
/* don't add line breaks if content is pasted from clipboard into inputbox */
if (gtk_text_buffer_get_line_count(buffer) > 1) {
- /* remove everething from the buffer, except of the first line */
+ /* remove everything from the buffer, except of the first line */
gtk_text_buffer_get_iter_at_line(buffer, &start, 0);
if (gtk_text_iter_forward_to_line_end(&start)) {
gtk_text_buffer_get_end_iter(buffer, &end);
if (commands[i].name[len - 1] == **input) {
/* partial match found */
if (!matches) {
- /* if this is the first then remeber it */
+ /* if this is the first then remember it */
first = i;
}
matches++;
/* save the string prefix that will not be part of completion like
* the ':open ' if ':open something' is completed. this means that
- * the complation will only the none prefix part of the input */
+ * the completion will only the none prefix part of the input */
OVERWRITE_NSTRING(excomp.prefix, input, token - input + 1);
/* the token points to a space, skip this */
/**
* Callback called from the completion if a item is selected to write the
- * matche item accordings with previously saved prefix and command name to the
+ * matched item according with previously saved prefix and command name to the
* inputbox.
*/
static void completion_select(char *match)
static struct {
JSObjectRef obj; /* the js object */
char mode; /* mode identifying char - that last char of the hint prompt */
- int promptlen; /* lenfth of the hint prompt chars 2 or 3 */
- gboolean gmode; /* indicate if the hints g mode is used */
+ int promptlen; /* length of the hint prompt chars 2 or 3 */
+ gboolean gmode; /* indicate if the hints 'g' mode is used */
JSContextRef ctx;
#if WEBKIT_CHECK_VERSION(2, 0, 0)
/* holds the setting if JavaScript can open windows automatically that we
void hints_create(const char *input)
{
/* don't start hinting if the hinting object isn't created - for example
- * if hinting is started before the first data of page are recieved */
+ * if hinting is started before the first data of page are received */
if (!hints.obj) {
return;
}
};
call_hints_function("init", 3, arguments);
- /* if hinting is started there won't be any aditional filter given and
+ /* if hinting is started there won't be any additional filter given and
* we can go out of this function */
return;
}
g_list_free_full(src, (GDestroyNotify)free_history);
/* prepend the original query as own item like done in vim to have the
- * origianl input string in input box if we step before the first real
+ * original input string in input box if we step before the first real
* item */
result = g_list_prepend(result, g_strdup(query));
}
/**
- * Loads history items form file but eleminate duplicates in FIFO order.
+ * Loads history items form file but eliminate duplicates in FIFO order.
*
* Returned list must be freed with (GDestroyNotify) free_history.
*/
*/
void input_enter(void)
{
- /* switch focus first to make shure we can write to the inputbox without
+ /* switch focus first to make sure we can write to the inputbox without
* disturbing the user */
gtk_widget_grab_focus(GTK_WIDGET(vb.gui.webview));
vb_echo(VB_MSG_NORMAL, false, "-- INPUT --");
}
/**
- * Creates a JavaScript object in contect of given frame.
+ * Creates a JavaScript object in context of given frame.
*/
JSObjectRef js_create_object(JSContextRef ctx, const char *script)
{
}
/**
- * Retrune a new allocates string for given value reference.
+ * Returns a new allocates string for given value reference.
* String must be freed if not used anymore.
*/
char* js_ref_to_string(JSContextRef ctx, JSValueRef ref)
/**
* Retrieves the content of the command line.
- * Retruned string must be freed with g_free.
+ * Returned string must be freed with g_free.
*/
char *vb_get_input_text(void)
{
} else {
/* Load a web page into the browser instance */
webkit_web_view_load_uri(vb.gui.webview, uri);
- /* show the url to be opened in the windo title until we receive the
+ /* show the url to be opened in the window title until we receive the
* page title */
OVERWRITE_STRING(vb.state.title, uri);
update_title();
void vb_quit(gboolean force)
{
- /* if not forced quit - don't quit if there are still runinng downloads */
+ /* if not forced quit - don't quit if there are still running downloads */
if (!force && vb.state.downloads) {
vb_echo_force(VB_MSG_ERROR, true, "Can't quit: there are running downloads");
return;
WebKitWebNavigationAction *action, WebKitWebPolicyDecision *policy,
gpointer data)
{
- /* try to find a protocall handler to open the uri */
+ /* try to find a protocol handler to open the uri */
return handle_uri(webkit_network_request_get_uri(request));
}
}
if (use_external && *download_cmd) {
- /* run download with external programm */
+ /* run download with external program */
vb_download_external(view, download, file);
g_free(file);
}
const char *file = webkit_download_get_destination_uri(download);
- /* skip the file protocoll for the display */
+ /* skip the file protocol for the display */
if (!strncmp(file, "file://", 7)) {
file += 7;
}
vb_echo(VB_MSG_NORMAL, false, "Download %s finished", file);
}
- /* remove the donwload from the list */
+ /* remove the download from the list */
vb.state.downloads = g_list_remove(vb.state.downloads, download);
vb_update_statusbar();
static GOptionEntry opts[] = {
{"cmd", 'C', 0, G_OPTION_ARG_STRING, &vb.config.autocmd, "Ex command run before first page is loaded", NULL},
- {"config", 'c', 0, G_OPTION_ARG_STRING, &vb.config.file, "Custom cufiguration file", NULL},
+ {"config", 'c', 0, G_OPTION_ARG_STRING, &vb.config.file, "Custom configuration file", NULL},
{"embed", 'e', 0, G_OPTION_ARG_STRING, &winid, "Reparents to window specified by xid", NULL},
{"kiosk", 'k', 0, G_OPTION_ARG_NONE, &vb.config.kioskmode, "Run in kiosk mode", NULL},
{"version", 'v', 0, G_OPTION_ARG_NONE, &ver, "Print version", NULL},
/* skip csi indicator and the next 2 chars - if the csi sequence
* isn't part of a mapped command we let gtk handle the key - this
- * is required allo to move cursor in inputbox with <Left> and
+ * is required allow to move cursor in inputbox with <Left> and
* <Right> keys */
if ((map.queue[0] & 0xff) == CSI && map.qlen >= 3) {
/* get next 2 chars to build the termcap key */
memmove(map.queue, map.queue + 1, map.qlen);
}
- /* remove the nomap flag */
+ /* remove the no-map flag */
vb.mode->flags &= ~FLAG_NOMAP;
/* send the key to the parser */
}
/**
- * Transalte a singe char into a readable representation to be show to the
+ * Translate a singe char into a readable representation to be show to the
* user in status bar.
*/
static char *transchar(int c)
*/
void pass_enter(void)
{
- /* switch focus first to make shure we can write to the inputbox without
+ /* switch focus first to make sure we can write to the inputbox without
* disturbing the user */
gtk_widget_grab_focus(GTK_WIDGET(vb.gui.webview));
vb_echo(VB_MSG_NORMAL, false, "-- PASS THROUGH --");
typedef enum {
SETTING_SET, /* :set option=value */
- SETTING_APPEND, /* :set option+=vlaue */
- SETTING_PREPEND, /* :set option^=vlaue */
+ SETTING_APPEND, /* :set option+=value */
+ SETTING_PREPEND, /* :set option^=value */
SETTING_REMOVE, /* :set option-=value */
SETTING_GET, /* :set option? */
SETTING_TOGGLE /* :set option! */
enum {
FLAG_LIST = (1<<1), /* setting contains a ',' separated list of values */
- FLAG_NODUP = (1<<2), /* dont allow duplicate strings within list values */
+ FLAG_NODUP = (1<<2), /* don't allow duplicate strings within list values */
};
extern VbCore vb;
}
/**
- * Prepares the vlaue for the setting for the diefferent setting types.
+ * Prepares the value for the setting for the different setting types.
* Return value true indicates that the memory of newvalue must be freed by
* the caller.
*/
if ((type != SETTING_APPEND && type != SETTING_PREPEND && type != SETTING_REMOVE)
|| prop->type == TYPE_BOOLEAN
) {
- /* if type is not appen, prepend or remove there is nothing to be done */
+ /* if type is not append, prepend or remove there is nothing to be done */
*newvalue = value;
return res;
}
gboolean shortcut_set_default(const char *key)
{
- /* do not check if the shotcut exists to be able to set the default
- * before defining the shotcut */
+ /* do not check if the shortcut exists to be able to set the default
+ * before defining the shortcut */
OVERWRITE_STRING(default_key, key);
return true;
}
/**
- * Retrieves th highest placesholder number used in given string.
+ * Retrieves th highest placeholder number used in given string.
* If no placeholder is found -1 is returned.
*/
static int get_max_placeholder(const char *str)
/**
* Retrieves the shortcut uri template for given string. And fills given query
- * pointer with the query part of the given string (everithing except of the
+ * pointer with the query part of the given string (everything except of the
* shortcut identifier).
*/
static const char *shortcut_lookup(const char *string, const char **query)
* @filename: file to read items from
* @func: function to parse a single line to item
* @unique_func: function to decide if two items are equal
- * @free_func: function to free already converted item if this isn't unque
+ * @free_func: function to free already converted item if this isn't unique
* @max_items: maximum number of items that are returned, use 0 for
* unlimited items
*/
GList *gl = NULL;
/* yes, the whole file is read and wen possible don not need all the
* lines, but this is easier to implement compared to reading the file
- * line wise from ent to begining */
+ * line wise from end to beginning */
char *line, **lines;
void *value;
int len, num_items = 0;
return gl;
}
- /* begin with tha last line of the file to make unique check easier -
+ /* begin with the last line of the file to make unique check easier -
* every already existing item in the list is the latest, so we don't need
- * to romove items from the list which takes some time */
+ * to remove items from the list which takes some time */
for (int i = len - 1; i >= 0; i--) {
line = lines[i];
g_strstrip(line);
/**
* Append new data to file.
*
- * @file: File to appen the data
+ * @file: File to append the data
* @format: Format string used to process va_list
*/
gboolean util_file_append(const char *file, const char *format, ...)
/**
* Replaces appearances of search in string by given replace.
- * Returne a new allocated string if search was found.
+ * Returns a new allocated string if search was found.
*/
char *util_str_replace(const char* search, const char* replace, const char* string)
{