diff -u -r a/src/callbacks.c b/src/callbacks.c --- a/src/callbacks.c 2019-01-04 18:26:24.000000000 +0300 +++ b/src/callbacks.c 2019-04-05 18:15:48.859083089 +0300 @@ -1378,7 +1378,7 @@ #ifdef G_OS_WIN32 wc = GEANY_WORDCHARS "./-" "\\"; #else - wc = GEANY_WORDCHARS "./-"; + wc = GEANY_WORDCHARS "./-:"; #endif g_return_if_fail(doc != NULL); @@ -1388,6 +1388,11 @@ if (sel != NULL) { + /* Strip line and column from filename, if any. */ + gint line = -1; + gint column = -1; + get_line_and_column_from_filename(sel, &line, &column); + gchar *filename = NULL; if (g_path_is_absolute(sel)) @@ -1421,14 +1426,29 @@ #endif } - if (g_file_test(filename, G_FILE_TEST_EXISTS)) - document_open_file(filename, FALSE, NULL, NULL); - else + /* Restore line and column. */ + if (line > 0) + { + SETPTR(filename, g_strdup_printf("%s:%d", filename, line)); + if (column > 0) + { + SETPTR(filename, g_strdup_printf("%s:%d", filename, column)); + } + } + + /* Set file_prefs.cmdline_new_files to false to avoid opening a new file. */ + gboolean cmdline_new_files = file_prefs.cmdline_new_files; + file_prefs.cmdline_new_files = FALSE; + + if (!main_handle_filename(filename)) { SETPTR(sel, utils_get_utf8_from_locale(sel)); ui_set_statusbar(TRUE, _("Could not open file %s (File not found)"), sel); } + /* Restore the original option value. */ + file_prefs.cmdline_new_files = cmdline_new_files; + g_free(filename); g_free(sel); } Only in b/src: editor.c.orig Only in b/src: highlighting.c.orig diff -u -r a/src/libmain.c b/src/libmain.c --- a/src/libmain.c 2019-01-04 18:26:24.000000000 +0300 +++ b/src/libmain.c 2019-04-05 18:19:59.492175838 +0300 @@ -342,7 +342,7 @@ /* get a :line:column specifier from the end of a filename (if present), * return the line/column values, and remove the specifier from the string * (Note that *line and *column must both be set to -1 initially) */ -static void get_line_and_column_from_filename(gchar *filename, gint *line, gint *column) +void get_line_and_column_from_filename(gchar *filename, gint *line, gint *column) { gsize i; gint colon_count = 0; diff -u -r a/src/main.h b/src/main.h --- a/src/main.h 2019-01-04 18:26:24.000000000 +0300 +++ b/src/main.h 2019-04-05 17:41:15.746984530 +0300 @@ -68,6 +68,7 @@ const gchar *main_get_version_string(void); gchar *main_get_argv_filename(const gchar *filename); +void get_line_and_column_from_filename(gchar *filename, gint *line, gint *column); gboolean main_quit(void);