Permalink
Browse files

Fix tab indentation.

Remove trailing space.
Add comment about not using yes/no buttons in dialogs.


git-svn-id: https://geany-plugins.svn.sourceforge.net/svnroot/geany-plugins/trunk/geany-plugins@937 e8383189-8249-0410-b506-acc975200cbd
  • Loading branch information...
1 parent 0fb1bd2 commit b4ab6a21a2b613658e6f5782447157b2ac906520 @ntrel ntrel committed Sep 16, 2009
View
@@ -78,10 +78,10 @@ static PluginCallback *glspi_geany_callbacks = NULL;
/*
- It seems to me like we could simply pass the callbacks pointer directly
- from the support library to the application. But for some reason that
- doesn't work at all. So we make a copy of the callbacks array here,
- and all is well...
+ It seems to me like we could simply pass the callbacks pointer directly
+ from the support library to the application. But for some reason that
+ doesn't work at all. So we make a copy of the callbacks array here,
+ and all is well...
*/
PLUGIN_EXPORT
PluginCallback plugin_callbacks[8] = {
View
@@ -395,8 +395,8 @@ static gint glspi_keycmd(lua_State* L)
if ( !he ) {
lua_pushfstring(
L, _( "Error in module \"%s\" at function %s():\n"
- "unknown command \"%s\" given for argument #1.\n"),
- LUA_MODULE_NAME, &__FUNCTION__[6], lua_tostring(L,1));
+ "unknown command \"%s\" given for argument #1.\n"),
+ LUA_MODULE_NAME, &__FUNCTION__[6], lua_tostring(L,1));
lua_error(L);
return 0;
}
@@ -424,7 +424,7 @@ static gint glspi_launch(lua_State* L)
g_strfreev(argv);
lua_pushboolean(L,rv);
if (rv) { return 1; }
- lua_pushstring(L,err->message);
+ lua_pushstring(L,err->message);
g_error_free(err);
return 2;
}
View
@@ -56,8 +56,8 @@ static void set_dialog_title(lua_State *L, GtkWidget*dialog) {
/*
- The GtkMessageDialog wants format strings, but we want literals.
- So we need to replace all '%' with "%%"
+ The GtkMessageDialog wants format strings, but we want literals.
+ So we need to replace all '%' with "%%"
*/
static gchar*pct_esc(const gchar*s)
{
@@ -164,7 +164,7 @@ static gint glspi_choose(lua_State* L)
scroll=gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox),scroll);
gtk_container_add(GTK_CONTAINER(scroll),tree);
@@ -252,6 +252,7 @@ static gint glspi_confirm(lua_State* L)
gtk_widget_grab_default(dv==GTK_RESPONSE_YES?yes_btn:no_btn);
/* Where I come from, we ask "yes-or-no?"
* who the hell ever asks "no-or-yes?" ??? */
+ /* It's probably better to use descriptive names for button text -ntrel */
gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog),
GTK_RESPONSE_YES,GTK_RESPONSE_NO );
set_dialog_title(L,dialog);
@@ -393,7 +394,7 @@ static gboolean create_file_filter(lua_State* L, GtkFileChooser*dlg, const gchar
}
}
}
- if (patterns) { g_strfreev(patterns); }
+ if (patterns) { g_strfreev(patterns); }
return TRUE;
}
@@ -434,11 +435,11 @@ static gchar *file_dlg(lua_State* L, gboolean save, const gchar *path, const gch
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dlg), path);
}
if (!create_file_filter(L, GTK_FILE_CHOOSER(dlg), mask)) {
- lua_pushfstring(L, _("Error in module \"%s\" at function pickfile():\n"
- "failed to parse filter string at argument #3.\n "),
- LUA_MODULE_NAME);
- lua_error(L);
- return NULL;
+ lua_pushfstring(L, _("Error in module \"%s\" at function pickfile():\n"
+ "failed to parse filter string at argument #3.\n "),
+ LUA_MODULE_NAME);
+ lua_error(L);
+ return NULL;
}
#if NEED_OVERWRITE_PROMPT
View
@@ -44,8 +44,8 @@ static gint glspi_newfile(lua_State* L)
/*
- Try to find the geany->documents_array index of the specified filename.
- Returns -1 if the filename doesn't match any open tabs.
+ Try to find the geany->documents_array index of the specified filename.
+ Returns -1 if the filename doesn't match any open tabs.
*/
static gint filename_to_doc_idx(const gchar*fn)
{
@@ -72,7 +72,7 @@ static gint doc_idx_to_tab_idx(gint idx)
/* Returns the filename of the specified document, or NULL on bad index */
static const gchar* doc_idx_to_filename(gint idx) {
- if ( (idx >= 0 ) && ( ((guint)idx) < geany->documents_array->len ) ) {
+ if ( (idx >= 0 ) && ( ((guint)idx) < geany->documents_array->len ) ) {
GeanyDocument *doc=g_ptr_array_index(geany->documents_array, idx);
if (doc) { return doc->file_name?doc->file_name:GEANY_STRING_UNTITLED; }
}
@@ -104,7 +104,7 @@ static gint glspi_activate(lua_State* L)
}
}
if (idx>=0) {
- if (idx!=gtk_notebook_get_current_page(NOTEBOOK)) {
+ if (idx!=gtk_notebook_get_current_page(NOTEBOOK)) {
gtk_notebook_set_current_page(NOTEBOOK, idx);
}
}
View
@@ -69,9 +69,9 @@ extern void glspi_run_script(gchar *script_file, gint caller, GKeyFile*proj, gch
/* Called by Geany, run a script associated with a keybinding. */
static void kb_activate(guint key_id)
{
- if ((key_id<MAX_HOT_KEYS) && KS[key_id]) {
+ if ((key_id<MAX_HOT_KEYS) && KS[key_id]) {
glspi_run_script(KS[key_id],0,NULL,SD);
- }
+ }
}
/* Convert a script filename into a "pretty-printed" menu label. */
@@ -80,7 +80,7 @@ static gchar* fixup_label(gchar*label)
gint i;
if (isdigit(label[0])&&isdigit(label[1])&&('.'==label[2])&&(label[3])) {
- memmove(label,label+3,strlen(label)-2);
+ memmove(label,label+3,strlen(label)-2);
}
/* Capitalize first char of menu label */
if (('_'==label[0])&&(label[1])) { /* Skip leading underscore */
@@ -278,8 +278,8 @@ static void menu_item_activate(GtkMenuItem * menuitem, gpointer gdata)
/*
Check if the script file begins with a special comment in the form:
-- @ACCEL@ <Modifiers>key
- If we find one, parse it, and bind that key combo to its menu item.
- See gtk_accelerator_parse() doc for more info on accel syntax...
+ If we find one, parse it, and bind that key combo to its menu item.
+ See gtk_accelerator_parse() doc for more info on accel syntax...
*/
static void assign_accel(GtkWidget*w, char*fn)
{
@@ -575,10 +575,10 @@ void glspi_configure(GtkWidget *parent)
}
static gint glspi_rescan(lua_State* L) {
- remove_menu();
- build_menu();
+ remove_menu();
+ build_menu();
hotkey_init();
- return 0;
+ return 0;
}
static const struct luaL_reg glspi_mnu_funcs[] = {
View
@@ -162,7 +162,7 @@ static gint kfile_data(lua_State *L)
/*
- Lua "closure" function to iterate through each string in an array of strings
+ Lua "closure" function to iterate through each string in an array of strings
*/
static gint strings_closure(lua_State *L)
{
View
@@ -34,12 +34,12 @@ void glspi_init_kfile_module(lua_State *L, KeyfileAssignFunc *func);
/*
- If a script gets caught in a tight loop and the timeout expires,
- and the user confirms they want to keep waiting, for some reason
- the normal methods for repainting the window don't work in the
- editor window, which makes it appear as if the dialog is still
- active. So we need to tell scintilla to paint over the spot
- where the dialog was.
+ If a script gets caught in a tight loop and the timeout expires,
+ and the user confirms they want to keep waiting, for some reason
+ the normal methods for repainting the window don't work in the
+ editor window, which makes it appear as if the dialog is still
+ active. So we need to tell scintilla to paint over the spot
+ where the dialog was.
*/
static void repaint_scintilla(void)
{
@@ -95,13 +95,13 @@ static gboolean glspi_goto_error(gchar *fn, gint line)
/*
- Display a message box showing any script error...
- Depending on the type of error, Lua will sometimes prepend the filename
- to the message. If need_name is TRUE then we assume that Lua didn't add
- the filename, so we prepend it ourself. If need_name is FALSE, then the
- error message likely contains a filename *and* a line number, so we
- give the user an option to automatically open the file and scroll to
- the offending line.
+ Display a message box showing any script error...
+ Depending on the type of error, Lua will sometimes prepend the filename
+ to the message. If need_name is TRUE then we assume that Lua didn't add
+ the filename, so we prepend it ourself. If need_name is FALSE, then the
+ error message likely contains a filename *and* a line number, so we
+ give the user an option to automatically open the file and scroll to
+ the offending line.
*/
static void glspi_script_error(gchar *script_file, const gchar *msg, gboolean need_name, gint line)
{
@@ -141,7 +141,7 @@ typedef struct _StateInfo {
gint counter;
gdouble remaining;
gdouble max;
- gboolean optimized;
+ gboolean optimized;
} StateInfo;
static GSList *state_list=NULL;
@@ -241,10 +241,10 @@ static void debug_hook(lua_State *L, lua_Debug *ar)
/*
- Pause the run timer, while dialogs are displayed. Note that we
- purposely add 1/10 of a second to our elapsed time here.
- That should not even be noticeable for most scripts, but
- it helps us time-out faster for dialogs caught in a loop.
+ Pause the run timer, while dialogs are displayed. Note that we
+ purposely add 1/10 of a second to our elapsed time here.
+ That should not even be noticeable for most scripts, but
+ it helps us time-out faster for dialogs caught in a loop.
*/
static void glspi_pause_timer(gboolean pause, gpointer user_data)
@@ -333,7 +333,7 @@ static gint glspi_traceback(lua_State *L)
}
/*
- The set_*_token functions assign default values for module-level variables
+ The set_*_token functions assign default values for module-level variables
*/
static void set_string_token(lua_State *L, gchar*name, gchar*value)
@@ -436,10 +436,10 @@ static gint glspi_init_module(lua_State *L, gchar *script_file, gint caller, GKe
/*
- Function to load this module into the standalone lua interpreter.
- The only reason you would ever want to do this is to re-generate
- the "keywords.list" file from the command line.
- See the file "util/keywords.lua" for more info.
+ Function to load this module into the standalone lua interpreter.
+ The only reason you would ever want to do this is to re-generate
+ the "keywords.list" file from the command line.
+ See the file "util/keywords.lua" for more info.
*/
PLUGIN_EXPORT
gint luaopen_libgeanylua(lua_State *L)
View
@@ -158,7 +158,7 @@ static gint glspi_caret(lua_State* L)
/*
- Translate between rectangular (line/column) and linear (position) locations.
+ Translate between rectangular (line/column) and linear (position) locations.
*/
static gint glspi_rowcol(lua_State* L)
{
@@ -269,8 +269,8 @@ static gint glspi_word(lua_State* L)
/*
- Pushes the line of text onto the Lua stack from the specified
- line number. Return FALSE only if the index is out of bounds.
+ Pushes the line of text onto the Lua stack from the specified
+ line number. Return FALSE only if the index is out of bounds.
*/
static gchar* get_line_text(GeanyDocument*doc,gint linenum)
{
@@ -286,7 +286,7 @@ static gchar* get_line_text(GeanyDocument*doc,gint linenum)
/*
- Lua "closure" function to iterate through each line in the current document
+ Lua "closure" function to iterate through each line in the current document
*/
static gint lines_closure(lua_State *L)
{
@@ -312,10 +312,10 @@ static gint glspi_lines(lua_State* L)
{
DOC_REQUIRED
if (lua_gettop(L)==0) {
- push_number(L,0);
+ push_number(L,0);
lua_pushlightuserdata(L,doc); /* Pass the doc pointer to our iterator */
- lua_pushcclosure(L, &lines_closure, 2);
- return 1;
+ lua_pushcclosure(L, &lines_closure, 2);
+ return 1;
} else {
int idx;
gchar *text;
@@ -425,7 +425,7 @@ static gint glspi_navigate(lua_State* L)
if ( SCI_NULL == scicmd ) {
lua_pushfstring(
L, _( "Error in module \"%s\" at function navigate():\n"
- "unknown navigation mode \"%s\" for argument #1.\n"),
+ "unknown navigation mode \"%s\" for argument #1.\n"),
LUA_MODULE_NAME, strcmd);
lua_error(L);
} else {
@@ -599,9 +599,9 @@ static SciCmdHashEntry* lookup_cmd_id(gint cmd)
static gint glspi_fail_not_implemented(lua_State* L, const gchar*funcname, gchar*cmdname)
{
lua_pushfstring(
- L, _( "Error in module \"%s\" at function %s():\n"
- "API command \"%s\" not implemented.\n"),
- LUA_MODULE_NAME, &funcname[6], cmdname);
+ L, _( "Error in module \"%s\" at function %s():\n"
+ "API command \"%s\" not implemented.\n"),
+ LUA_MODULE_NAME, &funcname[6], cmdname);
lua_error(L);
return 0;
}
@@ -610,9 +610,9 @@ static gint glspi_fail_not_implemented(lua_State* L, const gchar*funcname, gchar
static gint glspi_fail_arg_count(lua_State* L, const gchar*funcname, gchar*cmdname)
{
lua_pushfstring(
- L, _( "Error in module \"%s\" at function %s():\n"
- "not enough arguments for command \"%s\".\n"),
- LUA_MODULE_NAME, &funcname[6], cmdname);
+ L, _( "Error in module \"%s\" at function %s():\n"
+ "not enough arguments for command \"%s\".\n"),
+ LUA_MODULE_NAME, &funcname[6], cmdname);
lua_error(L);
return 0;
}
@@ -644,13 +644,13 @@ static gint glspi_scintilla(lua_State* L)
strncpy(cmdbuf,lua_tostring(L,1),sizeof(cmdbuf)-1);
for (i=0;cmdbuf[i];i++) {cmdbuf[i]=g_ascii_toupper(cmdbuf[i]);}
he=lookup_cmd_str((strncmp(cmdbuf,"SCI_",4)==0)?&cmdbuf[4]:cmdbuf);
- } else { return FAIL_STRING_ARG(1); }
+ } else { return FAIL_STRING_ARG(1); }
}
if ( !he ) {
lua_pushfstring(
L, _( "Error in module \"%s\" at function %s():\n"
- "unknown command \"%s\" given for argument #1.\n"),
- LUA_MODULE_NAME, &__FUNCTION__[6], lua_tostring(L,1));
+ "unknown command \"%s\" given for argument #1.\n"),
+ LUA_MODULE_NAME, &__FUNCTION__[6], lua_tostring(L,1));
lua_error(L);
return 0;
}
@@ -725,7 +725,7 @@ static gint glspi_scintilla(lua_State* L)
lua_pushnil(L);
return 1;
}
- break;
+ break;
case SLT_FINDTEXT: return FAIL_API;
case SLT_FORMATRANGE: return FAIL_API;
default:return FAIL_API;
Oops, something went wrong.

0 comments on commit b4ab6a2

Please sign in to comment.